nixos-config/config/services/named-submissive.nix

57 lines
1.5 KiB
Nix
Raw Normal View History

2022-12-14 17:02:17 +00:00
{
pkgs,
config,
dns,
hosts-list,
...
}: let
2022-12-14 17:16:18 +00:00
internalIP = import ../../utils/getInternalIP.nix config;
createListenEntry = ip: "inet ${ip} port 8653 allow { any; };";
listenEntries = builtins.map createListenEntry internalIP.listenIPsBare;
2022-12-14 17:02:17 +00:00
mkZone = name: {
master = false;
masters = ["fd0d:a262:1fa6:e621:b4e1:8ff:e658:6f49"];
file = "/var/lib/named/${name}";
};
in {
services.bind = {
enable = true;
2022-12-14 17:02:17 +00:00
zones = {
"darkkirb.de" = mkZone "darkkirb.de";
"_acme-challenge.darkkirb.de" = mkZone "_acme-challenge.darkkirb.de";
"chir.rs" = mkZone "chir.rs";
"_acme-challenge.chir.rs" = mkZone "_acme-challenge.chir.rs";
2022-12-14 18:50:12 +00:00
"int.chir.rs" = mkZone "int.chir.rs";
2022-12-14 17:02:17 +00:00
"_acme-challenge.int.chir.rs" = mkZone "_acme-challenge.int.chir.rs";
"shitallover.me" = mkZone "shitallover.me";
"_acme-challenge.shitallover.me" = mkZone "_acme-challenge.shitallover.me";
};
extraConfig = ''
statistics-channels {
${toString listenEntries}
};
'';
extraOptions = ''
allow-recursion {
127.0.0.1;
::1;
fc00::/7;
};
recursion yes;
dnssec-validation yes;
'';
};
networking.firewall.allowedTCPPorts = [53];
networking.firewall.allowedUDPPorts = [53];
services.prometheus.exporters.bind = {
enable = true;
bindGroups = ["server" "view" "tasks"];
bindURI = "http://${internalIP.listenIP}:8653/";
listenAddress = internalIP.listenIP;
};
2022-12-14 18:50:12 +00:00
systemd.tmpfiles.rules = [
"d /var/lib/named 4700 named named - -"
];
2022-12-14 17:02:17 +00:00
}