Revert "cmd/age: automatically load default SSH key paths"

It's not clear the convenience for SSH keys is worth having any
implicitly configured identity at all. Will revisit after v1.0.0.

This reverts commit 225044b061.
This commit is contained in:
Filippo Valsorda
2021-03-09 18:18:48 -05:00
committed by Filippo Valsorda
parent 6c8d072dd8
commit 710644eef8

View File

@@ -12,7 +12,6 @@ import (
"flag" "flag"
"fmt" "fmt"
"io" "io"
"io/ioutil"
_log "log" _log "log"
"os" "os"
"runtime/debug" "runtime/debug"
@@ -293,26 +292,6 @@ func decrypt(keys []string, in io.Reader, out io.Writer) {
&LazyScryptIdentity{passphrasePrompt}, &LazyScryptIdentity{passphrasePrompt},
} }
// If they exist and are well-formed, load the default SSH keys. If they are
// passphrase protected, the passphrase will only be requested if the
// identity matches a recipient stanza.
for _, path := range []string{
os.ExpandEnv("$HOME/.ssh/id_rsa"),
os.ExpandEnv("$HOME/.ssh/id_ed25519"),
} {
content, err := ioutil.ReadFile(path)
if err != nil {
continue
}
ids, err := parseSSHIdentity(path, content)
if err != nil {
// If the key is explicitly requested, this error will be caught
// below, otherwise ignore it silently.
continue
}
identities = append(identities, ids...)
}
for _, name := range keys { for _, name := range keys {
ids, err := parseIdentitiesFile(name) ids, err := parseIdentitiesFile(name)
if err != nil { if err != nil {