Summary of the new feature / enhancement
The Microsoft.OpenSSH/SSHDConfig resource currently supports setting sshd_config keywords only when _purge: true, which replaces the entire configuration file. When _purge: false, there is ambiguity in handling keywords that can have multiple arguments. Keywords that can have multiple arguments are further divided into three categories: repeatable, comma-separated, and space-separated. Repeatable keywords (like Subsystem and Port) are spread over multiple lines. Comma-separated (like Ciphers) and space-separated (like AuthorizedKeysFile) keywords can have multiple arguments on a single line. Note, the keywords that are both space-separated and repeatable (i.e. AllowUsers) are classified under "repeatable" for the scope of this discussion.
Proposed technical implementation details (optional)
This proposal builds on the ideas previously discussed in #790 and #1070 to suggest handling these keywords through the following:
- For all keywords: the
Microsoft.OpenSSH/SSHDConfig resource simply passes the declared value through directly (overwriting any existing value(s) that may exist for that keyword)
- For repeatable keywords: the
Microsoft.OpenSSH/SSHDConfig.Repeatable resource with _exist facilitates addition/removal of specific entries
Examples:
Set - behaves as overwrite for all keyword types
- type: Microsoft.OpenSSH/SSHDConfig
properties:
PasswordAuthentication: false
Ciphers:
- +aes256-gcm@openssh.com
Port:
- 2222
Set - behaves as "add" for repeatable keywords
- type: Microsoft.OpenSSH/SSHDConfig.Repeatable
properties:
_exist: true
subsystem:
- "powershell /usr/bin/pwsh -sshs -NoLogo"
port:
- 3333
Set - behaves as "remove" for repeatable keywords
- type: Microsoft.OpenSSH/SSHDConfig.Repeatable
properties:
_exist: false
subsystem:
- "powershell /usr/bin/pwsh -sshs -NoLogo"
port:
- 3333
Summary of the new feature / enhancement
The
Microsoft.OpenSSH/SSHDConfigresource currently supports setting sshd_config keywords only when_purge: true, which replaces the entire configuration file. When_purge: false, there is ambiguity in handling keywords that can have multiple arguments. Keywords that can have multiple arguments are further divided into three categories: repeatable, comma-separated, and space-separated. Repeatable keywords (likeSubsystemandPort) are spread over multiple lines. Comma-separated (likeCiphers) and space-separated (likeAuthorizedKeysFile) keywords can have multiple arguments on a single line. Note, the keywords that are both space-separated and repeatable (i.e.AllowUsers) are classified under "repeatable" for the scope of this discussion.Proposed technical implementation details (optional)
This proposal builds on the ideas previously discussed in #790 and #1070 to suggest handling these keywords through the following:
Microsoft.OpenSSH/SSHDConfigresource simply passes the declared value through directly (overwriting any existing value(s) that may exist for that keyword)Microsoft.OpenSSH/SSHDConfig.Repeatableresource with_existfacilitates addition/removal of specific entriesExamples:
Set - behaves as overwrite for all keyword types
Set - behaves as "add" for repeatable keywords
Set - behaves as "remove" for repeatable keywords