mirror of
https://github.com/RuoJi6/ARTEX.git
synced 2026-12-02 20:01:51 +08:00
- Add standalone edition (`Dockerfile.standalone`, `docker-compose.standalone.yml`) alongside sandbox edition and publish both in `.github/workflows/release.yml`. - Implement `scripts/deploy-lib.sh`, `install.sh`, `update.sh`, and `scripts/artex-sandbox-firewall.sh --cleanup` with edition detection, legacy standalone -> sandbox migration (symlink-safe workspace permissions), automatic snapshots with pinned `artex-rollback/*` images + PG dump, auto/manual cross-edition rollback, and post-rollback upstream unpinning. - Update `ensureWritableDir` in `internal/sandbox/manager.go` to safely migrate nested root-owned workspace files without following symlinks. - Expose `deploy_edition` in `/api/update/check` and update `UpdateCard` UI/i18n warnings for sandbox vs standalone in-app update/rollback. - Reconcile `artex-gateway` TUN policy routing (`priority 218`, `raw PREROUTING`, `nat POSTROUTING`, `DOCKER-USER`) every 15s to self-heal after host network rule flushes or bridge changes. - Add unit and shell tests (`scripts/deploy_test.sh`, `cmd/artex-gateway/tun_linux_test.go`, `internal/sandbox/sandbox_test.go`, `server/update_test.go`) and update `README.md` / `.env.example`.
32 lines
946 B
Go
32 lines
946 B
Go
//go:build linux
|
|
|
|
package main
|
|
|
|
import "testing"
|
|
|
|
func TestRawPreroutingTopAcceptsTun(t *testing.T) {
|
|
topOK := `-P PREROUTING ACCEPT
|
|
-A PREROUTING -d 172.30.0.0/16 -i artex-tun0 -j ACCEPT
|
|
-A PREROUTING -d 172.30.0.2/32 ! -i br-25277657432c -j DROP
|
|
`
|
|
if !rawPreroutingTopAcceptsTun(topOK, "artex-tun0", "172.30.0.0/16") {
|
|
t.Fatal("expected top ACCEPT rule to be recognized")
|
|
}
|
|
|
|
dropAbove := `# Warning: iptables-legacy tables present
|
|
-P PREROUTING ACCEPT
|
|
-A PREROUTING -d 172.30.0.3/32 ! -i br-25277657432c -j DROP
|
|
-A PREROUTING -d 172.30.0.0/16 -i artex-tun0 -j ACCEPT
|
|
`
|
|
if rawPreroutingTopAcceptsTun(dropAbove, "artex-tun0", "172.30.0.0/16") {
|
|
t.Fatal("expected DROP rule above ACCEPT to fail top check")
|
|
}
|
|
|
|
missing := `-P PREROUTING ACCEPT
|
|
-A PREROUTING -d 172.30.0.2/32 ! -i br-25277657432c -j DROP
|
|
`
|
|
if rawPreroutingTopAcceptsTun(missing, "artex-tun0", "172.30.0.0/16") {
|
|
t.Fatal("expected missing rule to fail top check")
|
|
}
|
|
}
|