Skip to content

Commit

Permalink
Merge pull request #1022 from Mic92/ssh
Browse files Browse the repository at this point in the history
programs.ssh: add certificate authorities
  • Loading branch information
emilazy authored Aug 1, 2024
2 parents 7e08a9d + cf45edb commit b47af86
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion modules/programs/ssh/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down Expand Up @@ -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";
};
Expand Down

0 comments on commit b47af86

Please sign in to comment.