aboutsummaryrefslogtreecommitdiff
path: root/modules/nixos/services/ssh/default.nix
blob: 283b4f3c6b6a5b67244a5c5fbffe3b0c90fae5ca (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
{ options, config, lib, namespace, ... }:

with lib; with lib.${namespace}; let
  cfg = config.${namespace}.services.ssh;
  impermanence = config.${namespace}.system.impermanence;
in {
  options.${namespace}.services.ssh = with types; {
    enable = mkEnableOption "ssh server";

    ports = mkOption {
      type = listOf port;
      default = [ 22 ];
      description = "ssh server ports";
    };
  };

  config = mkIf cfg.enable {
    services.openssh = {
      enable = true;
      ports = cfg.ports;
      
      settings = {
        PermitRootLogin = "no";
        PasswordAuthentication = false;
      };
    };
  };
}