about summary refs log tree commit diff
path: root/modules/ssh/default.nix
blob: 8c978f9c790918c877cae7f94fd33d1ec77eed28 (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
{ config, pkgs, lib, ... }:

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

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

  programs.ssh.extraConfig = ''
    Host uhura spock
      HostName %h.edef.eu

    Host hyperion
      HostName %h.kookie.space

    Host atuin
      HostName %h.qyliss.net

    Match host github.com
      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;
    };

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