about summary refs log tree commit diff
path: root/modules/ssh/default.nix
blob: f237caa2ee008f4084ba5e603f28dea0017bfc3a (plain) (blame)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
{ config, pkgs, lib, ... }:

let
  inherit (lib) concatStringsSep;

  mkDefault = lib.mkOverride ((lib.mkDefault null).priority - 1);

  # SSL added and removed here ;-)
  bannedAlgorithms = [
    "ecdsa-sha2-nistp256-cert-v01@openssh.com"
    "ecdsa-sha2-nistp384-cert-v01@openssh.com"
    "ecdsa-sha2-nistp521-cert-v01@openssh.com"
    "ecdsa-sha2-nistp256"
    "ecdsa-sha2-nistp384"
    "ecdsa-sha2-nistp521"
  ];
in

{
  programs.mosh.enable = mkDefault config.services.openssh.enable;

  programs.ssh.extraConfig = ''
    CASignatureAlgorithms -${concatStringsSep "," bannedAlgorithms}
    HostKeyAlgorithms -${concatStringsSep "," bannedAlgorithms}
    VerifyHostKeyDNS=ask

    Host uhura spock
      HostName %h.edef.eu

    Host hyperion
      HostName %h.kookie.space

    Host atuin
      HostName %h.qyliss.net

    Host github gitlab
      HostName %h.com

    Host cl.tvl
      HostName %h.fyi
      Port 29418

    Host slide-rule relay01
      HostName relay01.nixcon.net

    Host abacus dash01
      HostName dash01.nixcon.net

    Match host gitlab.freedesktop.org
      VerifyHostKeyDNS=yes

    Match host github.com,gitlab.com,gitlab.freedesktop.org
      User git
  '';

  services.openssh.authorizedKeysFiles = [ "${./keys}/%u.keys" ];
  services.openssh.strictModes = false;

  users.users.root.openssh.authorizedKeys.keyFiles = [ ./keys/qyliss.keys ];

  programs.ssh.knownHosts = {
    "github.com" = {
      publicKeyFile = ./keys/github.keys;
    };

    "gitlab.com" = {
      publicKeyFile = ./keys/gitlab.keys;
    };

    "edef" = {
      certAuthority = true;
      hostNames = [ "edef.eu" "*.edef.eu" ];
      publicKeyFile = ./keys/edef.keys;
    };

    "cl.tvl" = {
      hostNames = [ "cl.tvl.fyi" ];
      publicKeyFile = ./keys/cl.tvl.keys;
    };
  };
}