]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Only run ssh-add -L if SSH_AUTH_SOCK is found in the environment
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 4 Apr 2023 08:56:05 +0000 (10:56 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 4 Apr 2023 09:20:40 +0000 (11:20 +0200)
mkosi/__init__.py

index dfc0978a0b1998f06e91c37cc22808b8c77b9bd0..af06c51edb52d07d6cc4a3ab09947194423e0ded 100644 (file)
@@ -2306,7 +2306,7 @@ def load_credentials(args: argparse.Namespace) -> dict[str, str]:
         tz = run(["timedatectl", "show", "-p", "Timezone", "--value"], text=True, stdout=subprocess.PIPE).stdout.strip()
         creds["firstboot.timezone"] = tz
 
-    if args.ssh and "ssh.authorized_keys.root" not in creds:
+    if args.ssh and "ssh.authorized_keys.root" not in creds and "SSH_AUTH_SOCK" in os.environ:
         key = run(["ssh-add", "-L"], text=True, stdout=subprocess.PIPE, env=os.environ).stdout.strip()
         creds["ssh.authorized_keys.root"] = key