Add native WireGuard DNS recovery and document verified activation

This commit is contained in:
Mikei386 committed 2026-10-28 08:35:34 +01:00
1 parent 3a0653224e
commit 745ee0700e
7 files changed
+446 -2

No files matched your search

+16
View File
@@ -58,3 +58,19 @@ LAN-Modussperre), Zustand nach Neuinitialisierung, alte Restore-Formate,
authentifizierte Parameterprüfung und verschlüsselten Backup-/Restore-Rundlauf
ohne WireGuard. Ein vollständiger Neuaufbau auf frischem Debian ist damit
nicht als geprüft ausgewiesen.
## Native Wiederverbindung nach DynDNS-/WAN-Wechsel
Der native Netzwerk-Installer richtet zusätzlich
`athena-deck-network-reconnect.timer` und die zugehörige kurze systemd-Aktion
aus `network/reconnect.py` ein. Der Timer prüft etwa minütlich und löst bei
einem veralteten Handshake den gespeicherten Peer-Hostnamen erneut auf.
Keepalive allein übernimmt diese erneute DNS-Auflösung nicht. Funktionierende
und bewusst deaktivierte Verbindungen bleiben unangetastet; es werden weder
Interfaces noch Anwendungsdienste neu gestartet.
Die Erweiterung benötigt keine Container und keine weiteren privaten Daten.
Bei einem bestehenden Gateway nur diese Erweiterung installieren, nicht den
gesamten Netzwerk-Installer erneut ausführen: dessen Hauptpfad startet den
Gateway-Dienst neu. Umfang, reale Abnahme, native Wiederherstellung und Rückfall:
[DNS-Wiederverbindung](maintenance/native-wireguard-reconnect-2026-10-28/README.md).
@@ -0,0 +1,109 @@
# Native WireGuard: DNS recovery installed · 28 October 2026
## Authorization and exclusions
Michael explicitly authorized native WireGuard diagnosis, reactivation and
persistent automatic recovery on Athena. This is a task-scoped exception, not
blanket permission for future VPN work. Files named `vpn.auth`, `/vpn`, the
excluded OpenVPN-KIT tree and every VPN container remain outside the scope.
No VPN container, other service's credentials or private VPN configuration
outside the native Deck network owner was accessed. No keys/configuration
contents are included in this document or Git.
## Root cause and one-time recovery
The native owner is `athena-deck-network.service`, not a wg-quick unit. Its
`wgdeck0` interface was UP but the handshake was more than three hours old.
The configured hostname resolved to a different address from the running peer
endpoint. Configured and runtime keepalive were already 25 seconds. The native
helper only resolves the endpoint during initial connection; `connect()` is a
no-op while enabled, so it did not refresh stale DNS after the WAN change.
A narrowly scoped `wg set ... peer ... endpoint <configured-hostname:port>`
resolved the name again without deleting the interface, changing routes/keys,
closing gateway listeners or restarting Strata. A new handshake and native
`connected` status were observed. Saved native configuration was unchanged.
NAS TCP checks then succeeded for `192.168.1.212` ports 22, 8108 and 8120.
## Installed unattended recovery
- Native module: `/opt/athena-deck-network/network/reconnect.py`.
- Unit: `athena-deck-network-reconnect.service`, a bounded root oneshot with
only CAP_NET_ADMIN and the required socket families; no container dependency.
- Timer: `athena-deck-network-reconnect.timer`, enabled at boot, first check
30 seconds after boot, then every 60 seconds with up to 5 seconds jitter.
- Persisted enabled intent, native backend/interface and the existing configured
peer are checked. A healthy handshake (at most 135 seconds old) is left alone.
A stale handshake causes resolution of the original configured hostname again.
- Enabled intent/configuration/peer are rechecked immediately before the narrow
update. No interface creation, key/route/listener change or restart fallback.
- Manually disabled tunnels and missing peers are skipped. DNS/helper failure
produces only a generic error and is retried on the next timer interval.
- Runtime-only, secret-free result:
`/run/athena-deck-network/reconnect-status.json` (0600).
- Private configuration remains solely with the existing native owner. No
plaintext configuration copy or new credential was created.
The installation command originally expired at the tool-approval gate without
running. Michael subsequently requested activation again and approved the
execution. Only then was the timer installed and enabled.
## Actual acceptance
- 21 local native-network/reconnect unit tests passed; `git diff --check` passed.
- Installed public module and installer recipe were read back and matched.
- `systemd-analyze verify` passed for both new units before enabling the timer.
- Timer read-back: loaded, **enabled**, **active/waiting**.
- A real timer trigger at **08:27:27 CET** completed the oneshot with
`Result=success`, `ExecMainStatus=0`.
- Recorded result: `connected`, handshake age 34 seconds,
`endpoint_refreshed=false`: the healthy connection was correctly left alone.
- Independent subsequent native status: connected, handshake age 71 seconds.
- Existing native network helper retained **MainPID 1061**, with no restart.
- Independent NAS TCP checks again succeeded on ports 22, 8108 and 8120.
- A later scheduled trigger at **08:31:48 CET** also returned success, with
handshake age 51 seconds and no unnecessary endpoint update.
Selected secret-free acceptance evidence: [activation.json](evidence/activation.json).
No Fritzbox WAN-address change, production outage or host reboot was forced to
validate the timer. Actual one-time stale-DNS recovery, real timer execution,
unit tests and boot enablement are verified separately; future WAN-change and
reboot acceptance have not been executed. No model inference test or Strata
replacement was performed as part of this networking task.
## Native installation, restore and maintenance
Sources: `network/reconnect.py`, `network/test_reconnect.py`,
`deploy/setup_network_helper.py`. The explicit deployment file allowlist also
contains `network/reconnect.py`. Dependencies are the existing native Python 3,
systemd (including systemd-analyze), wireguard-tools and iproute2. No Python
package, new credential, Docker daemon or VPN container is required.
On fresh native installation the network installer copies the module and
installs/verifies/enables both reconnect units after the owning native service
is ready. Restore retains the existing protected native network state and
its encrypted backup procedure; the timer does not introduce additional
private persistent state. Full fresh-Debian installation/restore remains
unqualified under `deploy/NATIVE_INSTALL_REQUIREMENTS.md`.
For an already running gateway, deploy only the public reconnect module and
invoke `install_reconnect_units()` from the reviewed recipe. **Do not invoke
its full `main()` just to add the timer:** that path also restarts the existing
native network gateway. Preserve the current owner's source, policy and state.
Before updating the automation, verify owned unit markers and the reviewed
module version; never overwrite an unrelated unit or symlink. Updating this
oneshot module does not require restarting Deck, Strata or the native gateway.
The public implementation, native recipes and this record are maintained
together in `michael/Athena-Deck`. Git publication does not establish a complete
restore test or authorize any additional production deployment.
## Rollback
Disable only `athena-deck-network-reconnect.timer` with its normal systemd
operation; if needed, stop only the associated reconnect oneshot. This removes
automatic endpoint refresh without resetting the currently recovered tunnel,
restarting its owner, or changing keys/routes/policy. Remove only these newly
owned units/module if permanent removal is explicitly requested, then reload
the systemd unit definitions. Never run broad VPN cleanup.
@@ -0,0 +1,34 @@
{
"scope": "User-approved native Athena WireGuard endpoint refresh; VPN containers and excluded files remain out of scope",
"installed": true,
"module_sha256": "fb442bc953f98bea60f173fa808dced44b7669b19c4e38b8cfdc61f1739e0456",
"native_helper_pid_unchanged_during_installation": true,
"native_helper_pid": 1061,
"timer": {
"name": "athena-deck-network-reconnect.timer",
"active_state": "active",
"sub_state": "waiting",
"unit_file_state": "enabled",
"on_boot_seconds": 30,
"on_unit_active_seconds": 60,
"randomized_delay_seconds": 5,
"first_verified_trigger": "2026-10-28T08:27:27+01:00",
"later_verified_trigger": "2026-10-28T08:31:48+01:00"
},
"oneshot_result": "success",
"oneshot_exit_status": 0,
"later_recorded_result": {
"state": "connected",
"handshake_age_seconds": 51,
"endpoint_refreshed": false,
"checked_at": 1793172708.9690228
},
"nas_tcp_checks": {"22": true, "8108": true, "8120": true},
"local_unit_tests_passed": 21,
"systemd_units_verified": true,
"forced_wan_change_test_performed": false,
"host_reboot_test_performed": false,
"strata_restarted_by_this_task": false,
"vpn_containers_accessed": false,
"credentials_included": false
}