support ssh Passphrase (#149)

* support ssh Passphrase

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* update

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu
2019-12-30 16:16:37 +08:00
committed by GitHub
parent 8d0b62974a
commit 6b488f1203
8 changed files with 110 additions and 33 deletions
+19 -7
View File
@@ -38,6 +38,11 @@ func main() {
Usage: "private ssh key",
EnvVar: "PLUGIN_SSH_KEY,PLUGIN_KEY,SSH_KEY,KEY,INPUT_KEY",
},
cli.StringFlag{
Name: "ssh-passphrase",
Usage: "ssh passphrase",
EnvVar: "PLUGIN_SSH_PASSPHRASE,PLUGIN_PASSPHRASE,SSH_PASSPHRASE,PASSPHRASE,INPUT_PASSPHRASE",
},
cli.StringFlag{
Name: "key-path,i",
Usage: "ssh private key path",
@@ -102,6 +107,11 @@ func main() {
Usage: "private ssh key of proxy",
EnvVar: "PLUGIN_PROXY_SSH_KEY,PLUGIN_PROXY_KEY,PROXY_SSH_KEY,INPUT_PROXY_KEY",
},
cli.StringFlag{
Name: "proxy.ssh-passphrase",
Usage: "proxy ssh passphrase",
EnvVar: "PLUGIN_PROXY_SSH_PASSPHRASE,PLUGIN_PROXY_PASSPHRASE,PROXY_SSH_PASSPHRASE,PROXY_PASSPHRASE,INPUT_PROXY_PASSPHRASE",
},
cli.StringFlag{
Name: "proxy.key-path",
Usage: "ssh private key path of proxy",
@@ -195,6 +205,7 @@ func run(c *cli.Context) error {
KeyPath: c.String("key-path"),
Username: c.String("user"),
Password: c.String("password"),
Passphrase: c.String("ssh-passphrase"),
Host: c.StringSlice("host"),
Port: c.Int("port"),
Timeout: c.Duration("timeout"),
@@ -205,13 +216,14 @@ func run(c *cli.Context) error {
Debug: c.Bool("debug"),
Sync: c.Bool("sync"),
Proxy: easyssh.DefaultConfig{
Key: c.String("proxy.ssh-key"),
KeyPath: c.String("proxy.key-path"),
User: c.String("proxy.username"),
Password: c.String("proxy.password"),
Server: c.String("proxy.host"),
Port: c.String("proxy.port"),
Timeout: c.Duration("proxy.timeout"),
Key: c.String("proxy.ssh-key"),
KeyPath: c.String("proxy.key-path"),
User: c.String("proxy.username"),
Password: c.String("proxy.password"),
Passphrase: c.String("proxy.ssh-passphrase"),
Server: c.String("proxy.host"),
Port: c.String("proxy.port"),
Timeout: c.Duration("proxy.timeout"),
},
},
Writer: os.Stdout,