Open aelsabbahy opened 8 years ago
Or use ssh-agent, so if you have configured your keys to be cached by ssh-add, theoretically it should work... at least in code there was preparation for that: // If there's a running SSH Agent, try to use its Private keys. sock, err := net.Dial("unix", os.Getenv("SSH_AUTHSOCK")) if err == nil { agent := agent.NewClient(sock) signers, = agent.Signers() }
Not sure it works, didn't for me. I had the same problem, eventually I simply dedicated a different User to use sup to work-around it :)
I think ssh-agent worked for me when I tried it.
Honoring .ssh/config
allows for more complex things like setting the user.
ssh-agent works, as long as $SSH_AUTH_SOCK
env var is set correctly
otherwise, sup defaults to ~/.ssh/id_rsa
and ~/.ssh/id_dsa
--- we might want to parse more files from ~/.ssh
directory (ssh does this by default)
Parsing ~/.ssh/config
is also doable - but personally, I don't have time for it. Feel free to take over and send us a PR :)
+1 worked for me with ssh-agent as described above, eventually :) to add config file support - I will first have to gain more experience in Go :)
is this going to happen? :)
@jakewarren I have a starter solution to parse / honour ~/.ssh/config
in https://github.com/pressly/sup/pull/105 . shouldn't be too much of an extension to handle different keys as well
@pxue pls let me know if you want to add it to #105. I'll try my best to finally finish the review after it's done. (Sorry for the delay!)
I suspect the global auth initialization code:
var initAuthMethodOnce sync.Once
var authMethod ssh.AuthMethod
must be changed to something like:
var authMethod map[string]ssh.AuthMethod
Do allow per-network configuration of keys?
I would prefer to specify the keys in the supfile instead of parsing the openssh configfile because I prefer to have the config in one place. I also think it is not feasible to map the openssh CertificateFile to sups networks in a consistent way.
I my pull request https://github.com/juergenhoetzel/sup/commit/74b4a4b193c0f8cc3db1bb5b85fc981bdedfbb41 I have relaxed the search for SSH-Keys: Use of id_" wildcard.
FYI, #123 has been just merged. Sup now loads any private key matching ~/.ssh/id_*
wildcard.
The only remaining part is actually using the custom IdentityFile. It doesn't work yet.
I think comments (#
) if the config ends with a comment and lines ending with whitespace in the ssh config file make sup hang
ah sup hangs because doesn't expect a host to have multiple aliases, which might be the case if using ~/.ssh
. The parser lib also doesn't trim whitespace from the Port
field, that should at least do since the port is always single
Although sup also hangs when the last line in the config is a comment, have not checked if its related to the parser
Also when using a config file a run
command is actually run only on one host (?) this is weird
Yeah, I just figured it out, Is this a bug, not looping through the hosts if it's pulling from SSH Config file
For those who want to use it with custom keys, simple symlink worked for me:
$ cd ~/.ssh
$ ln -s mykey id_mykey
$ ln -s mykey.pub id_mykey.pub
Awesome project!
Currently it seems ssh key is hardcoded to
~/.ssh/id_rsa
or~/.ssh/id_dsa
.sup -i ~/.ssh/some_key ..