From 1cd90b7cdd486c0a4aff50784ad6228f609b2e29 Mon Sep 17 00:00:00 2001 From: Memet Bilgin Date: Sat, 19 Oct 2024 13:05:08 +0300 Subject: [PATCH] allow for multiple default identity key files (#1112) * allow for multiple default identity key files * add ecdsa and reorder rsa to be last --- libvirt/uri/ssh.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libvirt/uri/ssh.go b/libvirt/uri/ssh.go index 54135589a..342f4c029 100644 --- a/libvirt/uri/ssh.go +++ b/libvirt/uri/ssh.go @@ -17,7 +17,7 @@ import ( const ( maxHostHops = 10 defaultSSHPort = "22" - defaultSSHKeyPath = "${HOME}/.ssh/id_rsa" + defaultSSHKeyPaths = "${HOME}/.ssh/id_ed25519,${HOME}/.ssh/id_ecdsa,${HOME}/.ssh/id_rsa" defaultSSHKnownHostsPath = "${HOME}/.ssh/known_hosts" defaultSSHConfigFile = "${HOME}/.ssh/config" defaultSSHAuthMethods = "agent,privkey" @@ -55,7 +55,7 @@ func (u *ConnectionURI) parseAuthMethods(target string, sshcfg *ssh_config.Confi if len(sshKeyPaths) == 0 { log.Printf("[DEBUG] found no ssh keys, using default keypath") - sshKeyPaths = []string{defaultSSHKeyPath} + sshKeyPaths = strings.Split(defaultSSHKeyPaths, ",") } log.Printf("[DEBUG] ssh identity files for host '%s': %s", target, sshKeyPaths)