rename project to runaway
This commit is contained in:
+19
-19
@@ -3,13 +3,13 @@ install_monitor_launchdaemon() {
|
||||
local root=""
|
||||
[ -n "$data_mount" ] && root="$data_mount"
|
||||
|
||||
local unleash_src
|
||||
unleash_src=$(_launchd_script_path)
|
||||
local runaway_src
|
||||
runaway_src=$(_launchd_script_path)
|
||||
|
||||
step "Installing monitor LaunchDaemon..."
|
||||
|
||||
local plist_dir="${root}/Library/LaunchDaemons"
|
||||
local plist_path="${plist_dir}/com.unleash.monitor.plist"
|
||||
local plist_path="${plist_dir}/com.runaway.monitor.plist"
|
||||
mkdir -p "$plist_dir"
|
||||
|
||||
cat > "$plist_path" <<- PLIST
|
||||
@@ -18,11 +18,11 @@ install_monitor_launchdaemon() {
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>com.unleash.monitor</string>
|
||||
<string>com.runaway.monitor</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>/bin/bash</string>
|
||||
<string>${unleash_src}</string>
|
||||
<string>${runaway_src}</string>
|
||||
<string>monitor</string>
|
||||
</array>
|
||||
<key>RunAtLoad</key>
|
||||
@@ -32,9 +32,9 @@ install_monitor_launchdaemon() {
|
||||
<key>Nice</key>
|
||||
<integer>1</integer>
|
||||
<key>StandardOutPath</key>
|
||||
<string>/var/log/unleash-monitor.log</string>
|
||||
<string>/var/log/runaway-monitor.log</string>
|
||||
<key>StandardErrorPath</key>
|
||||
<string>/var/log/unleash-monitor.err</string>
|
||||
<string>/var/log/runaway-monitor.err</string>
|
||||
</dict>
|
||||
</plist>
|
||||
PLIST
|
||||
@@ -55,7 +55,7 @@ uninstall_monitor_launchdaemon() {
|
||||
local data_mount="$1"
|
||||
local root=""
|
||||
[ -n "$data_mount" ] && root="$data_mount"
|
||||
local plist_path="${root}/Library/LaunchDaemons/com.unleash.monitor.plist"
|
||||
local plist_path="${root}/Library/LaunchDaemons/com.runaway.monitor.plist"
|
||||
|
||||
if [ -f "$plist_path" ]; then
|
||||
step "Removing monitor LaunchDaemon..."
|
||||
@@ -73,16 +73,16 @@ monitor_mdm() {
|
||||
header "MDM Monitor (continuous)"
|
||||
|
||||
if ! is_root; then
|
||||
error_exit "Monitor requires sudo: sudo ./unleash monitor"
|
||||
error_exit "Monitor requires sudo: sudo ./runaway monitor"
|
||||
fi
|
||||
|
||||
local logfile="/var/log/unleash-monitor.log"
|
||||
local pidfile="/tmp/unleash-monitor.pid"
|
||||
local logfile="/var/log/runaway-monitor.log"
|
||||
local pidfile="/tmp/runaway-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}"
|
||||
echo -e "${YEL}Run 'sudo ./unleash monitor-stop' to stop it${NC}"
|
||||
echo -e "${YEL}Run 'sudo ./runaway monitor-stop' to stop it${NC}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
@@ -132,11 +132,11 @@ monitor_mdm() {
|
||||
if [ "$state" = "dirty" ] && [ $((now - last_notification)) -gt 3600 ]; then
|
||||
last_notification=$now
|
||||
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
|
||||
osascript -e "display notification \"$reason\" with title \"Runaway 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")
|
||||
payload=$(printf '{"content":"🚨 **Runaway Alert** — MDM enrollment detected: %s","username":"Runaway Monitor"}' "$reason")
|
||||
curl -s -H "Content-Type: application/json" -d "$payload" "$webhook" 2>/dev/null || warn "Webhook failed"
|
||||
fi
|
||||
heal_suppress ""
|
||||
@@ -152,11 +152,11 @@ monitor_mdm() {
|
||||
if [ "$consecutive_failures" -ge 12 ]; then
|
||||
echo "$(date) CRITICAL: 12 consecutive dirty checks" >> "$logfile"
|
||||
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
|
||||
osascript -e "display dialog \"MDM keeps coming back after 12 attempts. Something is persistently re-enrolling.\" with title \"Runaway\" 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"}' \
|
||||
-d '{"content":"🚨 **Runaway CRITICAL** — 12 consecutive MDM detections. Persistent re-enrollment detected.","username":"Runaway Monitor"}' \
|
||||
"$webhook" 2>/dev/null || true
|
||||
fi
|
||||
consecutive_failures=0
|
||||
@@ -168,7 +168,7 @@ monitor_mdm() {
|
||||
}
|
||||
|
||||
stop_monitor() {
|
||||
local pidfile="${1:-/tmp/unleash-monitor.pid}"
|
||||
local pidfile="${1:-/tmp/runaway-monitor.pid}"
|
||||
if [ -f "$pidfile" ]; then
|
||||
local pid
|
||||
pid=$(cat "$pidfile")
|
||||
@@ -185,10 +185,10 @@ stop_monitor() {
|
||||
}
|
||||
|
||||
monitor_status() {
|
||||
local pidfile="${1:-/tmp/unleash-monitor.pid}"
|
||||
local pidfile="${1:-/tmp/runaway-monitor.pid}"
|
||||
if [ -f "$pidfile" ] && kill -0 "$(cat "$pidfile")" 2>/dev/null; then
|
||||
echo -e "${GRN}Monitor running (PID $(cat "$pidfile"))${NC}"
|
||||
tail -5 /var/log/unleash-monitor.log 2>/dev/null || echo " (no log entries yet)"
|
||||
tail -5 /var/log/runaway-monitor.log 2>/dev/null || echo " (no log entries yet)"
|
||||
else
|
||||
echo -e "${YEL}Monitor not running${NC}"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user