Fix activation script to always regenerate age keys
Some checks failed
CI / Evaluate Artifacts (lxc-nix-builder) (push) Has been cancelled
CI / Flake Check (push) Has been cancelled
CI / Evaluate Key Configurations (nix-builder) (push) Has been cancelled
CI / Evaluate Key Configurations (nix-desktop1) (push) Has been cancelled
CI / Evaluate Key Configurations (nix-laptop1) (push) Has been cancelled
CI / Evaluate Artifacts (installer-iso-nix-laptop1) (push) Has been cancelled
CI / Build and Publish Documentation (push) Has been cancelled
CI / Format Check (push) Has been cancelled
Some checks failed
CI / Evaluate Artifacts (lxc-nix-builder) (push) Has been cancelled
CI / Flake Check (push) Has been cancelled
CI / Evaluate Key Configurations (nix-builder) (push) Has been cancelled
CI / Evaluate Key Configurations (nix-desktop1) (push) Has been cancelled
CI / Evaluate Key Configurations (nix-laptop1) (push) Has been cancelled
CI / Evaluate Artifacts (installer-iso-nix-laptop1) (push) Has been cancelled
CI / Build and Publish Documentation (push) Has been cancelled
CI / Format Check (push) Has been cancelled
This commit is contained in:
@@ -193,15 +193,16 @@ in
|
|||||||
|
|
||||||
# Generate age identity files from SSH host keys at boot
|
# Generate age identity files from SSH host keys at boot
|
||||||
# This is needed because age can't reliably use OpenSSH private keys directly
|
# This is needed because age can't reliably use OpenSSH private keys directly
|
||||||
|
# Must run before agenix tries to decrypt secrets
|
||||||
system.activationScripts.convertSshToAge = {
|
system.activationScripts.convertSshToAge = {
|
||||||
deps = [ ];
|
deps = [ "users" "groups" ];
|
||||||
text = ''
|
text = ''
|
||||||
mkdir -p /etc/age
|
mkdir -p /etc/age
|
||||||
if [ -f /etc/ssh/ssh_host_ed25519_key ] && ! [ -f /etc/age/ssh_host_ed25519.age ]; then
|
if [ -f /etc/ssh/ssh_host_ed25519_key ]; then
|
||||||
${pkgs.ssh-to-age}/bin/ssh-to-age -private-key -i /etc/ssh/ssh_host_ed25519_key > /etc/age/ssh_host_ed25519.age
|
${pkgs.ssh-to-age}/bin/ssh-to-age -private-key -i /etc/ssh/ssh_host_ed25519_key > /etc/age/ssh_host_ed25519.age || true
|
||||||
chmod 600 /etc/age/ssh_host_ed25519.age
|
chmod 600 /etc/age/ssh_host_ed25519.age 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
if [ -f /etc/ssh/ssh_host_rsa_key ] && ! [ -f /etc/age/ssh_host_rsa.age ]; then
|
if [ -f /etc/ssh/ssh_host_rsa_key ]; then
|
||||||
${pkgs.ssh-to-age}/bin/ssh-to-age -private-key -i /etc/ssh/ssh_host_rsa_key > /etc/age/ssh_host_rsa.age 2>/dev/null || true
|
${pkgs.ssh-to-age}/bin/ssh-to-age -private-key -i /etc/ssh/ssh_host_rsa_key > /etc/age/ssh_host_rsa.age 2>/dev/null || true
|
||||||
chmod 600 /etc/age/ssh_host_rsa.age 2>/dev/null || true
|
chmod 600 /etc/age/ssh_host_rsa.age 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user