tests: deterministic runner (per-gate VM reset), hardened unload path
This commit is contained in:
1 parent
a0941b77fe
commit
2690d6145c
12 files changed
+138
-60
No files matched your search
@@ -1,9 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
# M2 gate 1: default policy pass + stateful transit + state visibility
|
||||
# M2 gate 1: stateful transit + state visibility
|
||||
set -uo pipefail; cd "$(dirname "$0")"; . ./lib.sh
|
||||
pf0 'rmmod pf 2>/dev/null; insmod /tmp/pf.ko; /opt/pf/pfctl -e; /opt/pf/pfctl -f /dev/null; echo READY' | grep -q READY || { bad load; finish; }
|
||||
pf0 'echo "pass in quick proto icmp keep state
|
||||
pass out quick proto icmp keep state" | /opt/pf/pfctl -f -' || bad rules
|
||||
pfensure
|
||||
pf0 '/opt/pf/pfctl -e; /opt/pf/pfctl -f /dev/null; echo READY' | grep -q READY || { bad load; finish; }
|
||||
cat > /tmp/g1.conf <<'C'
|
||||
pass in quick proto icmp keep state
|
||||
pass out quick proto icmp keep state
|
||||
C
|
||||
pfload /tmp/g1.conf || { bad rules; finish; }
|
||||
cli "ping -c 3 -W 2 $SRV_IP >/dev/null 2>&1" && ok "transit ping" || bad "transit ping"
|
||||
N=$(pf0 '/opt/pf/pfctl -s states | grep -c icmp'); [ "${N:-0}" -ge 1 ] && ok "icmp state present ($N)" || bad "no state"
|
||||
N=$(pf0 '/opt/pf/pfctl -s states | grep -c "icmp"'); [ "${N:-0}" -ge 1 ] && ok "icmp state ($N)" || bad "no state"
|
||||
pf0 '/opt/pf/pfctl -d' >/dev/null; finish
|
||||
Reference in new issue
Block a user