Skip to content
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

x/crypto/ssh: Add tools for parsing a user's .ssh/config file #18781

Closed
kevinburke opened this issue Jan 25, 2017 · 4 comments
Closed

x/crypto/ssh: Add tools for parsing a user's .ssh/config file #18781

kevinburke opened this issue Jan 25, 2017 · 4 comments

Comments

@kevinburke
Copy link
Contributor

It's nice to be able to type "ssh nickname" and have the details loaded from your .ssh/config file:

Host nickname
    HostName somerealhost.region.hostingplatform.com
    User kevin
    IdentityFile ~/.foo/bar

Having to parse this file manually to figure out e.g. which IdentityFile to use and which user to authenticate as is a major blocker to using the primitives in x/crypto/ssh. Maybe it could parse into a map[string]*ssh.ClientConfig with appropriate defaults chosen.

The closest thing I've been able to find in the wild is https://godoc.org/github.com/moul/advanced-ssh-config/pkg/config, which seems like it should do the right thing. Unfortunately I was unable to use it to successfully parse my own SSH config file; there's some problem with it attempting to use a yaml parser to parse the file, or I'm passing it the wrong thing.

Apologies if this issue has been submitted before, I searched the issues list and couldn't find anything.

@kevinburke
Copy link
Contributor Author

(although Host fields can have wildcards e.g. Host 10.30.*, so maybe map[string]*ssh.ClientConfig is not the right data structure)

@hanwen
Copy link
Contributor

hanwen commented Jan 30, 2017

I think this shouldn't be in the x/crypto/ssh package. The config file is not a standard, and does not need access to any of the internals of the package.

openssh predates YAML's popularity by a large margin. Are you sure yaml is the right technology for parsing the file?

@gopherbot gopherbot added this to the Unreleased milestone Mar 21, 2017
@kevinburke
Copy link
Contributor Author

I went ahead and wrote this: https://github.com/kevinburke/ssh_config

The config file is not a standard

There's a manpage that describes the expected behavior in pretty explicit detail.

@hanwen
Copy link
Contributor

hanwen commented May 29, 2017

there is no RFC, though. Let's just see how popular this package becomes, and if it becomes very popular, we can always promote it into crypto/ssh

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants