MCPcopy Create free account
hub / github.com/tailscale/tailcat / getHostKeys

Function getHostKeys

tailcat_ssh.go:315–329  ·  view source on GitHub ↗

getHostKeys returns the SSH host key signers, generating an ed25519 key in ~/.config/tailcat/ssh/ if one doesn't exist.

()

Source from the content-addressed store, hash-verified

313// getHostKeys returns the SSH host key signers, generating an ed25519 key
314// in ~/.config/tailcat/ssh/ if one doesn't exist.
315func getHostKeys() ([]gossh.Signer, error) {
316 dir, err := sshKeyDir()
317 if err != nil {
318 return nil, err
319 }
320 keyPEM, err := hostKeyFileOrCreate(dir)
321 if err != nil {
322 return nil, err
323 }
324 signer, err := gossh.ParsePrivateKey(keyPEM)
325 if err != nil {
326 return nil, fmt.Errorf("parsing host key: %w", err)
327 }
328 return []gossh.Signer{signer}, nil
329}
330
331func sshKeyDir() (string, error) {
332 cfgDir, err := os.UserConfigDir()

Callers 1

Calls 2

sshKeyDirFunction · 0.85
hostKeyFileOrCreateFunction · 0.85

Tested by

no test coverage detected