Files
ayurishchevandClaude Sonnet 5.5 ad6995bb63 Docs restructure, code review, gatherer reliability, JWT key fail-closed
Documentation
- Three levels: DOCS/General (overview, configuration), DOCS/Deployment
  (choose a method, first steps), details per method in Containers/ and
  System_Services/; new root README and DOCS/README map.
- Remove superseded pages (Deployment.md, Deployment_Docker/Native.md, Index.md);
  split the two scenario guides by section.
- Isolate the Timeweb/Hysteria2 records in DEPLOYMENTS/timeweb-hysteria2/
  (not linked from DOCS, listed in .graphifyignore).
- Add DOCS/code_review/ with a time-stamped analysis of the code base.

Gatherer (BUG-02, BUG-03)
- Session key (CN, address, connected_since_ts), baseline from the
  active_sessions snapshot, grace period for sessions missing from the status.
- Status file integrity (TITLE/TIME/END) and freshness; a torn read skips the tick.
- Cache applied after commit; main loop survives exceptions, backs off, and
  stops cleanly on SIGTERM/SIGINT; new client rows start with the first
  frame's totals; five tests.

JWT signing key (SEC-01)
- No built-in default: Core and Profiler refuse to start with a missing,
  placeholder or short (< 32) key; shipped config.ini has an empty value.
- Same rule in install.sh, update.sh (issues a new key when missing or weak),
  docker lib/entrypoint; five tests, conftest.py for the test key.

Each change has a plan and a summary under DOCS/Changes/.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-05 20:30:45 +03:00

29 lines
2.5 KiB
Markdown

# nftables script for system-service installs: summary (2026-10-05)
Plan: [2026-10-05_NFT_Firewall_PLAN.md](2026-10-05_NFT_Firewall_PLAN.md). Guide: [Firewall, NAT and forwarding](../Deployment/System_Services/Firewall.md).
## Done
| Item | Result |
|---|---|
| `deploy/native/firewall.sh` | Commands `apply` (default), `status`, `remove`; options `--dry-run`, `--vpn-net`, `--vpn-if`, `--out-if`, `--ttl`/`--no-ttl`, `--mss`/`--no-mss`, `--no-persist`, `--yes`, `--force` |
| Interface detection | VPN network: `--vpn-net` -> `server` line of the OpenVPN config -> address of the VPN interface. VPN interface: `--vpn-if` -> interface with an address in the VPN network -> `dev` line -> `tun*`. Other networks: every interface except `lo` and the VPN one (listed with MTU, state, addresses) |
| Rules (table `ip ovpmon`, one atomic transaction) | masquerade, `ip ttl set N` at egress (default 64), TCP MSS clamp of SYN/SYN-ACK in both directions (`rt mtu` or a fixed value); counters on every rule |
| Safety | other tables and the distribution's nftables service untouched; `nft -c` before applying; stops when the VPN network overlaps with an uplink network; warns about disabled forwarding, duplicate iptables MASQUERADE, strict `rp_filter` with policy routing, other `policy drop` chains (PMTUD/ICMP) |
| Persistence | `/etc/ovpmon/nftables.nft` (marker line, a foreign file is never overwritten) loaded by the service `ovpmon-nft`: `DOCS/General/systemd/ovpmon-nft.service`, `DOCS/General/openrc/ovpmon-nft`; applied parameters recorded as `FIREWALL_*` in `deploy.state` |
| `nftables` package | installed on request only; not added to the install package list |
| Documentation | Scenario 2 guide (new section, layout table), README (quick start, change table), hints of `install.sh`, header note of `lib.sh` |
## Differences from the plan
- Interfaces are read with `ip -o` (plain text) instead of `ip -j`: it works with the BusyBox `ip` of Alpine and needs no JSON parsing.
- The automated test (`test-firewall.sh`) was **not** written: the owner verifies the script by hand on a live system.
## Verification
Checked by the owner by hand on a live **Alpine** host (OpenRC): the script worked as intended. **Not verified:** Debian/Ubuntu (systemd unit `ovpmon-nft.service`) and the Hysteria2 host (specific environment, out of scope of this change).
## Out of scope
Filtering policy (INPUT/FORWARD, ports, anti-leak), IPv6, replacing the distribution's `nftables.service`, migration of the manual iptables rules of the Hysteria2 chain; options are not remembered between runs.