aboutsummaryrefslogtreecommitdiff
path: root/modules/powerdns/default.nix
blob: 1f411dfb7a192e589ac58f9a70a09ea243ff334b (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
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, lib, pkgs, ... }:

let
  primary = ''
    allow-axfr-ips = 10.0.0.0/8,127.0.0.0/8
    allow-dnsupdate-from = 10.0.0.0/8,127.0.0.0/8
    also-notify = 10.10.0.3 10.10.0.4 10.10.0.5
    only-notify =

    default-soa-content = primary.ns.vapor.systems hostmaster.@ 0 10800 3600 604800 3600

    gpgsql-dbname = pdns
    gpgsql-host = /var/run/postgresql
    gpgsql-port = 5432
    gpgsql-user = pdns
    launch = gpgsql

    api = yes
    local-address = 0.0.0.0 [::]
    primary = yes
    webserver = yes
    webserver-address = 10.10.0.1
    webserver-allow-from = 10.0.0.0/8,127.0.0.0/8
    api-key = $PDNS_API_KEY
  '';

  autoprimary = pkgs.writeText "autoprimary.conf" ''
    10.10.0.1
  '';

  bind = pkgs.writeText "named.conf" ''
    include "/var/lib/pdns/named-autosecondary.conf";
  '';

  secondary = ''
    autosecondary = yes
    bind-config = ${bind}
    bind-autoprimary-config = /var/lib/pdns/named-autosecondary.conf
    bind-autoprimary-destdir = /var/lib/pdns/zones
    bind-autoprimaries = ${autoprimary}
    guardian = yes
    launch = bind
    local-address = 0.0.0.0 [::]
    secondary = yes

    allow-notify-from = 10.10.0.1/32
  '';
in
{
  imports = [ ./primary.nix ];

  options.services.powerdns = {
    role = lib.mkOption {
      type = lib.types.enum [ "primary" "secondary" ];
    };
  };

  config = {
    environment.systemPackages = [ pkgs.powerdns ];
    services.powerdns = {
      enable = true;
      extraConfig =
        if config.services.powerdns.role == "primary"
        then primary
        else secondary;
      secretFile = "/etc/secrets/pdns_api.env";
    };
  };
}
t/commit/.gitlab-ci.yml?h=1.3.2&id=d4368789bbfcd7b1ac15f45d2ed7b5b4fb30112c&follow=1'>add tanka ci configurationMax Audron-1/+1 2021-06-05ready tanka deploy for CIMax Audron-32/+69 2021-06-05remove tanka vendoringMax Audron-27651/+0 2021-05-26Release 1.0.1Max Audron-3/+3 2021-05-26fix log breaking once buffer fullMax Audron-2/+33 the log_msg function was poping the newest message and replacing it with the newest message, it should be poping the oldest messages. 2021-05-16add deployment stuffMax Audron-6/+27786 2021-05-15add container buildMax Audron-2/+35