Files
shater/shater-core/files/etc/sysctl.d/99-shater.conf
T
omarandClaude Opus 4.8 65883e20d9 feat(core): fail-safe hardening — live-flag, watchdog, procd fixes
Close the "rules live, engine dead" LAN-blackout class and make an admin
`stop` durable:
- live-flag /var/run/shater.active gates hotplug/cron reconcile, so `stop`
  sticks — a WAN flap can no longer resurrect interception behind a stopped
  engine.
- procd respawn retry=0 (never abandon the engine while rules stand) + guard
  that /usr/bin/xray is executable before installing the data plane.
- shater-cron watchdog: engine dead N ticks with interception live escalates
  per kill_switch (open -> auto-stop/fail-open, closed -> crit log).
- fix procd cron detach: `command "$INIT_SCRIPT" loop` (rc.common dispatch)
  instead of `/bin/sh $INIT_SCRIPT loop`, which detached the loop from procd
  (running:false + respawn churn) — the auto-updater/watchdog ran unsupervised.
- run.json regenerated at start after sysupgrade; cron stamps only on success
  with backoff, and waits for a default route before boot-time fetches.
- sysctl route_localnet/accept_local scoped to lo (was all — WAN anti-spoof
  weakening); applied at install time so no reboot is needed.
- fix stale example filenames; bump shater-core to r19.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LLthkP2S8WAfxu7fcYbPfE
2026-07-13 03:37:26 +03:00

32 lines
1.4 KiB
Plaintext

# /etc/sysctl.d/99-shater.conf
# Kernel knobs required by the TPROXY + policy-routing data plane.
# Applied at boot by procd's sysctl service; 30_shater-core also applies it
# once at install time so a fresh install works without a reboot.
# Route between LAN and WAN.
net.ipv4.ip_forward=1
# rp_filter MUST be loose/off: strict reverse-path filtering silently DROPS the
# tproxied packets (LAN source arriving via the `local ... dev lo` trick).
# Classic "rules match but nothing works".
net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.default.rp_filter=0
# Allow routing to 127/8 so `ip route add local 0.0.0.0/0 dev lo table <N>`
# delivers foreign-destination packets to the transparent socket. Scoped to
# `lo` only — that is the only path the tproxy local-delivery trick uses.
# Setting it on `all` would make WAN-originated packets destined to 127/8
# routable (a real anti-spoofing weakening we do not need).
net.ipv4.conf.lo.route_localnet=1
# Accept packets with a local source address arriving on the loopback path.
# Same scoping rationale: needed on `lo` for the looped tproxy packets, and
# on `all` it would accept local-source spoofs from any interface incl. WAN.
net.ipv4.conf.lo.accept_local=1
# Keep the source-address validity check happy for marked/looped packets.
net.ipv4.conf.all.src_valid_mark=1
# IPv6 forwarding (globals.ipv6 defaults on; mirror the data plane for v6).
net.ipv6.conf.all.forwarding=1