mirror of
https://github.com/JulienMalka/snowfield.git
synced 2025-03-29 07:10:51 +01:00
feat: implement notifications from gustave->akhaten
This commit is contained in:
parent
78e90e159e
commit
43f11e25d4
1 changed files with 19 additions and 1 deletions
|
@ -31,18 +31,36 @@ let
|
||||||
];
|
];
|
||||||
}).config.zones;
|
}).config.zones;
|
||||||
|
|
||||||
|
stateDir = "/var/lib/nsd";
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
services.nsd = {
|
services.nsd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
interfaces = [
|
interfaces = [
|
||||||
config.machine.meta.ips.public.ipv4
|
config.machine.meta.ips.vpn.ipv4
|
||||||
config.machine.meta.ips.public.ipv6
|
config.machine.meta.ips.public.ipv6
|
||||||
];
|
];
|
||||||
zones = lib.mapAttrs (_: value: {
|
zones = lib.mapAttrs (_: value: {
|
||||||
data = builtins.toString value;
|
data = builtins.toString value;
|
||||||
provideXFR = [ "100.100.45.0/24 NOKEY" ];
|
provideXFR = [ "100.100.45.0/24 NOKEY" ];
|
||||||
|
notify = [ "${lib.snowfield.akhaten.ips.vpn.ipv4} NOKEY" ];
|
||||||
}) (evalZones zonesFromConfig);
|
}) (evalZones zonesFromConfig);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
systemd.services.nsd.preStart = lib.mkAfter ''
|
||||||
|
if [ -f ${stateDir}/counter ]; then
|
||||||
|
current_value=$(cat ${stateDir}/counter)
|
||||||
|
new_value=$((current_value + 1))
|
||||||
|
echo "$new_value" > ${stateDir}/counter
|
||||||
|
else
|
||||||
|
echo "0" > ${stateDir}/counter
|
||||||
|
new_value="0"
|
||||||
|
fi
|
||||||
|
sed -i "3s/0/$new_value/" ${stateDir}/zones/julienmalka.me
|
||||||
|
'';
|
||||||
|
|
||||||
|
networking.firewall.allowedUDPPorts = [ 53 ];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue