diff options
| author | Shulhan <m.shulhan@gmail.com> | 2020-12-21 09:35:54 +0700 |
|---|---|---|
| committer | Shulhan <m.shulhan@gmail.com> | 2020-12-21 09:35:54 +0700 |
| commit | f30f61a2c140f1c95119e0259d496feea16093d2 (patch) | |
| tree | 2c56c11240a13490c29ed2ff098c2cc1500feaed | |
| parent | 8d06fe0a94a42d72dfd4fc4eba86b69fce5022d8 (diff) | |
| download | pakakeh.go-f30f61a2c140f1c95119e0259d496feea16093d2.tar.xz | |
ssh: print the private key file that has an error when generating signers
Currently, if there is an error when parsing private key it will print
only error without knowing the offending file that cause it. For example,
generateSigners: ParsePrivateKey: ssh: this private key is passphrase protected
This changes print the offending private key file on the log message.
| -rw-r--r-- | lib/ssh/config_section.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/ssh/config_section.go b/lib/ssh/config_section.go index 18a1f7ce..ea7132ac 100644 --- a/lib/ssh/config_section.go +++ b/lib/ssh/config_section.go @@ -142,14 +142,16 @@ func (section *ConfigSection) generateSigners() { pkeyRaw, err := ioutil.ReadFile(pkey) if err != nil { if !errors.Is(err, os.ErrNotExist) { - log.Printf("generateSigners: " + err.Error()) + log.Printf("generateSigners %s: %s", pkey, + err.Error()) } continue } signer, err := ssh.ParsePrivateKey(pkeyRaw) if err != nil { - log.Printf("generateSigners: ParsePrivateKey: " + err.Error()) + log.Printf("generateSigners %s: ParsePrivateKey: %s", + pkey, err.Error()) continue } |
