services.openssh: add banner

Add the possibility to setup a banner.

Co-authored-by: Silvan Mosberger <github@infinisil.com>
This commit is contained in:
Matthieu Coudron 2019-09-16 19:21:23 +09:00 committed by Matthieu Coudron
parent c59ea8b8a0
commit 1835fc455b

View File

@ -232,6 +232,14 @@ in
''; '';
}; };
banner = mkOption {
type = types.nullOr types.lines;
default = null;
description = ''
Message to display to the remote user before authentication is allowed.
'';
};
authorizedKeysFiles = mkOption { authorizedKeysFiles = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = []; default = [];
@ -474,6 +482,8 @@ in
'' ''
UsePAM yes UsePAM yes
Banner ${if cfg.banner == null then "none" else pkgs.writeText "ssh_banner" cfg.banner}
AddressFamily ${if config.networking.enableIPv6 then "any" else "inet"} AddressFamily ${if config.networking.enableIPv6 then "any" else "inet"}
${concatMapStrings (port: '' ${concatMapStrings (port: ''
Port ${toString port} Port ${toString port}