From 008246292f20c8f29e71923f39f8b4e28f0fee77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Sun, 26 May 2024 17:06:23 +0200 Subject: [PATCH] Remove user@host from the lima ssh key MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don't expose the host information unless requested, i.e. when using loadDotSSHPubKeys=true for instance. Signed-off-by: Anders F Björklund --- pkg/sshutil/sshutil.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/sshutil/sshutil.go b/pkg/sshutil/sshutil.go index 1ad37ec5..1963fc56 100644 --- a/pkg/sshutil/sshutil.go +++ b/pkg/sshutil/sshutil.go @@ -63,8 +63,9 @@ func DefaultPubKeys(loadDotSSH bool) ([]PubKey, error) { return nil, fmt.Errorf("could not create %q directory: %w", configDir, err) } if err := lockutil.WithDirLock(configDir, func() error { - keygenCmd := exec.Command("ssh-keygen", "-t", "ed25519", "-q", "-N", "", "-f", - filepath.Join(configDir, filenames.UserPrivateKey)) + // no passphrase, no user@host comment + keygenCmd := exec.Command("ssh-keygen", "-t", "ed25519", "-q", "-N", "", + "-C", "lima", "-f", filepath.Join(configDir, filenames.UserPrivateKey)) logrus.Debugf("executing %v", keygenCmd.Args) if out, err := keygenCmd.CombinedOutput(); err != nil { return fmt.Errorf("failed to run %v: %q: %w", keygenCmd.Args, string(out), err)