feat: tests, demo, JSON output, VPN kill-switch, more issue responses

- tests/: bats test suite for 8 modules (suppress, heal, firewall, detect,
  validate, colors, dscl, backup)
- demo: simulated full bypass flow for showcasing (no real changes)
- --json flag for report and audit commands (machine-readable output)
- vpn-kill: pf-based kill-switch that blocks MDM outside VPN tunnel
- vpn-kill-remove / vpn-kill-status: manage the kill-switch
- Responded to 5 more bypass-mdm issues (#135, #141, #150, #151, #154)
- CI now includes all new lib files in ShellCheck
- Bump 1.4.0 -> 1.5.0
This commit is contained in:
2026-06-20 13:07:03 -03:00
parent b25ce7f00c
commit 25fac5f43f
16 changed files with 1001 additions and 10 deletions
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env bats
# Tests for firewall.sh - run with: bats tests/test_firewall.bats
setup() {
load '../lib/colors.sh'
load '../lib/firewall.sh'
TEST_DIR=$(mktemp -d)
mkdir -p "$TEST_DIR/etc/pf.anchors/com.unleash"
}
teardown() {
rm -rf "$TEST_DIR"
}
@test "install_pf_mdm_block creates anchor file" {
FIREWALL_ANCHOR_DIR="/etc/pf.anchors"
install_pf_mdm_block "$TEST_DIR" 2>/dev/null || true
[ -f "$TEST_DIR/etc/pf.anchors/com.unleash/mdm" ]
}
@test "install_pf_mdm_block contains Apple IP ranges" {
install_pf_mdm_block "$TEST_DIR" 2>/dev/null || true
run grep -c "17.0.0.0/8" "$TEST_DIR/etc/pf.anchors/com.unleash/mdm"
[ "$output" -gt 0 ]
}
@test "install_pf_mdm_block updates pf.conf" {
install_pf_mdm_block "$TEST_DIR" 2>/dev/null || true
run grep -c "com.unleash" "$TEST_DIR/etc/pf.conf"
[ "$output" -gt 0 ]
}
@test "remove_pf_mdm_block removes anchor and pf.conf entries" {
install_pf_mdm_block "$TEST_DIR" 2>/dev/null || true
remove_pf_mdm_block "$TEST_DIR" 2>/dev/null || true
[ ! -f "$TEST_DIR/etc/pf.anchors/com.unleash/mdm" ]
run grep -c "com.unleash" "$TEST_DIR/etc/pf.conf" 2>/dev/null || echo "0"
[ "$output" = "0" ]
}