From 49bb115b37f682474b1bc1c0f0bf7d62ec0dc2df Mon Sep 17 00:00:00 2001 From: nyanotech Date: Fri, 12 May 2023 06:14:43 -0700 Subject: [PATCH] nixos/sshd: detect duplicate config keys --- nixos/modules/services/networking/ssh/sshd.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/networking/ssh/sshd.nix b/nixos/modules/services/networking/ssh/sshd.nix index 89ddf8215299..96deee7dc539 100644 --- a/nixos/modules/services/networking/ssh/sshd.nix +++ b/nixos/modules/services/networking/ssh/sshd.nix @@ -572,7 +572,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";