about summary refs log tree commit diff
path: root/modules/ssh/default.nix
blob: f4449da1ff44f46548f00b89e9d085054fd2fe72 (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
{ 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

{
  networking.hosts."195.201.206.173" = [ "uhura.edef.eu" "uhura" ];
  networking.hosts."2a01:4f8:13a:2492::" = [ "uhura.edef.eu" "uhura" ];

  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 salsa
      HostName %h.debian.org

    Match host gitlab.freedesktop.org,salsa.debian.org
      VerifyHostKeyDNS yes

    Match host github.com,gitlab.*,salsa.debian.org
      User git
  '';

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

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

  programs.ssh.knownHostsFiles = [
    ./keys/cl.tvl.keys
    ./keys/edef.keys
    ./keys/github.keys
    ./keys/gitlab.gnome.org.keys
    ./keys/gitlab.keys
    ./keys/salsa.keys
  ];
}