feat: history, dry-run, Discord webhook, bump 1.3.0

- history: read event logs from monitor/heal
- test/dry-run: simulate bypass, suppress, harden without side effects
- --dry-run: global flag for any command
- monitor --webhook <url>: Discord notification on MDM detection
- Update CHANGELOG, CI, standalone for all new features
- Bump 1.2.0 -> 1.3.0
This commit is contained in:
2026-06-20 12:19:55 -03:00
parent f6fa98c6c9
commit 208fe44dce
8 changed files with 250 additions and 8 deletions
+11
View File
@@ -80,6 +80,7 @@ monitor_mdm() {
local logfile="/var/log/unleash-monitor.log"
local pidfile="/tmp/unleash-monitor.pid"
local webhook="${DISCORD_WEBHOOK:-}"
if [ -f "$pidfile" ] && kill -0 "$(cat "$pidfile")" 2>/dev/null; then
echo -e "${YEL}Monitor already running (PID $(cat "$pidfile"))${NC}"
@@ -135,6 +136,11 @@ monitor_mdm() {
if command -v osascript &>/dev/null; then
osascript -e "display notification \"$reason\" with title \"Unleash MDM Alert\" subtitle \"MDM enrollment detected\"" 2>/dev/null || true
fi
if [ -n "$webhook" ]; then
local payload
payload=$(printf '{"content":"🚨 **Unleash Alert** — MDM enrollment detected: %s","username":"Unleash Monitor"}' "$reason")
curl -s -H "Content-Type: application/json" -d "$payload" "$webhook" 2>/dev/null || warn "Webhook failed"
fi
heal_suppress ""
fi
fi
@@ -150,6 +156,11 @@ monitor_mdm() {
if command -v osascript &>/dev/null; then
osascript -e "display dialog \"MDM keeps coming back after 12 attempts. Something is persistently re-enrolling.\" with title \"Unleash\" buttons {\"OK\"} default button \"OK\"" 2>/dev/null || true
fi
if [ -n "$webhook" ]; then
curl -s -H "Content-Type: application/json" \
-d '{"content":"🚨 **Unleash CRITICAL** — 12 consecutive MDM detections. Persistent re-enrollment detected.","username":"Unleash Monitor"}' \
"$webhook" 2>/dev/null || true
fi
consecutive_failures=0
fi