System/modules/services/ssh.nix

32 lines
605 B
Nix
Raw Normal View History

2022-06-23 02:57:41 -04:00
{ config, lib, pkgs, ... }:
let
nathan = config.nathan;
in
with lib;
{
config = mkIf nathan.services.ssh {
networking.firewall = {
allowedTCPPorts = [ 22 ];
allowedUDPPorts = [ 22 ];
};
services.openssh = {
enable = true;
extraConfig = ''
StreamLocalBindUnlink yes
'';
listenAddresses = [
{
addr = "0.0.0.0";
port = 22;
}
];
permitRootLogin = "no";
passwordAuthentication = false;
};
# Enable mosh for connecting from phone or bad internet
programs.mosh.enable = true;
};
}