- mango-dns -> wan-dns-update (module, script, systemd units): same job (keep ipv6-test.0ff.space's AAAA pointed at the current WAN address), now named for what actually provides the uplink (Nokia tethering). - Drop the dead `networking.dhcpcd.extraConfig` block in hosts/pinix/configuration.nix (end0 is the tnix maintenance link now, not an uplink; router-uplink.nix's mkForce for wan0 already won here). - Fix stale "Mango" wording in configuration.nix and localServices/tailscale.nix to describe the actual Nokia/pinix-router-dns setup. - Remove the now-dead transitional `enp1s0u1u2` dhcpcd stanza in router-uplink.nix -- wan0 has been the stable name across several reconnects/reboots. Not touched: scripts/pinix-reachability-probe.sh, scripts/configure-mango-dns.sh, docs/pinix-reboot-probe.md, docs/pinix-bind.md -- built entirely around the old Mango DNAT setup (uci/nft on the Mango itself), need their own rework for the Nokia uplink rather than a rename. Noted in docs/pinix-router-migration.md. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C5FvfdKcQjEFQ4aLrepcS1
28 lines
1.3 KiB
Bash
Executable file
28 lines
1.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Called by pinix's systemd timer with an agenix-backed EnvironmentFile.
|
|
# Update only the existing test/SSH AAAA; never create or delete records.
|
|
set -euo pipefail
|
|
set +x
|
|
public_ip=$(curl -6 --fail --silent --show-error --max-time 20 https://api6.ipify.org)
|
|
[[ "$public_ip" =~ ^[23][[:xdigit:]:]+$ && "$public_ip" == *:* ]] || {
|
|
echo 'Refusing a non-global IPv6 response.' >&2
|
|
exit 1
|
|
}
|
|
api() {
|
|
printf 'Authorization: Bearer %s\n' "$CLOUDFLARE_DNS_API_TOKEN" |
|
|
curl --fail --silent --show-error --max-time 20 -H @- \
|
|
-H 'Content-Type: application/json' "$@"
|
|
}
|
|
base=https://api.cloudflare.com/client/v4
|
|
zone=$(api "$base/zones?name=0ff.space" |
|
|
jq -er 'select(.success) | .result | select(length == 1) | .[0].id')
|
|
url="$base/zones/$zone/dns_records/d4365926627a225a9d38bba316474e61"
|
|
record=$(api "$url" | jq -ec 'select(.success) | .result |
|
|
select(.name == "ipv6-test.0ff.space" and .type == "AAAA" and .proxied == false)')
|
|
if [ "$(jq -r .content <<< "$record")" = "$public_ip" ]; then
|
|
echo "ipv6-test.0ff.space unchanged: $public_ip"
|
|
exit 0
|
|
fi
|
|
payload=$(jq -nc --arg ip "$public_ip" '{content:$ip,ttl:120}')
|
|
api -X PATCH "$url" --data "$payload" |
|
|
jq -e 'select(.success) | {name:.result.name,content:.result.content,ttl:.result.ttl}'
|