summaryrefslogtreecommitdiff
path: root/aphrodite/dns/default.nix
blob: 6dc664dc6611d4fca172f1599705b7bb04566288 (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
{config, ...}: let
  domain = config.customOps.domain.fqdn;
in {
  networking.firewall = {
    allowedTCPPorts = [53 853];
    allowedUDPPorts = [53];
  };
  services = {
    kresd = {
      enable = true;
      listenPlain = [
        "[::]:53"
        "0.0.0.0:53"
      ];
      listenTLS = [
        "[::]:853"
        "0.0.0.0:853"
      ];
    };
    doh-server = {
      enable = true;
      settings = {
        path = "/";
        upstream = ["udp:127.0.0.1:53"];
      };
    };
    nginx.virtualHosts."dns.${domain}" = {
      forceSSL = true;
      enableACME = true;
      locations."/" = {
        proxyPass = "http://127.0.0.1:8053";
        extraConfig = ''
          proxy_http_version 1.1;
        '';
      };
    };
  };
}