[easyssh] logs errors when parsing public keys (appleboy/easyssh-proxy#33)

* logs errors when parsing public keys

* adds missing newline

https://github.com/appleboy/drone-ssh/commit/b777a323265
This commit is contained in:
Diep Pham 2017-06-19 15:59:07 +07:00 committed by Wataru Ashihara
parent 6e20c74ff3
commit 71cbc0efd3
No known key found for this signature in database
GPG Key ID: CE9EC2D5AE43DEFA

View File

@ -9,6 +9,7 @@ import (
"fmt"
"io"
"io/ioutil"
"log"
"net"
"os"
"path/filepath"
@ -80,13 +81,17 @@ func getSSHConfig(config DefaultConfig) *ssh.ClientConfig {
}
if config.KeyPath != "" {
if pubkey, err := getKeyFile(config.KeyPath); err == nil {
if pubkey, err := getKeyFile(config.KeyPath); err != nil {
log.Printf("getKeyFile: %v\n", err)
} else {
auths = append(auths, ssh.PublicKeys(pubkey))
}
}
if config.Key != "" {
if signer, err := ssh.ParsePrivateKey([]byte(config.Key)); err == nil {
if signer, err := ssh.ParsePrivateKey([]byte(config.Key)); err != nil {
log.Printf("ssh.ParsePrivateKey: %v\n", err)
} else {
auths = append(auths, ssh.PublicKeys(signer))
}
}