sup icon indicating copy to clipboard operation
sup copied to clipboard

[WIP] Allow ssh key override

Open aelsabbahy opened this issue 9 years ago • 8 comments

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 -i flag

aelsabbahy avatar Jul 22 '16 00:07 aelsabbahy

@aelsabbahy well done, this is a very good contribution! Thank you. Just a couple of naming nits and we can merge this..

VojtechVitek avatar Jul 22 '16 14:07 VojtechVitek

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?

aelsabbahy avatar Jul 22 '16 14:07 aelsabbahy

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 avatar Aug 11 '16 15:08 aelsabbahy

@aelsabbahy no worries, thanks a lot!

VojtechVitek avatar Aug 11 '16 15:08 VojtechVitek

Anyone wants to finish this PR based on the above comments?

btw: Related PR: #123

VojtechVitek avatar Jan 16 '18 21:01 VojtechVitek

@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=value

    eg: ssh://tom:123@[email protected]:22//home/tom/.ssh/abc.key?MYSQL_HOST=127.0.0.1&MYSQL_PORT=3306

    we can get some info from it:

    1. ssh username: tom
    2. ssh password: 123@456
    3. ssh host: 192.168.16.10
    4. ssh port: 22
    5. ssh host+port: 192.168.16.10:22
    6. ssh identity file: /home/tom/.ssh/abc.key or ~/.ssh/abc.key
    7. some shell variables(per host #111): MYSQL_HOST=127.0.0.1 and MYSQL_PORT=3306

    we can add a flag like --use-unsecure-password to enable the password feature

  • update the package golang.org/x/crypto/ssh

  • (Maybe) use flag -i to set (or add?) identity file

Could you give some advice? thank you!

kadefor avatar Jun 12 '18 11:06 kadefor

@kadefor would be great if you could split it into separate PRs :) Thanks!

VojtechVitek avatar Jun 12 '18 14:06 VojtechVitek

@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

mfridman avatar Jun 14 '18 04:06 mfridman