[WIP] Allow ssh key override
Implement the "easy" solution requested in #86.
This adds two features:
- Allow the user to override ssh-key on a per network basis in Supfile
- Allow the user to override the ssh-key on the command line by using the
-iflag
@aelsabbahy well done, this is a very good contribution! Thank you. Just a couple of naming nits and we can merge this..
Want it just changed in the docs or do you want the variable to also be renamed in the code?
Also, I take it networks: section should also have it renamed as identity-file?
Sorry for the delay on my end.. been pretty busy and going on vacation.. I'll pick this back up in a few weeks.
@aelsabbahy no worries, thanks a lot!
Anyone wants to finish this PR based on the above comments?
btw: Related PR: #123
@VojtechVitek Could I send a new PR to finish it (based on the PR and above comments)?
Currently, I want to add some features (#128):
-
parse some host info (from Networks-Host string) using
net/url, the string like this:ssh://username:password@hostname:port//path/to/ssh/key?KEY=value&KEY=valueeg:
ssh://tom:123@[email protected]:22//home/tom/.ssh/abc.key?MYSQL_HOST=127.0.0.1&MYSQL_PORT=3306we can get some info from it:
- ssh username:
tom - ssh password:
123@456 - ssh host:
192.168.16.10 - ssh port:
22 - ssh host+port:
192.168.16.10:22 - ssh identity file:
/home/tom/.ssh/abc.keyor~/.ssh/abc.key - some shell variables(per host #111):
MYSQL_HOST=127.0.0.1andMYSQL_PORT=3306
we can add a flag like
--use-unsecure-passwordto enable the password feature - ssh username:
-
update the package
golang.org/x/crypto/ssh -
(Maybe) use flag
-ito set (or add?) identity file
Could you give some advice? thank you!
@kadefor would be great if you could split it into separate PRs :) Thanks!
@kadefor Just a heads up if considering updating the /x/crypto/ssh package.
In 2017 the Go team made a breaking change to ssh.ClientConfig. (tl;dr, must explicitly specify ssh.HostKeyCallback)
https://go-review.googlesource.com/c/crypto/+/38701