diff --git a/modules/services/default.nix b/modules/services/default.nix index d907c18..2dba3e8 100644 --- a/modules/services/default.nix +++ b/modules/services/default.nix @@ -4,6 +4,7 @@ ./homer ./mumble-server ./rss-bridge + ./ssh-server ]; } diff --git a/modules/services/ssh-server/default.nix b/modules/services/ssh-server/default.nix new file mode 100644 index 0000000..3aa1827 --- /dev/null +++ b/modules/services/ssh-server/default.nix @@ -0,0 +1,29 @@ +# 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; + # Be more secure + permitRootLogin = "no"; + passwordAuthentication = false; + }; + + # Opens the relevant UDP ports. + programs.mosh.enable = true; + + # WARNING: if you remove this, then you need to assign a password to your user, otherwise + # `sudo` won't work. You can do that either by using `passwd` after the first rebuild or + # by setting an hashed password in the `users.users.felix` block as `initialHashedPassword`. + # additionally needed by deploy-rs + security.sudo.wheelNeedsPassword = false; + }; +} diff --git a/nixos/modules/ssh.nix b/nixos/modules/ssh.nix deleted file mode 100644 index 64e7c26..0000000 --- a/nixos/modules/ssh.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ config, lib, ... }: -{ - services.openssh = { - enable = true; - passwordAuthentication = lib.mkDefault false; - }; - - # WARNING: if you remove this, then you need to assign a password to your user, otherwise - # `sudo` won't work. You can do that either by using `passwd` after the first rebuild or - # by setting an hashed password in the `users.users.felix` block as `initialHashedPassword`. - security.sudo.wheelNeedsPassword = false; -}