summaryrefslogtreecommitdiff
path: root/os/core/ssh.nix
blob: 032bb44e5bb918f6e1ca32044c3a8d3865d8ce53 (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
{ config, lib, pkgs, ... }:
let
  cfg = config.os.core.ssh;
in
{
  options.os.core.ssh.enable = lib.mkEnableOption "enables ssh server setup";
  config = lib.mkIf cfg.enable {
    services.tailscale.enable = true;

    services.openssh = {
      enable = true;
      PasswordAuthentication = false;
      KbdInteractiveAuthentication = false;
    };

    programs.gnupg.agent = {
      enable = true;
      enableSSHSupport = true;
      pinentryPackage = pkgs.pinentry-curses;
    };

    networking.firewall = {
      trustedInterfaces = [ "tailscale0" ];
      allowedUDPPorts = [ 41641 ];
    };
  };
}