summary refs log tree commit diff
path: root/profiles/ssh.nix
blob: 5a62fe236dd7da21b3ceacd58b8e043479ed2ab9 (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
35
36
37
38
39
40
{
  pkgs,
  lib,
  config,
  inputs,
  ...
}: {
  config = {
    services.openssh = {
      enable = true;
      openFirewall = false;
      allowSFTP = false;
      startWhenNeeded = true;
      extraConfig = ''
        AllowTcpForwarding yes
        X11Forwarding no
        AllowAgentForwarding no
        AllowStreamLocalForwarding no
        AuthenticationMethods publickey
        StreamLocalBindUnlink yes

        AllowUsers tzlil git
      '';
      settings = {
        permitRootLogin = "no";
        passwordAuthentication = false;
        kbdInteractiveAuthentication = false;
      };
    };
    environment.persistence."/nix/persist" = {
      hideMounts = true;
      files = [
        "/etc/ssh/ssh_host_ed25519_key"
        "/etc/ssh/ssh_host_ed25519_key.pub"
        "/etc/ssh/ssh_host_rsa_key"
        "/etc/ssh/ssh_host_rsa_key.pub"
      ];
    };
  };
}