From ca36ff4bf1362afea3b7fca46d12c9d8ca6dabec Mon Sep 17 00:00:00 2001 From: Charlotte Van Petegem Date: Thu, 16 Sep 2021 15:29:17 +0200 Subject: [PATCH] Fix ssh host config as root --- modules/base/ssh/default.nix | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/base/ssh/default.nix b/modules/base/ssh/default.nix index 5d06fcbe..1647d739 100644 --- a/modules/base/ssh/default.nix +++ b/modules/base/ssh/default.nix @@ -12,7 +12,7 @@ let pkgs.openssh ]; }; - base = home: { + base = home: user: { programs.ssh = { enable = true; compression = true; @@ -22,7 +22,7 @@ let userKnownHostsFile = "${config.chvp.cachePrefix}${home}/.ssh/known_hosts"; serverAliveInterval = 10; extraOptionOverrides = { - Include = config.age.secrets."files/programs/ssh/host_configuration".path; + Include = config.age.secrets."files/programs/ssh/host_configuration_${user}".path; IdentityFile = "${config.chvp.dataPrefix}${home}/.ssh/id_ed25519"; HostKeyAlgorithms = "ssh-ed25519-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa"; }; @@ -31,10 +31,13 @@ let }; in { - home-manager.users.root = { ... }: (base "/root"); - home-manager.users.charlotte = { ... }: (base "/home/charlotte"); - age.secrets."files/programs/ssh/host_configuration" = { + home-manager.users.root = { ... }: (base "/root" "root"); + home-manager.users.charlotte = { ... }: (base "/home/charlotte" "charlotte"); + age.secrets."files/programs/ssh/host_configuration_charlotte" = { file = ../../../secrets/files/programs/ssh/host_configuration.age; owner = "charlotte"; }; + age.secrets."files/programs/ssh/host_configuration_root" = { + file = ../../../secrets/files/programs/ssh/host_configuration.age; + }; }