2022-06-08 21:32:16 +00:00
|
|
|
{ config, pkgs, ... }:
|
2022-05-25 00:24:11 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
systemd.services.ddns-he = {
|
|
|
|
description = "update dynamic DNS entries for HurricaneElectric";
|
2022-06-08 21:32:16 +00:00
|
|
|
serviceConfig = {
|
|
|
|
EnvironmentFile = config.sops.secrets.ddns_he.path;
|
|
|
|
# TODO: ProtectSystem = "strict";
|
|
|
|
# TODO: ProtectHome = "full";
|
|
|
|
# TODO: PrivateTmp = true;
|
|
|
|
};
|
2022-05-25 00:24:11 +00:00
|
|
|
# HE DDNS API is documented: https://dns.he.net/docs.html
|
|
|
|
script = let
|
|
|
|
crl = "${pkgs.curl}/bin/curl -4";
|
|
|
|
in ''
|
2022-06-08 21:32:16 +00:00
|
|
|
${crl} "https://he.uninsane.org:$HE_PASSPHRASE@dyn.dns.he.net/nic/update?hostname=he.uninsane.org"
|
|
|
|
${crl} "https://native.uninsane.org:$HE_PASSPHRASE@dyn.dns.he.net/nic/update?hostname=native.uninsane.org"
|
|
|
|
${crl} "https://uninsane.org:$HE_PASSPHRASE@dyn.dns.he.net/nic/update?hostname=uninsane.org"
|
2022-05-25 00:24:11 +00:00
|
|
|
'';
|
2022-05-25 02:02:51 +00:00
|
|
|
};
|
2022-06-20 22:36:48 +00:00
|
|
|
systemd.timers.ddns-he = {
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
timerConfig = {
|
|
|
|
OnStartupSec = "2min";
|
|
|
|
OnUnitActiveSec = "10min";
|
|
|
|
};
|
2022-05-25 00:24:11 +00:00
|
|
|
};
|
2022-06-08 21:32:16 +00:00
|
|
|
|
|
|
|
sops.secrets."ddns_he" = {
|
2022-06-12 22:11:41 +00:00
|
|
|
sopsFile = ../../../secrets/servo.yaml;
|
2022-06-08 21:32:16 +00:00
|
|
|
};
|
2022-05-25 00:24:11 +00:00
|
|
|
}
|