builders: fix provisioning of ssh hostkeys

This commit is contained in:
Yureka 2024-08-05 08:18:13 +02:00
parent fe3cb577c1
commit 77ff556583

View file

@ -4,8 +4,7 @@ let
in
{
config = lib.mkIf (cfg.enable && cfg.netboot) {
systemd.services.openssh.after = [ "provision-ssh-hostkey.service" ];
systemd.services.sshd.after = [ "provision-ssh-hostkey.service" ];
systemd.services.provision-ssh-hostkey = {
wantedBy = [ "multi-user.target" ];
serviceConfig = {
@ -16,7 +15,7 @@ in
mkdir -p /etc/ssh
umask 0077
until ${pkgs.iputils}/bin/ping -c 1 vpn-gw.wob01.infra.forkos.org; do sleep 1; done
curl --local-port 25-1024 https://vpn-gw.wob01.infra.forkos.org/${config.networking.hostName}/ssh_host_ed25519_key > /etc/ssh/ssh_host_ed25519_key
${pkgs.curl}/bin/curl --local-port 25-1024 https://vpn-gw.wob01.infra.forkos.org/${config.networking.hostName}/ssh_host_ed25519_key > /etc/ssh/ssh_host_ed25519_key
# Run the activation script again to trigger agenix decryption
/run/current-system/activate
'';