Skip to content

Commit 415c88c

Browse files
authored
Token (#134)
* Attempt to fix secret * lint * wire in ssh keys
1 parent 3e5f1f6 commit 415c88c

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

pkg/agent/agent.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,21 @@ func New(opts *Options) (*Agent, error) {
318318
return nil, err
319319
}
320320

321+
// Auto-discover SSH private key for server-type edges when none is provided.
322+
if agentType == AgentTypeServer && opts.SSHPrivateKeyPath == "" && opts.SSHPassword == "" {
323+
home, err := os.UserHomeDir()
324+
if err == nil {
325+
// Try common key types in preference order.
326+
for _, name := range []string{"id_ed25519", "id_rsa", "id_ecdsa"} {
327+
p := filepath.Join(home, ".ssh", name)
328+
if _, serr := os.Stat(p); serr == nil {
329+
opts.SSHPrivateKeyPath = p
330+
break
331+
}
332+
}
333+
}
334+
}
335+
321336
// Build hub config.
322337
var hubConfig *rest.Config
323338
if opts.HubKubeconfig != "" {

0 commit comments

Comments
 (0)