-
Notifications
You must be signed in to change notification settings - Fork 57
Add Subsystem and SubsystemList Resources #1367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for managing SSH server Subsystem configurations through new DSC resources (Microsoft.OpenSSH.SSHD/Subsystem and Microsoft.OpenSSH.SSHD/SubsystemList). It also modifies the core sshdconfig behavior to handle repeatable keywords by overwriting them instead of throwing errors when _purge: false is set.
Changes:
- Adds structured keyword support (name-value format) to the parser and formatter for subsystem configurations
- Introduces two new DSC resources: Subsystem (single entry add/remove) and SubsystemList (batch operations with purge support)
- Removes the restriction preventing
_purge: falsefrom being used with repeatable keywords, enabling incremental updates
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
src/set.rs |
Adds set_sshd_config_repeat and set_sshd_config_repeat_list handlers, removes purge restriction for repeatable keywords |
src/parser.rs |
Implements structured keyword parsing to extract name/value pairs from subsystem entries, adds operator validation |
src/formatter.rs |
Adds formatting support for structured keywords with name/value object format |
src/metadata.rs |
Introduces KeywordInfo struct and STRUCTURED_KEYWORDS constant to encapsulate keyword metadata |
src/inputs.rs |
Defines NameValueEntry, RepeatInput, and RepeatListInput structs for the new resources |
src/args.rs |
Adds SshdConfigRepeat and SshdConfigRepeatList setting variants |
src/get.rs |
Adds catch-all error handling for new settings (which don't support get operations) |
src/main.rs |
Registers schema generation for new input types |
sshd-subsystem.dsc.resource.json |
Resource manifest for single subsystem entry operations |
sshd-subsystemList.dsc.resource.json |
Resource manifest for subsystem list operations |
tests/sshdconfigRepeat.tests.ps1 |
Unit tests for single subsystem entry operations |
tests/sshdconfigRepeatList.tests.ps1 |
Unit tests for subsystem list operations |
tests/sshdconfig.set.tests.ps1 |
Updated to remove obsolete test and add test for repeatable keyword overwrite behavior |
dsc/tests/dsc_sshdconfig.tests.ps1 |
Integration tests for new Subsystem/SubsystemList resources |
locales/en-us.toml |
Adds localization strings for new error messages |
.project.data.json |
Registers new resource manifests for build output |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
With two resources that manage the same underlying configuration. When key properties are introduced how would that work? I added a comment on this issue: #142 (comment) We might want to discuss in the WG group what the plan is for that. |
Tagged for WG discussion. I don't think we want to make the two mutually exclusive in that you can only use one or the other. However, currently this would naturally be resolved with last-one-wins. Since the resource is instantiated separately for each type, it doesn't know that it was already used before. Is documentation sufficient here? |
PR Summary
sshdconfigset behavior to overwrite for all keywords, instead of erroring for repeatable/multi-arg keywordssubsystemandsubsystemList, handled internally by sshdconfig viarepeat_keyword.rsmodulecanonical_properties.rsmodule to centralize handling of non-ssh keywords (_metadata,_exist, etc.)PR Context