nixos-config/config/services/named.nix

126 lines
3.5 KiB
Nix
Raw Normal View History

2022-06-12 15:39:15 +00:00
{
pkgs,
config,
dns,
...
}: let
darkkirb-de = import ../../zones/darkkirb.de.nix {inherit dns;};
chir-rs = import ../../zones/chir.rs.nix {inherit dns;};
int-chir-rs = import ../../zones/int.chir.rs.nix {inherit dns;};
2022-02-08 21:01:33 +00:00
signzone = import ../../zones/signzone.nix;
2022-06-12 15:39:15 +00:00
in {
2022-02-08 21:01:33 +00:00
imports = [
(signzone {
inherit dns;
ksk = "services/dns/rs/chir/32969";
zsk = "services/dns/rs/chir/51207";
2022-02-08 21:01:33 +00:00
zone = chir-rs;
2022-02-09 08:47:35 +00:00
zonename = "chir.rs";
2022-02-08 21:01:33 +00:00
})
(signzone {
inherit dns;
ksk = "services/dns/rs/chir/int/35133";
zsk = "services/dns/rs/chir/int/19631";
zone = int-chir-rs;
zonename = "int.chir.rs";
})
2022-03-20 09:06:39 +00:00
(signzone {
inherit dns;
ksk = "services/dns/de/darkkirb/53136";
zsk = "services/dns/de/darkkirb/61825";
zone = darkkirb-de;
zonename = "darkkirb.de";
})
2022-02-08 21:01:33 +00:00
];
2022-01-14 19:56:02 +00:00
services.bind = {
enable = true;
zones = {
"darkkirb.de" = {
2022-03-20 09:06:39 +00:00
master = true;
file = "/var/lib/named/darkkirb.de";
2023-02-02 19:15:16 +00:00
slaves = ["fd7a:115c:a1e0:ab12:4843:cd96:6263:ad6b" "100.99.173.107"];
extraConfig = "also-notify {fd7a:115c:a1e0:ab12:4843:cd96:6263:ad6b; 100.99.173.107;};";
2022-03-20 09:06:39 +00:00
};
"_acme-challenge.darkkirb.de" = {
master = true;
2022-05-24 08:58:12 +00:00
file = "/var/lib/named/_acme-challenge.darkkirb.de";
2022-03-20 09:06:39 +00:00
extraConfig = ''
update-policy {
grant certbot. name _acme-challenge.darkkirb.de. txt;
};
'';
2022-01-14 19:56:02 +00:00
};
"chir.rs" = {
2022-02-09 08:47:35 +00:00
master = true;
file = "/var/lib/named/chir.rs";
2023-02-02 19:15:16 +00:00
slaves = ["fd7a:115c:a1e0:ab12:4843:cd96:6263:ad6b" "100.99.173.107"];
extraConfig = "also-notify {fd7a:115c:a1e0:ab12:4843:cd96:6263:ad6b; 100.99.173.107;};";
2022-01-14 19:56:02 +00:00
};
2022-02-09 08:47:35 +00:00
"_acme-challenge.chir.rs" = {
2022-02-08 21:01:33 +00:00
master = true;
2022-05-24 08:58:12 +00:00
file = "/var/lib/named/_acme-challenge.chir.rs";
2022-02-09 08:47:35 +00:00
extraConfig = ''
update-policy {
grant certbot. name _acme-challenge.chir.rs. txt;
2022-02-09 08:54:55 +00:00
};
2022-02-09 08:47:35 +00:00
'';
2022-02-08 21:01:33 +00:00
};
2022-01-14 19:56:02 +00:00
"int.chir.rs" = {
master = true;
file = "/var/lib/named/int.chir.rs";
2023-02-02 19:15:16 +00:00
slaves = ["fd7a:115c:a1e0:ab12:4843:cd96:6263:ad6b" "100.99.173.107"];
extraConfig = "also-notify {fd7a:115c:a1e0:ab12:4843:cd96:6263:ad6b; 100.99.173.107;};";
};
"_acme-challenge.int.chir.rs" = {
master = true;
2022-05-24 08:58:12 +00:00
file = "/var/lib/named/_acme-challenge.int.chir.rs";
extraConfig = ''
update-policy {
grant certbot. name _acme-challenge.int.chir.rs. txt;
};
'';
2022-12-14 17:02:17 +00:00
};
2022-01-14 19:56:02 +00:00
};
2022-01-15 13:44:34 +00:00
extraConfig = ''
statistics-channels {
2023-02-02 19:15:16 +00:00
inet 127.0.0.1 port 8653 allow { 127.0.0.1; };
2022-01-15 13:46:28 +00:00
};
2022-02-09 08:47:35 +00:00
include "/run/secrets/services/dns/named-keys";
2022-01-15 13:44:34 +00:00
'';
2022-01-15 14:03:51 +00:00
extraOptions = ''
allow-recursion {
127.0.0.1;
::1;
fc00::/7;
2023-02-02 19:15:16 +00:00
100.0.0.0/8;
2022-01-15 14:03:51 +00:00
};
recursion yes;
dnssec-validation yes;
2023-02-04 08:30:17 +00:00
allow-transfer {fd7a:115c:a1e0:ab12:4843:cd96:6263:ad6b; 100.99.173.107;};
2022-12-15 10:13:10 +00:00
notify-delay 0;
2022-01-15 14:03:51 +00:00
'';
2022-01-14 19:56:02 +00:00
};
2022-06-12 15:39:15 +00:00
networking.firewall.allowedTCPPorts = [53];
networking.firewall.allowedUDPPorts = [53];
2022-01-15 13:44:34 +00:00
services.prometheus.exporters.bind = {
enable = true;
2022-06-12 15:39:15 +00:00
bindGroups = ["server" "view" "tasks"];
2023-02-02 19:15:16 +00:00
bindURI = "http://127.0.0.1:8653/";
2023-12-10 09:36:28 +00:00
port = 1533;
2022-01-15 13:44:34 +00:00
};
2023-12-10 09:36:28 +00:00
services.prometheus.scrapeConfigs = [
{
job_name = "bind";
static_configs = [
{
targets = [
2023-12-10 10:37:09 +00:00
"127.0.0.1:${toString config.services.prometheus.exporters.bind.port}"
2023-12-10 09:36:28 +00:00
];
}
];
}
];
2022-06-12 15:39:15 +00:00
sops.secrets."services/dns/named-keys" = {owner = "named";};
2022-01-14 19:56:02 +00:00
}