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
83 lines
2.9 KiB
Makefile
83 lines
2.9 KiB
Makefile
#
|
|
# shater-core — data-plane glue for the Shater transparent-proxy stack.
|
|
#
|
|
# Ships the "железно" (rock-solid) static layer that the Go control-plane
|
|
# (xrayctl) and the LuCI app sit on: the procd init that supervises the stock
|
|
# xray binary against xrayctl's generated /etc/xray/run.json, the hotplug hook
|
|
# that re-persists policy routing, the sysctl knobs TPROXY needs, a minimal
|
|
# inert UCI default, and one-time rt_tables seeding.
|
|
#
|
|
# Pure scripts + config => PKGARCH:=all. Nothing is compiled here.
|
|
#
|
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
PKG_NAME:=shater-core
|
|
PKG_VERSION:=0.1.0
|
|
PKG_RELEASE:=19
|
|
|
|
PKG_MAINTAINER:=Shater <maqrota@icloud.com>
|
|
PKG_LICENSE:=GPL-2.0-or-later
|
|
|
|
include $(INCLUDE_DIR)/package.mk
|
|
|
|
define Package/shater-core
|
|
SECTION:=net
|
|
CATEGORY:=Network
|
|
TITLE:=Shater transparent-proxy data-plane glue
|
|
URL:=https://github.com/shater
|
|
# xrayctl : control-plane (gen/test/apply/reconcile) invoked by our init/hotplug
|
|
# xray-core: the /usr/bin/xray engine our init supervises
|
|
# dnsmasq-full: nftset= support for domain-based routing sets
|
|
# kmod-nft-tproxy + kmod-nft-socket: kernel TPROXY (xrayctl emits the rules)
|
|
# ip-full : `ip rule`/`ip route`/rt_tables for policy routing
|
|
DEPENDS:=+xrayctl +xray-core +dnsmasq-full +kmod-nft-tproxy +kmod-nft-socket +ip-full
|
|
PKGARCH:=all
|
|
endef
|
|
|
|
define Package/shater-core/description
|
|
Static data-plane glue for the Shater xray-based transparent proxy: procd
|
|
init (supervises xray on xrayctl-generated /etc/xray/run.json and reconciles
|
|
policy routing / our nft table `inet shater`), an ifup/ifdown hotplug hook
|
|
that re-persists ip rules & routes, TPROXY sysctl settings, a minimal inert
|
|
UCI default (globals disabled until configured), and idempotent first-boot
|
|
setup. Designed to never break connectivity: fully inert until explicitly
|
|
enabled and a generated runtime config exists.
|
|
endef
|
|
|
|
# /etc/config/shater is user-editable desired state -> preserve on upgrade.
|
|
define Package/shater-core/conffiles
|
|
/etc/config/shater
|
|
endef
|
|
|
|
# Nothing to fetch or build.
|
|
define Build/Prepare
|
|
mkdir -p $(PKG_BUILD_DIR)
|
|
endef
|
|
|
|
define Build/Compile
|
|
endef
|
|
|
|
define Package/shater-core/install
|
|
$(INSTALL_DIR) $(1)/etc/init.d
|
|
$(INSTALL_BIN) ./files/etc/init.d/shater $(1)/etc/init.d/shater
|
|
$(INSTALL_BIN) ./files/etc/init.d/shater-cron $(1)/etc/init.d/shater-cron
|
|
|
|
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
|
$(INSTALL_BIN) ./files/etc/hotplug.d/iface/99-shater $(1)/etc/hotplug.d/iface/99-shater
|
|
|
|
$(INSTALL_DIR) $(1)/etc/sysctl.d
|
|
$(INSTALL_DATA) ./files/etc/sysctl.d/99-shater.conf $(1)/etc/sysctl.d/99-shater.conf
|
|
|
|
$(INSTALL_DIR) $(1)/etc/config
|
|
$(INSTALL_CONF) ./files/etc/config/shater $(1)/etc/config/shater
|
|
|
|
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
|
$(INSTALL_BIN) ./files/etc/uci-defaults/30_shater-core $(1)/etc/uci-defaults/30_shater-core
|
|
|
|
$(INSTALL_DIR) $(1)/usr/share/shater
|
|
$(INSTALL_DATA) ./files/usr/share/shater/README $(1)/usr/share/shater/README
|
|
endef
|
|
|
|
$(eval $(call BuildPackage,shater-core))
|