nixos-config/config/services/named.nix

87 lines
2.1 KiB
Nix
Raw Normal View History

2022-02-08 21:01:33 +00:00
{ config, dns, ... }:
2022-01-15 13:44:34 +00:00
let
internalIP = import ../../utils/getInternalIP.nix config;
createListenEntry = ip: "inet ${ip} port 8653 allow { any; };";
2022-01-15 13:44:34 +00:00
listenEntries = builtins.map createListenEntry internalIP.listenIPsBare;
2022-02-08 21:01:33 +00:00
chir-rs = import ../../zones/chir.rs.nix { inherit dns; };
signzone = import ../../zones/signzone.nix;
2022-01-15 13:44:34 +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
})
];
2022-01-14 19:56:02 +00:00
services.bind = {
enable = true;
zones = {
"darkkirb.de" = {
master = false;
masters = [
"fd00:e621:e621::1"
];
file = "darkkirb.de.zone";
};
"chir.rs" = {
2022-02-09 08:47:35 +00:00
master = true;
file = "/var/lib/named/chir.rs";
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-02-09 08:47:35 +00:00
file = "_acme-challenge.chir.rs";
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 = false;
masters = [
"fd00:e621:e621::1"
];
file = "int.chir.rs.zone";
};
"rpz.int.chir.rs" = {
master = false;
masters = [
"fd00:e621:e621::1"
];
file = "rpz.int.chir.rs.zone";
};
};
2022-01-15 13:44:34 +00:00
extraConfig = ''
statistics-channels {
${toString listenEntries}
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;
};
recursion yes;
response-policy {
zone "rpz.int.chir.rs";
};
dnssec-validation yes;
'';
2022-01-14 19:56:02 +00:00
};
networking.firewall.allowedTCPPorts = [ 53 ];
networking.firewall.allowedUDPPorts = [ 53 ];
2022-01-15 13:44:34 +00:00
services.prometheus.exporters.bind = {
enable = true;
bindGroups = [ "server" "view" "tasks" ];
bindURI = "http://${internalIP.listenIP}:8653/";
listenAddress = internalIP.listenIP;
};
2022-02-09 08:51:04 +00:00
sops.secrets."services/dns/named-keys" = { owner = "named"; };
2022-01-14 19:56:02 +00:00
}