File tree 1 file changed +11
-1
lines changed
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package sshutil
3
3
import (
4
4
"errors"
5
5
"fmt"
6
+ "io/fs"
6
7
"os"
7
8
"os/exec"
8
9
"os/user"
@@ -110,7 +111,7 @@ func CommonArgs(useDotSSH bool) ([]string, error) {
110
111
}
111
112
args := []string {"-i" , privateKeyPath }
112
113
113
- // Append all private keys corresponding to ~/.ssh/*.pub to keep old instances workin
114
+ // Append all private keys corresponding to ~/.ssh/*.pub to keep old instances working
114
115
// that had been created before lima started using an internal identity.
115
116
if useDotSSH {
116
117
homeDir , err := os .UserHomeDir ()
@@ -127,7 +128,16 @@ func CommonArgs(useDotSSH bool) ([]string, error) {
127
128
}
128
129
privateKeyPath := strings .TrimSuffix (f , ".pub" )
129
130
_ , err = os .Stat (privateKeyPath )
131
+ if errors .Is (err , fs .ErrNotExist ) {
132
+ // Skip .pub files without a matching private key. This is reasonably common,
133
+ // due to major projects like Vault recommending the ${name}-cert.pub format
134
+ // for SSH certificate files.
135
+ //
136
+ // e.g. https://www.vaultproject.io/docs/secrets/ssh/signed-ssh-certificates
137
+ continue
138
+ }
130
139
if err != nil {
140
+ // Fail on permission-related and other path errors
131
141
return nil , err
132
142
}
133
143
args = append (args , "-i" , privateKeyPath )
You can’t perform that action at this time.
0 commit comments