blob: d4a98af15c1987a37590815a4213eb59dace479e (
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
|
# To generate keys:
# dnssec-keygen -K /secret/keys/example.net example.net
{ config, lib, pkgs, ... }:
let
masterZones = [ "orbekk.com" "orbekk.no" "kufieta.net" ];
zone-files = pkgs.callPackage ../pkgs/zone-files/default.nix { };
in
{
networking.firewall = {
allowedTCPPorts = [ 53 ];
allowedUDPPorts = [ 53 ];
};
services.bind = {
enable = true;
extraConfig = ''
${lib.concatMapStrings (zone: ''
zone ${zone} {
type master;
file "/var/run/named/db.${zone}.zone";
auto-dnssec maintain;
key-directory "/opt/secret/bind/${zone}";
update-policy local;
allow-query { any; };
allow-transfer {
::1;
193.35.52.61; // trygve transfer
2a00:1b60:1011::6def:e868; // ns1
2001:67c:29f4::61; // ns2
2604:2000:12c1:c0c6::1000; // sabaki
};
also-notify {
193.35.52.61; // trygve transfer
2a00:1b60:1011::6def:e868; // ns1
2001:67c:29f4::61; // ns2
};
notify explicit;
};
'') masterZones}
'';
};
systemd.services.bind = {
preStart = lib.mkAfter ''
rm /var/run/named/*.jnl || true
cp -f ${zone-files}/* /var/run/named/
'';
};
}
|