From cf45edbf271a638637d4f1a824c429d7649ecbd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 31 Jul 2024 19:34:17 +0200 Subject: [PATCH] programs.ssh: add certificate authorities --- modules/programs/ssh/default.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/programs/ssh/default.nix b/modules/programs/ssh/default.nix index 6f72369a9..51c7796d9 100644 --- a/modules/programs/ssh/default.nix +++ b/modules/programs/ssh/default.nix @@ -11,6 +11,14 @@ let { name, ... }: { options = { + certAuthority = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + This public key is an SSH certificate authority, rather than an + individual host's key. + ''; + }; hostNames = mkOption { type = types.listOf types.str; default = []; @@ -139,7 +147,7 @@ in { "ssh/ssh_known_hosts" = mkIf (builtins.length knownHosts > 0) { text = (flip (concatMapStringsSep "\n") knownHosts (h: assert h.hostNames != []; - concatStringsSep "," h.hostNames + " " + lib.optionalString h.certAuthority "@cert-authority " + concatStringsSep "," h.hostNames + " " + (if h.publicKey != null then h.publicKey else readFile h.publicKeyFile) )) + "\n"; };