admin-ip-refresh
This skill should be used to refresh the prod SSH allowlist (Doppler ADMIN_IPS) after operator IP rotation. Detects drift, mutates Doppler with explicit ack.
admin-ip-refresh
Detects drift between the operator's current public IP and the Hetzner Cloud Firewall allow-list (Doppler prd_terraform/ADMIN_IPS), proposes a corrective Doppler mutation with explicit operator ack, and emits the exact terraform apply invocation for the operator to run. Does NOT call Terraform directly -- per AGENTS.md hr-all-infrastructure-provisioning-servers, infra apply stays operator-initiated.
When to use
- Reactive: operator can no longer SSH into
soleur-web-platform, andadmin-ip-drift.mddiagnosis points to a firewall-layer drop (nojournalctl -u sshentry for the operator IP). - Proactive: operator notices their IP may have rotated (router reboot, travel, ISP change). Run pre-emptively to update
ADMIN_IPSbefore the next SSH attempt fails.
Arguments
<arguments> #$ARGUMENTS </arguments>
Accepted flags:
--dry-run-- run detect/read/diff/warn steps (1-4) only. No writes. Useful for pre-incident hygiene checks.--verify-- re-run the diff step only (no mutation). Useful after an operator has runterraform applyto confirm the firewall rule matches.--fast-- emit the narrow-targetterraform apply -target=hcloud_firewall.webform alongside the full-graph form. Default output emits the full-graph form only, per HashiCorp guidance that-targetis for rare/recovery cases.
Prerequisites
dopplerCLI authenticated (doppler configure get token --plainreturns a token).hcloudCLI authenticated (for post-apply verification; optional for steps 1-6).curlon PATH.terraformon PATH (skill prints the invocation; operator runs it).
If doppler or curl is missing, abort with an install hint. Do not attempt to install them from the skill -- per AGENTS.md, the Bash tool runs without sudo.
Procedure
Read admin-ip-refresh-procedure.md for the full step-by-step procedure, including the egress-IP detection fallback chain, Doppler mutation pattern, and terraform apply emission. The sequence below is the abbreviated form.
- Detect egress IP via three-service fallback (
ifconfig.me->api.ipify.org->icanhazip.com) with strict timeouts (--connect-timeout 5 --max-time 10) and IPv4 regex + octet-range validation. Abort with exit 3 if all three fail. - Read current
ADMIN_IPSviadoppler secrets get ADMIN_IPS -p soleur -c prd_terraform --plain. Parse as JSON list. Abort if the secret is missing. - Diff. If
<current-egress>/32is in the list, print "No drift." and exit 0. If absent, show the pre-image list and the proposed post-image list (current list with<egress>/32appended). - Warn on list-length invariants. Post-image length == 1 triggers a P1 warning (no rotation margin). Post-image length > 10 triggers a P2 warning (stale residue, review-and-prune recommended).
- Operator ack. Print the exact
doppler secrets setinvocation the skill will run. Wait for literalyesper-command ack -- no--yes, no-auto-approve, per AGENTS.mdhr-menu-option-ack-not-prod-write-auth. Under the length-1 warning in Step 4, also require a literalunderstoodack before reaching this step. - Write Doppler. Stdin-piped from a 0600 temp file (no CLI-arg value, no
ps auxfleak),--silentto prevent value echo per Doppler's setting-secrets guide. Re-read the secret and compare byte-for-byte. Print the Doppler dashboard activity URL. - Emit
terraforminvocations. Print the exactterraform planandterraform applycommands (and, under--fast, the-target=hcloud_firewall.webvariants) for the operator to run. Do NOT execute them. - Verify prompt. Ask whether the operator ran
terraform apply. On "no", record the gap in the session output and suggest a follow-up--verifyinvocation.
Exit codes
The skill exits non-zero on failure so cron/one-shot invocations do not silently no-op. Full contract in admin-ip-refresh-procedure.md §"Exit codes".
0-- success (no drift OR drift corrected + operator acked + invocation emitted).3-- all three IP-detection services failed.4-- Doppler read or write failed.5-- operator refused the mutation (rejected theyesprompt OR theunderstoodsingle-entry prompt).
Sharp Edges
- Never run
terraform applyfrom the skill. Per AGENTS.mdhr-all-infrastructure-provisioning-servers, infra writes are operator-initiated. The skill's job is detection + Doppler mutation + command emission. - Nested
doppler runwhen running Terraform. Theapps/web-platform/infra/root usesdoppler run --name-transformer tf-varto hydrateTF_VAR_*variables from Doppler. The skill's emitted commands match this pattern (see AGENTS.mdcq-when-running-terraform-commands-locally). - VPN / Cloudflare WARP:
ifconfig.mereturns the egress IP the internet sees, which IS what the firewall sees. If the operator is on a VPN, adding the VPN egress toADMIN_IPSis the correct behavior -- do not attempt to detect the "real" home IP behind the VPN. - Doppler value echo protection. Every
doppler secrets setuses--silentand stdin-piped values. Temp files are 0600 andshred -u'd on exit.ADMIN_IPSis a list of operator egress IPs -- PII-adjacent under most interpretations, and log aggregators must not capture it. - IP-detection spoofing. The three-service fallback defends against upstream-routing anomalies where one provider returns stale or non-IPv4 content. Validate every response against
^([0-9]{1,3}\.){3}[0-9]{1,3}$AND octet-range (<= 255) before accepting. - Single-entry allow-list. A post-image list of length 1 has no rotation margin. The skill requires the operator to type
understoodto proceed, nudging toward 2-3 known-good CIDRs (home + mobile hotspot + travel).
Related
- Runbook:
knowledge-base/engineering/ops/runbooks/admin-ip-drift.md - Plan:
knowledge-base/project/plans/2026-04-19-ops-admin-ip-drift-prevention-plan.md - Institutional learning:
knowledge-base/project/learnings/2026-03-19-ci-ssh-deploy-firewall-hidden-dependency.md - AGENTS.md rules:
hr-ssh-diagnosis-verify-firewall,hr-all-infrastructure-provisioning-servers,hr-menu-option-ack-not-prod-write-auth.