about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authornyanotech <nyanotechnology@gmail.com>2023-05-12 06:14:43 -0700
committerMatthieu Coudron <teto@users.noreply.github.com>2023-05-25 00:01:03 +0200
commit3aad03a46430d583686d90065e787fff9b55f5b2 (patch)
tree9a957713178f9508f11216638b6243101f8f61c0 /nixos
parent6ecdee66b4933b5da4704a088ed5806c7745c048 (diff)
downloadnixlib-3aad03a46430d583686d90065e787fff9b55f5b2.tar
nixlib-3aad03a46430d583686d90065e787fff9b55f5b2.tar.gz
nixlib-3aad03a46430d583686d90065e787fff9b55f5b2.tar.bz2
nixlib-3aad03a46430d583686d90065e787fff9b55f5b2.tar.lz
nixlib-3aad03a46430d583686d90065e787fff9b55f5b2.tar.xz
nixlib-3aad03a46430d583686d90065e787fff9b55f5b2.tar.zst
nixlib-3aad03a46430d583686d90065e787fff9b55f5b2.zip
nixos/sshd: detect duplicate config keys
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/networking/ssh/sshd.nix5
1 files changed, 4 insertions, 1 deletions
diff --git a/nixos/modules/services/networking/ssh/sshd.nix b/nixos/modules/services/networking/ssh/sshd.nix
index fd9650a058c2..a0904f59a72e 100644
--- a/nixos/modules/services/networking/ssh/sshd.nix
+++ b/nixos/modules/services/networking/ssh/sshd.nix
@@ -569,7 +569,10 @@ in
       '';
 
     assertions = [{ assertion = if cfg.settings.X11Forwarding then cfgc.setXAuthLocation else true;
-                    message = "cannot enable X11 forwarding without setting xauth location";}]
+                    message = "cannot enable X11 forwarding without setting xauth location";}
+                  { assertion = lib.lists.unique (map (x: lib.strings.toLower x) (attrNames cfg.settings))
+                      == (map (x: lib.strings.toLower x) (attrNames cfg.settings));
+                    message = "Duplicate sshd config key; does your capitalization match the option's?"; } ]
       ++ forEach cfg.listenAddresses ({ addr, ... }: {
         assertion = addr != null;
         message = "addr must be specified in each listenAddresses entry";