nixos/home: Gate DDNS updates on WAN readiness
Start updates when the WAN gate opens and skip timer runs while it is inactive. Keep periodic retries and wait for the local DNS services.
This commit is contained in:
+4
-2
@@ -374,8 +374,10 @@ route on `wan`, while `river`'s `pppd` hooks start and stop it. Consumers such a
|
|||||||
`wantedBy` + `partOf` + `after`, never `requires`/`wants`, so they cannot pull the target in early
|
`wantedBy` + `partOf` + `after`, never `requires`/`wants`, so they cannot pull the target in early
|
||||||
and they reload on WAN flap.
|
and they reload on WAN flap.
|
||||||
|
|
||||||
DDNS starts after `network.target` rather than this WAN gate and can fail before the WAN is
|
DDNS starts when this WAN gate opens, after the local authoritative server and recursor.
|
||||||
ready. Its timer retries periodically; `doas systemctl start ddns-update.service` retries
|
Its five-minute timer retries failed updates and refreshes the public records; timer and manual
|
||||||
|
starts skip the update while the WAN gate is inactive, without activating it. `river` also
|
||||||
|
updates immediately after PPPoE reconnects. `doas systemctl start ddns-update.service` retries
|
||||||
immediately once connectivity is available.
|
immediately once connectivity is available.
|
||||||
|
|
||||||
### WAN paths (summary)
|
### WAN paths (summary)
|
||||||
|
|||||||
@@ -127,18 +127,21 @@ in
|
|||||||
pdns.serviceConfig.RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6 AF_NETLINK";
|
pdns.serviceConfig.RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6 AF_NETLINK";
|
||||||
ddns-update = {
|
ddns-update = {
|
||||||
description = "DNS update script";
|
description = "DNS update script";
|
||||||
after = [ "network.target" ];
|
after = [ "wan-online.target" "pdns.service" "pdns-recursor.service" ];
|
||||||
|
wantedBy = [ "wan-online.target" ];
|
||||||
|
partOf = [ "wan-online.target" ];
|
||||||
path = [
|
path = [
|
||||||
(pkgs.python3.withPackages (ps: [ ps.cloudflare ]))
|
(pkgs.python3.withPackages (ps: [ ps.cloudflare ]))
|
||||||
pkgs.ldns
|
pkgs.ldns
|
||||||
];
|
];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
|
# Timer retries must not pull in the WAN gate or run before it opens.
|
||||||
|
ExecCondition = "${config.systemd.package}/bin/systemctl --quiet is-active wan-online.target";
|
||||||
ExecStart =
|
ExecStart =
|
||||||
''${./dns_update.py} -k ${config.age.secrets."home/ddclient-cloudflare.key".path} '' +
|
''${./dns_update.py} -k ${config.age.secrets."home/ddclient-cloudflare.key".path} '' +
|
||||||
''${pubDomain} ns${toString (index + 1)}.${config.networking.domain}'';
|
''${pubDomain} ns${toString (index + 1)}.${config.networking.domain}'';
|
||||||
};
|
};
|
||||||
wantedBy = [ "multi-user.target" ];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
timers = {
|
timers = {
|
||||||
|
|||||||
Reference in New Issue
Block a user