blob: 4ad87f17435903f3aef65fd27da17f9c9d547202 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# modules/services/ssh/default.nix
#
# Configuration for secure remote access. I mainly use `mosh' for remoting into
# servers, as it provides a smoother experience for boxes hosted halfway around
# the world.
{
config,
lib,
...
}:
let
sshPort = 2222;
wheelUsers =
with config.users;
with builtins;
filter (u: elem "wheel" users.${u}.extraGroups) (attrNames users);
in
{
services.openssh = {
enable = lib.mkDefault true;
openFirewall = true;
startWhenNeeded = true;
ports = [ sshPort ];
settings = {
AllowUsers = wheelUsers;
PermitRootLogin = "no";
PasswordAuthentication = lib.mkDefault false;
};
};
# SSH over UDP!
programs.mosh.enable = true;
}
|