Skip to content

Commit 1cd90b7

Browse files
authored
allow for multiple default identity key files (#1112)
* allow for multiple default identity key files * add ecdsa and reorder rsa to be last
1 parent 0263f35 commit 1cd90b7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libvirt/uri/ssh.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
const (
1818
maxHostHops = 10
1919
defaultSSHPort = "22"
20-
defaultSSHKeyPath = "${HOME}/.ssh/id_rsa"
20+
defaultSSHKeyPaths = "${HOME}/.ssh/id_ed25519,${HOME}/.ssh/id_ecdsa,${HOME}/.ssh/id_rsa"
2121
defaultSSHKnownHostsPath = "${HOME}/.ssh/known_hosts"
2222
defaultSSHConfigFile = "${HOME}/.ssh/config"
2323
defaultSSHAuthMethods = "agent,privkey"
@@ -55,7 +55,7 @@ func (u *ConnectionURI) parseAuthMethods(target string, sshcfg *ssh_config.Confi
5555

5656
if len(sshKeyPaths) == 0 {
5757
log.Printf("[DEBUG] found no ssh keys, using default keypath")
58-
sshKeyPaths = []string{defaultSSHKeyPath}
58+
sshKeyPaths = strings.Split(defaultSSHKeyPaths, ",")
5959
}
6060

6161
log.Printf("[DEBUG] ssh identity files for host '%s': %s", target, sshKeyPaths)

0 commit comments

Comments
 (0)