2021-02-07 11:39:13 +01:00
|
|
|
# An SSH server, using 'mosh'
|
|
|
|
{ config, lib, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.my.services.ssh-server;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.my.services.ssh-server = {
|
|
|
|
enable = lib.mkEnableOption "SSH Server using 'mosh'";
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
services.openssh = {
|
|
|
|
# Enable the OpenSSH daemon.
|
|
|
|
enable = true;
|
2023-01-28 22:49:57 +01:00
|
|
|
|
|
|
|
settings = {
|
|
|
|
# Be more secure
|
|
|
|
PermitRootLogin = "no";
|
|
|
|
PasswordAuthentication = false;
|
|
|
|
};
|
2021-02-07 11:39:13 +01:00
|
|
|
};
|
|
|
|
|
2021-10-22 14:05:42 +02:00
|
|
|
# Persist SSH keys
|
|
|
|
my.system.persist.files =
|
|
|
|
let
|
|
|
|
pubAndPrivKey = key: [ key.path "${key.path}.pub" ];
|
|
|
|
in
|
|
|
|
lib.concatMap pubAndPrivKey config.services.openssh.hostKeys;
|
|
|
|
|
2021-02-07 11:39:13 +01:00
|
|
|
# Opens the relevant UDP ports.
|
|
|
|
programs.mosh.enable = true;
|
|
|
|
};
|
|
|
|
}
|