Skip to content

feat: adhere to ssh_config more strictly - #570

Merged
Eugeny merged 2 commits into
Eugeny:mainfrom
plaflamme:feat-strict-ssh-config
Oct 4, 2025
Merged

feat: adhere to ssh_config more strictly#570
Eugeny merged 2 commits into
Eugeny:mainfrom
plaflamme:feat-strict-ssh-config

Conversation

@plaflamme

Copy link
Copy Markdown
Contributor

ssh_config allows multiple Host patterns to match a provided hostname. When multiple blocks match, the first value of any key is used.

Furthermore, some host patterns can be negated, in which case, when a host matches that block is ignored entirely.

Also, IdentityFile is a bit different from other parameters: every instance adds a value to the list of files.

This PR adds a more strict parsing to config files into an SshConfig struct which can then be queried for a specific host. The configuration is merged according to the rules above.

The new types remain private to the config module, but they could eventually be made public so clients can implement more ssh2 features.

`ssh_config` allows multiple `Host` patterns to match a provided
hostname. When multiple blocks match, the first value of any `key` is
used.

Furthermore, some host patterns can be negated, in which case, when a
host matches that block is ignored entirely.

Also, `IdentityFile` is a bit different from other parameters: every
instance adds a value to the list of files.

This PR adds a more strict parsing to config files into an `SshConfig`
struct which can then be queried for a specific host. The configuration
is merged according to the rules above.

The new types remain private to the config module, but they could
eventually be made public so clients can implement more ssh2 features.
@Eugeny

Eugeny commented Oct 4, 2025

Copy link
Copy Markdown
Owner

Thank you!

@Eugeny
Eugeny merged commit 3f3cc16 into Eugeny:main Oct 4, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants