nixos: move ssh to its own module
This commit is contained in:
parent
a64332e822
commit
0c44f58311
2 changed files with 22 additions and 8 deletions
|
|
@ -23,17 +23,9 @@
|
|||
# useXkbConfig = true; # use xkb.options in tty.
|
||||
# };
|
||||
|
||||
|
||||
# Enable sysrq
|
||||
boot.kernel.sysctl."kernel.sysrq" = 1;
|
||||
|
||||
# Enable the OpenSSH daemon.
|
||||
services.openssh.enable = true;
|
||||
|
||||
# Open ports in the firewall.
|
||||
networking.firewall.allowedTCPPorts = [ 22 ];
|
||||
# networking.firewall.allowedUDPPorts = [ ... ];
|
||||
|
||||
# Auto store clean
|
||||
nix.gc = {
|
||||
automatic = true;
|
||||
|
|
|
|||
22
modules/linux/ssh.nix
Normal file
22
modules/linux/ssh.nix
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
# Enable the OpenSSH daemon.
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
allowSFTP = true;
|
||||
openFirewall = false;
|
||||
authorizedKeysInHomedir = false;
|
||||
settings = {
|
||||
PermitRootLogin = "no";
|
||||
PasswordAuthentication = false;
|
||||
GatewayPorts = "no";
|
||||
};
|
||||
};
|
||||
|
||||
# enable ssh in the firewall
|
||||
networking.firewall.allowedTCPPorts = [ 22 ];
|
||||
|
||||
# enable fail2ban
|
||||
services.fail2ban.enable = true;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue