From 483c55c0aba7d13744388341c3aba9ca7f414cc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 25 Nov 2022 10:13:32 +0100 Subject: [PATCH] kexec-installer: also support authorized_keys2 --- nix/kexec-installer.nix | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/nix/kexec-installer.nix b/nix/kexec-installer.nix index 698f850..1a9151b 100644 --- a/nix/kexec-installer.nix +++ b/nix/kexec-installer.nix @@ -19,10 +19,13 @@ pwd mkdir -p initrd/ssh pushd initrd - if [ -e /root/.ssh/authorized_keys ]; then - # workaround for debian shenanigans - grep -o '\(ssh-[^ ]* .*\)' /root/.ssh/authorized_keys >> ssh/authorized_keys - fi + for key in /root/.ssh/authorized_keys /root/.ssh/authorized_keys2; do + if [ -e "$key" ]; then + # workaround for debian shenanigans + grep -o '\(ssh-[^ ]* .*\)' "$key" >> ssh/authorized_keys + fi + done + # Typically for NixOS if [ -e /etc/ssh/authorized_keys.d/root ]; then cat /etc/ssh/authorized_keys.d/root >> ssh/authorized_keys fi