Some checks failed
validate / lint (push) Failing after 2s
- Serialize every mutating command (recover, renew, register, rewrite-config, pause, resume, state-reset) on the shared lock, acquired BEFORE state is read rather than after: reading first and locking only around the write let a slower command silently clobber whatever a faster one wrote in between — in particular, an operator pause could be lost to an in-flight recovery pass that read state before the pause ran and only saved its own copy back afterwards. - Fix emergency_close() to reposition its VLAN 50 DROP to the first effective FORWARD position when it exists but has been pushed down by something else (e.g. an out-of-band ufw reload) — a bare `-C` existence check said nothing about position. - Tighten wait_for_verified()'s handshake freshness check from >= to > since_epoch: wg show and since_epoch are both whole seconds, so a handshake at exactly the same second as since_epoch is indistinguishable from a stale, pre-activation one and must not count as proof of a new one. - Fix the Ansible config-validation task to fail on any exit code outside status's three documented health exits (0/1/2), not just on 5 — verified live against the real program (no wg/ip/iptables on this dev machine reproduces the "nothing configured yet" first-run case; status correctly returns 1, and broken/missing config.json correctly returns 5 and is now caught). - Correct the live fault-injection drill in the role README: port 1337 is only the addKey registration API port, not the tunnel's own WireGuard UDP endpoint (derive that from `wg show pia-wg endpoints` instead), and make the packet-capture check direction-aware (`tcpdump -Q out`) so it can't conflate a real egress leak with VLAN 50's normal inbound arrival on enp1s0. Added 6 tests (86 total, all passing): emergency-close repositioning past a preceding ACCEPT, pause/resume blocking on an in-flight lock holder and surviving into a subsequent recovery pass, and the handshake boundary at exactly/one-second-either-side of since_epoch. yamllint, ansible-playbook --syntax-check, and ansible-lint (diffed against main — no new finding categories) all pass. No live changes; nothing pushed to main. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
37 lines
2.1 KiB
Django/Jinja
37 lines
2.1 KiB
Django/Jinja
{
|
|
"interface": {{ pia_wg_interface | to_json }},
|
|
"config_dir": {{ pia_wg_config_dir | to_json }},
|
|
"state_dir": {{ pia_gateway_state_dir | to_json }},
|
|
"credentials_file": {{ (pia_gateway_etc_dir + '/credentials.env') | to_json }},
|
|
"ca_file": {{ (pia_wg_config_dir + '/pia-ca.crt') | to_json }},
|
|
"lock_file": "/run/lock/pia-gateway.lock",
|
|
"route_table": {{ pia_route_table_name | to_json }},
|
|
"rule_priority": {{ pia_rule_priority | int }},
|
|
"vlan50_subnet": {{ pia_vlan50_subnet | to_json }},
|
|
"iptables_chain": {{ pia_iptables_chain | to_json }},
|
|
"lan_interface": {{ pia_lan_interface | to_json }},
|
|
"mss_clamp_enabled": {{ pia_mss_clamp_enabled | bool | to_json }},
|
|
"region_candidates": {{ pia_region_candidates | to_json }},
|
|
"handshake_max_age_sec": {{ pia_healthcheck_handshake_max_age_sec | int }},
|
|
"failure_threshold": {{ pia_recovery_failure_threshold | int }},
|
|
"startup_grace_sec": {{ pia_recovery_startup_grace_sec | int }},
|
|
"restart_wait_sec": {{ pia_recovery_restart_wait_sec | int }},
|
|
"activation_wait_sec": {{ pia_recovery_activation_wait_sec | int }},
|
|
"recovery_max_duration_sec": {{ pia_recovery_max_duration_sec | int }},
|
|
"backoff_schedule_sec": {{ pia_recovery_backoff_schedule_sec | to_json }},
|
|
"backoff_jitter_fraction": 0.1,
|
|
"max_candidates_per_cycle": {{ pia_recovery_max_candidates_per_cycle | int }},
|
|
"max_rotation_candidates": {{ pia_recovery_max_rotation_candidates | int }},
|
|
"renewal_after_days": {{ pia_renewal_after_days | int }},
|
|
"http_connect_timeout_sec": {{ pia_recovery_http_connect_timeout_sec | int }},
|
|
"http_total_timeout_sec": {{ pia_recovery_http_total_timeout_sec | int }},
|
|
"clock_skew_allowance_sec": 60,
|
|
"backup_keep": {{ pia_recovery_backup_keep | int }},
|
|
"lock_wait_sec": {{ pia_recovery_lock_wait_sec | int }},
|
|
"alert_bridge_url": {{ pia_alert_bridge_url | to_json }},
|
|
"alert_source": {{ pia_alert_source | to_json }},
|
|
"metrics_file": {{ (pia_gateway_state_dir + '/metrics.prom') | to_json }},
|
|
"status_file": {{ (pia_gateway_state_dir + '/status.json') | to_json }},
|
|
"killswitch_unit": "pia-killswitch.service"
|
|
}
|