mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-17 07:13:23 +01:00
Merge pull request #58718 from Ma27/validate-ssh-configs
nixos/sshd: validate ssh configs during build
This commit is contained in:
commit
eb7c11d552
1 changed files with 10 additions and 1 deletions
|
@ -4,6 +4,15 @@ with lib;
|
|||
|
||||
let
|
||||
|
||||
sshconf = pkgs.runCommand "sshd.conf-validated" { nativeBuildInputs = [ cfgc.package ]; } ''
|
||||
cat >$out <<EOL
|
||||
${cfg.extraConfig}
|
||||
EOL
|
||||
|
||||
ssh-keygen -f mock-hostkey -N ""
|
||||
sshd -t -f $out -h mock-hostkey
|
||||
'';
|
||||
|
||||
cfg = config.services.openssh;
|
||||
cfgc = config.programs.ssh;
|
||||
|
||||
|
@ -339,7 +348,7 @@ in
|
|||
|
||||
environment.etc = authKeysFiles //
|
||||
{ "ssh/moduli".source = cfg.moduliFile;
|
||||
"ssh/sshd_config".text = cfg.extraConfig;
|
||||
"ssh/sshd_config".source = sshconf;
|
||||
};
|
||||
|
||||
systemd =
|
||||
|
|
Loading…
Reference in a new issue