aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/puppeth
diff options
context:
space:
mode:
authorBo <bohende@gmail.com>2017-11-13 04:24:42 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-11-13 04:24:42 +0800
commitcb8bbe70819839e6399c44fff6a75ab3d16b8791 (patch)
tree1beb6efbe63416f7921f4914d228cc7d78b49c09 /cmd/puppeth
parentf47adc9ea8f16544a023ea9b67d1ed320750c5e7 (diff)
downloadgo-tangerine-cb8bbe70819839e6399c44fff6a75ab3d16b8791.tar
go-tangerine-cb8bbe70819839e6399c44fff6a75ab3d16b8791.tar.gz
go-tangerine-cb8bbe70819839e6399c44fff6a75ab3d16b8791.tar.bz2
go-tangerine-cb8bbe70819839e6399c44fff6a75ab3d16b8791.tar.lz
go-tangerine-cb8bbe70819839e6399c44fff6a75ab3d16b8791.tar.xz
go-tangerine-cb8bbe70819839e6399c44fff6a75ab3d16b8791.tar.zst
go-tangerine-cb8bbe70819839e6399c44fff6a75ab3d16b8791.zip
puppeth: handle encrypted ssh keys (closes #15442) (#15443)
* cmd/puppeth: handle encrypted ssh keys * cmd/puppeth: fix unconvert linter error
Diffstat (limited to 'cmd/puppeth')
-rw-r--r--cmd/puppeth/ssh.go13
-rw-r--r--cmd/puppeth/wizard_network.go2
2 files changed, 13 insertions, 2 deletions
diff --git a/cmd/puppeth/ssh.go b/cmd/puppeth/ssh.go
index 47378a606..ec6a1b669 100644
--- a/cmd/puppeth/ssh.go
+++ b/cmd/puppeth/ssh.go
@@ -77,7 +77,18 @@ func dial(server string, pubkey []byte) (*sshClient, error) {
} else {
key, err := ssh.ParsePrivateKey(buf)
if err != nil {
- log.Warn("Bad SSH key, falling back to passwords", "path", path, "err", err)
+ fmt.Printf("What's the decryption password for %s? (won't be echoed)\n>", path)
+ blob, err := terminal.ReadPassword(int(os.Stdin.Fd()))
+ fmt.Println()
+ if err != nil {
+ log.Warn("Couldn't read password", "err", err)
+ }
+ key, err := ssh.ParsePrivateKeyWithPassphrase(buf, blob)
+ if err != nil {
+ log.Warn("Failed to decrypt SSH key, falling back to passwords", "path", path, "err", err)
+ } else {
+ auths = append(auths, ssh.PublicKeys(key))
+ }
} else {
auths = append(auths, ssh.PublicKeys(key))
}
diff --git a/cmd/puppeth/wizard_network.go b/cmd/puppeth/wizard_network.go
index ff2ff74f5..c20e31fab 100644
--- a/cmd/puppeth/wizard_network.go
+++ b/cmd/puppeth/wizard_network.go
@@ -71,7 +71,7 @@ func (w *wizard) makeServer() string {
fmt.Println()
fmt.Println("Please enter remote server's address:")
- // Read and fial the server to ensure docker is present
+ // Read and dial the server to ensure docker is present
input := w.readString()
client, err := dial(input, nil)