Skip to content

Conversation

StephenBrown2
Copy link

@StephenBrown2 StephenBrown2 commented Feb 10, 2022

This PR adds a list of config options pulled from https://man.openbsd.org/ssh_config (an example function to re-pull the list is included as well, commented out), and adds a KV.CanonicalKey() function, such that when printed with String(), the proper case is used for the Key, rather than all lowercase.

Example:

Host ssh.github.com gist.github.com github.com github
    Hostname ssh.github.com
    IdentitiesOnly yes
    IdentityFile ~/.ssh/id_ed25519
    User git

Without this, when manssh l prints:

        gist.github.com -> git@ssh.github.com:22
            identitiesonly = yes
            identityfile = ~/.ssh/id_ed25519

        github -> git@ssh.github.com:22
            identitiesonly = yes
            identityfile = ~/.ssh/id_ed25519

        github.com -> git@ssh.github.com:22
            identitiesonly = yes
            identityfile = ~/.ssh/id_ed25519

        github.me -> git@ssh.github.com:22
            identitiesonly = yes
            identityfile = ~/.ssh/id_ed25519

        ssh.github.com -> git@ssh.github.com:22
            identitiesonly = yes
            identityfile = ~/.ssh/id_ed25519

the ~/.ssh/config file is also modified:

Host ssh.github.com gist.github.com github.com github
    hostname ssh.github.com
    identitiesonly yes
    identityfile ~/.ssh/id_ed25519
    user git

With this change, the case is preserved in the file.

@StephenBrown2 StephenBrown2 changed the title Add canonically-cased config optons Add canonically-cased config options Feb 10, 2022
StephenBrown2 pushed a commit to StephenBrown2/manssh that referenced this pull request Feb 10, 2022
TODO: Remove reference to github.com/StephenBrown2/ssh_config when kevinburke/ssh_config#39 or xwjdsh/ssh_config#1 get merged
@kevinburke
Copy link
Owner

Thanks for this. Can I ask how you found this library? Or what underlying use case you ran into?

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