summary refs log tree commit diff
path: root/nixos/modules/services/networking/ssh
diff options
context:
space:
mode:
authorRoman Volosatovs <rvolosatovs@riseup.net>2018-06-12 18:26:20 +0200
committerRoman Volosatovs <rvolosatovs@riseup.net>2018-06-12 18:26:20 +0200
commit9953edaf75a34ddb3f4ab360d71502d829dc0fc5 (patch)
tree18820b9c8934128053ac0cb5c6a36547deb6e757 /nixos/modules/services/networking/ssh
parent61f0c1ce8757d67af4498bf04e2f5f52023027b2 (diff)
downloadnixpkgs-9953edaf75a34ddb3f4ab360d71502d829dc0fc5.tar
nixpkgs-9953edaf75a34ddb3f4ab360d71502d829dc0fc5.tar.gz
nixpkgs-9953edaf75a34ddb3f4ab360d71502d829dc0fc5.tar.bz2
nixpkgs-9953edaf75a34ddb3f4ab360d71502d829dc0fc5.tar.lz
nixpkgs-9953edaf75a34ddb3f4ab360d71502d829dc0fc5.tar.xz
nixpkgs-9953edaf75a34ddb3f4ab360d71502d829dc0fc5.tar.zst
nixpkgs-9953edaf75a34ddb3f4ab360d71502d829dc0fc5.zip
sshd: Support more ssh-keygen parameters
Diffstat (limited to 'nixos/modules/services/networking/ssh')
-rw-r--r--nixos/modules/services/networking/ssh/sshd.nix13
1 files changed, 12 insertions, 1 deletions
diff --git a/nixos/modules/services/networking/ssh/sshd.nix b/nixos/modules/services/networking/ssh/sshd.nix
index 902e759f3a3..9a6ac024bd4 100644
--- a/nixos/modules/services/networking/ssh/sshd.nix
+++ b/nixos/modules/services/networking/ssh/sshd.nix
@@ -198,6 +198,10 @@ in
           [ { type = "rsa"; bits = 4096; path = "/etc/ssh/ssh_host_rsa_key"; }
             { type = "ed25519"; path = "/etc/ssh/ssh_host_ed25519_key"; }
           ];
+        example =
+          [ { type = "rsa"; bits = 4096; path = "/etc/ssh/ssh_host_rsa_key"; rounds = 100; openSSHFormat = true; }
+            { type = "ed25519"; path = "/etc/ssh/ssh_host_ed25519_key"; rounds = 100; comment = "key comment"; }
+          ];
         description = ''
           NixOS can automatically generate SSH host keys.  This option
           specifies the path, type and size of each key.  See
@@ -356,7 +360,14 @@ in
 
                 ${flip concatMapStrings cfg.hostKeys (k: ''
                   if ! [ -f "${k.path}" ]; then
-                      ssh-keygen -t "${k.type}" ${if k ? bits then "-b ${toString k.bits}" else ""} -f "${k.path}" -N ""
+                      ssh-keygen \
+                        -t "${k.type}" \
+                        ${if k ? bits then "-b ${toString k.bits}" else ""} \
+                        ${if k ? rounds then "-a ${toString k.rounds}" else ""} \
+                        ${if k ? comment then "-C '${k.comment}'" else ""} \
+                        ${if k ? openSSHFormat && k.openSSHFormat then "-o" else ""} \
+                        -f "${k.path}" \
+                        -N ""
                   fi
                 '')}
               '';