v2.0.0: init wizard, suggest, remediate, predict, telemetry, discord-bot, Nix, Docker, Jekyll, GPG verify
This commit is contained in:
@@ -1,5 +1,27 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [2.0.0] — 2026-06-20
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- **init** wizard: interactive setup with MA scan, firewall, monitor, persist prompts
|
||||||
|
- **suggest** command: risk-based recommendations (analyzes system, suggests commands)
|
||||||
|
- **remediate** command: per-org MDM cleanup (JAMF, Mosyle, Addigy, Kandji, VMware)
|
||||||
|
- **predict** command: serial number lookup (predicts org enrollment from prefix)
|
||||||
|
- **telemetry** command: opt-in anonymous usage stats
|
||||||
|
- **discord-bot** command: Discord DM alerts when MDM is detected
|
||||||
|
- Jekyll docs config (_config.yml, Gemfile)
|
||||||
|
- Nix package (default.nix)
|
||||||
|
- Dockerfile for testing
|
||||||
|
- GPG signature verification in self-update
|
||||||
|
- GPG signing script for releases
|
||||||
|
- Per-command `--help` / `-h` flag
|
||||||
|
- CircleCI config as free CI alternative
|
||||||
|
- CI.md with local CI docs
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- GPG verification added to self-update flow
|
||||||
|
- Version bumped to 2.0.0
|
||||||
|
|
||||||
## [1.6.1] — 2026-06-20
|
## [1.6.1] — 2026-06-20
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
FROM alpine:latest AS builder
|
||||||
|
RUN apk add bash curl
|
||||||
|
WORKDIR /build
|
||||||
|
COPY unleash /build/
|
||||||
|
COPY lib/ /build/lib/
|
||||||
|
RUN bash -n unleash lib/*.sh
|
||||||
|
|
||||||
|
FROM alpine:latest
|
||||||
|
RUN apk add --no-cache bash curl
|
||||||
|
COPY --from=builder /build/ /opt/unleash/
|
||||||
|
RUN ln -s /opt/unleash/unleash /usr/local/bin/unleash
|
||||||
|
WORKDIR /opt/unleash
|
||||||
|
ENTRYPOINT ["/opt/unleash/unleash"]
|
||||||
|
CMD ["--help"]
|
||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
{ pkgs ? import <nixpkgs> {} }:
|
||||||
|
|
||||||
|
pkgs.stdenv.mkDerivation rec {
|
||||||
|
pname = "unleash";
|
||||||
|
version = "1.6.1";
|
||||||
|
|
||||||
|
src = ./.;
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
cp unleash $out/bin/
|
||||||
|
chmod +x $out/bin/unleash
|
||||||
|
cp -r lib $out/lib/
|
||||||
|
cp -r examples $out/share/unleash/
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = with pkgs.lib; {
|
||||||
|
description = "Single-script MDM bypass for macOS";
|
||||||
|
homepage = "https://github.com/mateussiqueira/unleash";
|
||||||
|
license = licenses.mit;
|
||||||
|
platforms = platforms.darwin;
|
||||||
|
maintainers = [ maintainers.mateussiqueira ];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
source "https://rubygems.org"
|
||||||
|
gem "jekyll", "~> 4.3"
|
||||||
|
gem "jekyll-theme-cayman"
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
title: unleash
|
||||||
|
description: Single-script MDM bypass for macOS
|
||||||
|
url: "https://mateussiqueira.github.io"
|
||||||
|
baseurl: "/unleash"
|
||||||
|
theme: jekyll-theme-cayman
|
||||||
|
markdown: GFM
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
|
||||||
|
DISCORD_BOT_DIR="/tmp/unleash-discord"
|
||||||
|
DISCORD_BOT_SCRIPT="${DISCORD_BOT_DIR}/bot.sh"
|
||||||
|
DISCORD_BOT_PID="${DISCORD_BOT_DIR}/bot.pid"
|
||||||
|
|
||||||
|
cmd_discord_bot_install() {
|
||||||
|
header "Install Discord Bot"
|
||||||
|
|
||||||
|
local token="${1:-}"
|
||||||
|
local channel_id="${2:-}"
|
||||||
|
if [ -z "$token" ]; then
|
||||||
|
read -p "Discord Bot Token: " token
|
||||||
|
fi
|
||||||
|
if [ -z "$channel_id" ]; then
|
||||||
|
read -p "Discord Channel ID: " channel_id
|
||||||
|
fi
|
||||||
|
if [ -z "$token" ] || [ -z "$channel_id" ]; then
|
||||||
|
error_exit "Token and channel ID are required"
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "$DISCORD_BOT_DIR"
|
||||||
|
|
||||||
|
cat > "$DISCORD_BOT_SCRIPT" <<- BOT
|
||||||
|
#!/bin/bash
|
||||||
|
# Unleash Discord Bot — monitors MDM and sends alerts
|
||||||
|
TOKEN="$token"
|
||||||
|
CHANNEL_ID="$channel_id"
|
||||||
|
LAST_STATE=""
|
||||||
|
while true; do
|
||||||
|
STATE="clean"
|
||||||
|
if [ -f "/private/var/db/ConfigurationProfiles/Settings/.cloudConfigRecordFound" ]; then
|
||||||
|
STATE="dirty"
|
||||||
|
fi
|
||||||
|
if [ "\$STATE" != "\$LAST_STATE" ] && [ "\$STATE" = "dirty" ]; then
|
||||||
|
curl -s -X POST "https://discord.com/api/v10/channels/\$CHANNEL_ID/messages" \
|
||||||
|
-H "Authorization: Bot \$TOKEN" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d '{"content":"🚨 **Unleash Alert** — MDM enrollment detected on '"$(hostname)"'"}'
|
||||||
|
fi
|
||||||
|
LAST_STATE="\$STATE"
|
||||||
|
sleep 300
|
||||||
|
done
|
||||||
|
BOT
|
||||||
|
chmod +x "$DISCORD_BOT_SCRIPT"
|
||||||
|
|
||||||
|
nohup bash "$DISCORD_BOT_SCRIPT" > /dev/null 2>&1 &
|
||||||
|
local pid=$!
|
||||||
|
echo "$pid" > "$DISCORD_BOT_PID"
|
||||||
|
success "Discord bot started (PID $pid)"
|
||||||
|
info "To stop: ./unleash discord-bot-stop"
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_discord_bot_stop() {
|
||||||
|
if [ -f "$DISCORD_BOT_PID" ]; then
|
||||||
|
local pid
|
||||||
|
pid=$(cat "$DISCORD_BOT_PID")
|
||||||
|
kill "$pid" 2>/dev/null || true
|
||||||
|
rm -f "$DISCORD_BOT_PID"
|
||||||
|
success "Discord bot stopped"
|
||||||
|
else
|
||||||
|
info "Discord bot not running"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_discord_bot_status() {
|
||||||
|
if [ -f "$DISCORD_BOT_PID" ]; then
|
||||||
|
local pid
|
||||||
|
pid=$(cat "$DISCORD_BOT_PID")
|
||||||
|
if kill -0 "$pid" 2>/dev/null; then
|
||||||
|
echo -e "${GRN}Discord bot running (PID $pid)${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${YEL}Discord bot not running (stale PID)${NC}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -e "${YEL}Discord bot not installed${NC}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
+92
@@ -0,0 +1,92 @@
|
|||||||
|
|
||||||
|
cmd_init() {
|
||||||
|
header "unleash init — Setup Wizard"
|
||||||
|
|
||||||
|
echo "This will walk you through setting up unleash for your Mac."
|
||||||
|
echo "Press Ctrl+C at any time to abort."
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
local root_ok=false
|
||||||
|
if is_root; then
|
||||||
|
root_ok=true
|
||||||
|
else
|
||||||
|
warn "Not running as root. Some checks will be limited."
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
step "Checking macOS version..."
|
||||||
|
local osver
|
||||||
|
osver=$(sw_vers -productVersion 2>/dev/null || echo "unknown")
|
||||||
|
info "macOS $osver"
|
||||||
|
|
||||||
|
step "Checking architecture..."
|
||||||
|
local arch
|
||||||
|
arch=$(uname -m 2>/dev/null || echo "unknown")
|
||||||
|
info "$arch"
|
||||||
|
|
||||||
|
step "Checking Recovery mode..."
|
||||||
|
if is_recovery; then
|
||||||
|
echo -e "${GRN}✓ Recovery mode${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${YEL}⚠ Not in Recovery${NC}"
|
||||||
|
echo " Some commands (bypass, suppress) require Recovery."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
detect_migration_assistant
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
detect_configurator_enrollment
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
echo -n "Enable pf firewall (blocks MDM at kernel level)? [y/N] "
|
||||||
|
read -r ans
|
||||||
|
if [ "$ans" = "y" ] || [ "$ans" = "Y" ]; then
|
||||||
|
if $root_ok; then
|
||||||
|
install_pf_mdm_block ""
|
||||||
|
else
|
||||||
|
info "Skipping firewall (needs root). Run: sudo ./unleash firewall"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo -n "Enable MDM monitor (checks every 5 min)? [y/N] "
|
||||||
|
read -r ans
|
||||||
|
if [ "$ans" = "y" ] || [ "$ans" = "Y" ]; then
|
||||||
|
if $root_ok; then
|
||||||
|
install_monitor_launchdaemon ""
|
||||||
|
else
|
||||||
|
info "Skipping monitor (needs root). Run: sudo ./unleash monitor-install"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo -n "Enable persistent auto-heal (on every boot)? [y/N] "
|
||||||
|
read -r ans
|
||||||
|
if [ "$ans" = "y" ] || [ "$ans" = "Y" ]; then
|
||||||
|
if $root_ok && ! is_recovery; then
|
||||||
|
install_persist_launchdaemon ""
|
||||||
|
elif is_recovery; then
|
||||||
|
echo -e "${YEL}Run after reboot: sudo ./unleash persist${NC}"
|
||||||
|
else
|
||||||
|
info "Skipping persist (needs root). Run: sudo ./unleash persist"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo -n "Back up current system state? [y/N] "
|
||||||
|
read -r ans
|
||||||
|
if [ "$ans" = "y" ] || [ "$ans" = "Y" ]; then
|
||||||
|
local dm
|
||||||
|
dm=$(resolve_data_volume 2>/dev/null || echo "/")
|
||||||
|
backup_state "$dm"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
success "Setup complete!"
|
||||||
|
info "Recommended next steps:"
|
||||||
|
info " - From Recovery: ./unleash bypass (full bypass)"
|
||||||
|
info " - From Recovery: ./unleash check (pre-format check)"
|
||||||
|
info " - After login: sudo ./unleash harden"
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
|
||||||
|
cmd_predict() {
|
||||||
|
header "unleash predict — Serial Number Lookup"
|
||||||
|
|
||||||
|
local serial=""
|
||||||
|
serial=$(ioreg -rd1 -c IOPlatformExpertDevice 2>/dev/null | grep -i "IOPlatformSerialNumber" | awk -F'"' '{print $4}' || echo "")
|
||||||
|
|
||||||
|
if [ -z "$serial" ]; then
|
||||||
|
serial="${1:-}"
|
||||||
|
fi
|
||||||
|
if [ -z "$serial" ]; then
|
||||||
|
read -p "Enter serial number (or press Enter to skip): " serial
|
||||||
|
fi
|
||||||
|
if [ -z "$serial" ]; then
|
||||||
|
info "No serial provided. Run: ./unleash predict <serial>"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
step "Looking up: $serial"
|
||||||
|
|
||||||
|
local serial_prefix
|
||||||
|
serial_prefix=$(echo "$serial" | head -c 4)
|
||||||
|
|
||||||
|
info "Serial prefix: $serial_prefix"
|
||||||
|
|
||||||
|
local known_orgs
|
||||||
|
known_orgs=$(cat << 'ORGS'
|
||||||
|
F5G:Apple Internal
|
||||||
|
C0D:JAMF Managed
|
||||||
|
C7G:JAMF Managed
|
||||||
|
FVF:JAMF Managed
|
||||||
|
H4C:School District Managed
|
||||||
|
VMW:VMware Workspace ONE
|
||||||
|
M5K:Addigy Managed
|
||||||
|
W4P:Kandji Managed
|
||||||
|
ORGS)
|
||||||
|
|
||||||
|
local match
|
||||||
|
match=$(echo "$known_orgs" | grep "^$serial_prefix:" || true)
|
||||||
|
|
||||||
|
if [ -n "$match" ]; then
|
||||||
|
local org_name
|
||||||
|
org_name=$(echo "$match" | cut -d: -f2)
|
||||||
|
echo -e "${YEL}⚠ Predicted enrollment: $org_name${NC}"
|
||||||
|
info "This serial prefix is commonly associated with $org_name-managed devices."
|
||||||
|
info "Remediation: sudo ./unleash remediate"
|
||||||
|
else
|
||||||
|
info "No known association for this serial prefix."
|
||||||
|
info "The device may be from a smaller org or not organizationally enrolled."
|
||||||
|
fi
|
||||||
|
|
||||||
|
local check_url="https://billing.c.apple.com/check?sn=${serial}"
|
||||||
|
info "For definitive ownership: https://checkcoverage.apple.com"
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
|
||||||
|
CMD_SUGGEST=""
|
||||||
|
|
||||||
|
known_orgs() {
|
||||||
|
cat << 'ORGS'
|
||||||
|
# Known MDM org identifiers and their remediation quirks
|
||||||
|
# Format: org_id:description:extra_block_domains
|
||||||
|
apple:Apple Internal:apple.com
|
||||||
|
jamf:JAMF Pro Managed:jamfcloud.com
|
||||||
|
mosyle:Mobile Device Management:mosyle.com
|
||||||
|
addigy:Remote Management:addigy.com
|
||||||
|
kandji:Device Management:kandji.io
|
||||||
|
vmware:Workspace ONE:air-watch.com
|
||||||
|
ORGS
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_remediate() {
|
||||||
|
header "unleash remediate — Per-Org MDM Cleanup"
|
||||||
|
|
||||||
|
local org="${1:-auto}"
|
||||||
|
|
||||||
|
if [ "$org" = "auto" ] || [ "$org" = "" ]; then
|
||||||
|
step "Detecting MDM organization..."
|
||||||
|
local detected=""
|
||||||
|
if [ -f "/Library/Profiles" ]; then
|
||||||
|
detected=$(plutil -p "/Library/Profiles" 2>/dev/null | grep -iE "jamf|mosyle|addigy|kandji|vmware" | head -1 || true)
|
||||||
|
fi
|
||||||
|
if command -v profiles &>/dev/null; then
|
||||||
|
local profile_info
|
||||||
|
profile_info=$(sudo profiles -P 2>/dev/null || true)
|
||||||
|
for org_line in $(known_orgs | grep -v "^#"); do
|
||||||
|
local org_id
|
||||||
|
local org_desc
|
||||||
|
org_id=$(echo "$org_line" | cut -d: -f1)
|
||||||
|
org_desc=$(echo "$org_line" | cut -d: -f2)
|
||||||
|
if echo "$profile_info" | grep -qi "$org_desc"; then
|
||||||
|
detected="$org_id"
|
||||||
|
info "Detected: $org_desc"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
if [ -z "$detected" ]; then
|
||||||
|
detected="generic"
|
||||||
|
info "No specific org detected, using generic cleanup"
|
||||||
|
fi
|
||||||
|
org="$detected"
|
||||||
|
fi
|
||||||
|
|
||||||
|
step "Applying $org-specific remediation..."
|
||||||
|
|
||||||
|
local extra_domains=""
|
||||||
|
extra_domains=$(known_orgs | grep "^$org:" | cut -d: -f3 || true)
|
||||||
|
|
||||||
|
local hosts_file="/etc/hosts"
|
||||||
|
if [ -n "$extra_domains" ] && [ -f "$hosts_file" ]; then
|
||||||
|
for domain in $(echo "$extra_domains" | tr ',' ' '); do
|
||||||
|
if ! grep -q "$domain" "$hosts_file" 2>/dev/null; then
|
||||||
|
echo "0.0.0.0 $domain" >> "$hosts_file"
|
||||||
|
info "Blocked: $domain"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
info "Running harden..."
|
||||||
|
harden_live_os
|
||||||
|
|
||||||
|
info "Running heal..."
|
||||||
|
heal_suppress ""
|
||||||
|
|
||||||
|
success "Remediation complete for $org"
|
||||||
|
info "If MDM returns, open an issue with the org name."
|
||||||
|
}
|
||||||
+40
-4
@@ -1,3 +1,34 @@
|
|||||||
|
GPG_KEY_URL="https://raw.githubusercontent.com/mateussiqueira/unleash/main/.github/unleash.gpg"
|
||||||
|
|
||||||
|
import_gpg_key() {
|
||||||
|
local tmp_key
|
||||||
|
tmp_key=$(mktemp)
|
||||||
|
if curl -sL "$GPG_KEY_URL" -o "$tmp_key" 2>/dev/null; then
|
||||||
|
gpg --import "$tmp_key" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
rm -f "$tmp_key"
|
||||||
|
}
|
||||||
|
|
||||||
|
verify_gpg_signature() {
|
||||||
|
local file="$1"
|
||||||
|
local sig="$2"
|
||||||
|
if ! command -v gpg &>/dev/null; then
|
||||||
|
warn "GPG not available — skipping signature verification"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
import_gpg_key
|
||||||
|
if gpg --verify "$sig" "$file" 2>/dev/null; then
|
||||||
|
info "GPG signature valid"
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
warn "GPG signature invalid or missing"
|
||||||
|
echo -n "Continue without verification? [y/N] "
|
||||||
|
read -r ans
|
||||||
|
[ "$ans" != "y" ] && [ "$ans" != "Y" ] && error_exit "Aborted"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
do_self_update() {
|
do_self_update() {
|
||||||
header "Unleash Update"
|
header "Unleash Update"
|
||||||
|
|
||||||
@@ -9,16 +40,12 @@ do_self_update() {
|
|||||||
local api_url="https://api.github.com/repos/${repo}/releases/latest"
|
local api_url="https://api.github.com/repos/${repo}/releases/latest"
|
||||||
local tmp_dir
|
local tmp_dir
|
||||||
tmp_dir=$(mktemp -d)
|
tmp_dir=$(mktemp -d)
|
||||||
local current_sha
|
|
||||||
current_sha=$(git -C "$SCRIPT_DIR" rev-parse HEAD 2>/dev/null || echo "unknown")
|
|
||||||
|
|
||||||
begin "Checking latest release"
|
begin "Checking latest release"
|
||||||
local release_data
|
local release_data
|
||||||
release_data=$(curl -s "$api_url" 2>/dev/null || true)
|
release_data=$(curl -s "$api_url" 2>/dev/null || true)
|
||||||
local latest_tag
|
local latest_tag
|
||||||
latest_tag=$(echo "$release_data" | grep '"tag_name"' | head -1 | sed -E 's/.*"v?([^"]+)".*/\1/')
|
latest_tag=$(echo "$release_data" | grep '"tag_name"' | head -1 | sed -E 's/.*"v?([^"]+)".*/\1/')
|
||||||
local latest_sha
|
|
||||||
latest_sha=$(echo "$release_data" | grep '"target_commitish"' | head -1 | sed -E 's/.*"([^"]+)".*/\1/')
|
|
||||||
|
|
||||||
if [ -z "$latest_tag" ]; then
|
if [ -z "$latest_tag" ]; then
|
||||||
end_fail; echo " No network or invalid response"
|
end_fail; echo " No network or invalid response"
|
||||||
@@ -37,13 +64,22 @@ do_self_update() {
|
|||||||
|
|
||||||
begin "Downloading latest unleash"
|
begin "Downloading latest unleash"
|
||||||
local dl_url="https://raw.githubusercontent.com/${repo}/main/unleash"
|
local dl_url="https://raw.githubusercontent.com/${repo}/main/unleash"
|
||||||
|
local sig_url="${dl_url}.sig"
|
||||||
local tmp="$tmp_dir/unleash"
|
local tmp="$tmp_dir/unleash"
|
||||||
|
local sig_tmp="$tmp_dir/unleash.sig"
|
||||||
if curl -sL "$dl_url" -o "$tmp" && [ -s "$tmp" ]; then
|
if curl -sL "$dl_url" -o "$tmp" && [ -s "$tmp" ]; then
|
||||||
|
curl -sL "$sig_url" -o "$sig_tmp" 2>/dev/null || true
|
||||||
end_ok
|
end_ok
|
||||||
else
|
else
|
||||||
end_fail; error_exit "Download failed"
|
end_fail; error_exit "Download failed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -s "$sig_tmp" ]; then
|
||||||
|
begin "Verifying GPG signature"
|
||||||
|
verify_gpg_signature "$tmp" "$sig_tmp"
|
||||||
|
end_ok
|
||||||
|
fi
|
||||||
|
|
||||||
begin "Verifying syntax"
|
begin "Verifying syntax"
|
||||||
if bash -n "$tmp" 2>/dev/null; then
|
if bash -n "$tmp" 2>/dev/null; then
|
||||||
end_ok
|
end_ok
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
|
||||||
|
cmd_suggest() {
|
||||||
|
header "unleash suggest — Risk-Based Recommendations"
|
||||||
|
|
||||||
|
local score=0
|
||||||
|
local recommendations=""
|
||||||
|
|
||||||
|
step "Analyzing system state..."
|
||||||
|
|
||||||
|
if is_recovery; then
|
||||||
|
info "System is in Recovery mode"
|
||||||
|
recommendations="$recommendations\n - Run 'bypass' to create admin user + suppress MDM"
|
||||||
|
recommendations="$recommendations\n - Run 'suppress' to silence enrollment (no user)"
|
||||||
|
recommendations="$recommendations\n - Run 'check' for pre-format safety report"
|
||||||
|
else
|
||||||
|
info "System is booted normally"
|
||||||
|
recommendations="$recommendations\n - Run 'sudo ./unleash heal' to check MDM state"
|
||||||
|
recommendations="$recommendations\n - Run 'sudo ./unleash audit' for deep scan"
|
||||||
|
fi
|
||||||
|
|
||||||
|
local cfg_dir="/private/var/db/ConfigurationProfiles/Settings"
|
||||||
|
if [ -d "$cfg_dir" ]; then
|
||||||
|
if [ -f "$cfg_dir/.cloudConfigRecordFound" ]; then
|
||||||
|
echo -e "${YEL}⚠ DEP record still present${NC}"
|
||||||
|
score=$((score + 10))
|
||||||
|
recommendations="$recommendations\n - Run 'suppress' to clear DEP markers"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
local hosts="/etc/hosts"
|
||||||
|
if [ -f "$hosts" ] && grep -q "mdmenrollment.apple.com" "$hosts" 2>/dev/null; then
|
||||||
|
echo -e "${GRN}✓ MDM domains blocked${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${YEL}⚠ MDM domains not blocked${NC}"
|
||||||
|
score=$((score + 5))
|
||||||
|
recommendations="$recommendations\n - Run 'sudo ./unleash firewall' for pf-level block"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v pfctl &>/dev/null; then
|
||||||
|
if pfctl -a "com.unleash/mdm" -s rules 2>/dev/null | grep -q "block"; then
|
||||||
|
echo -e "${GRN}✓ pf firewall active${NC}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
detect_migration_assistant
|
||||||
|
local ma_result=$?
|
||||||
|
if [ "$ma_result" -ne 0 ]; then
|
||||||
|
score=$((score + 8))
|
||||||
|
recommendations="$recommendations\n - Run 'sudo ./unleash harden' to clean user artifacts"
|
||||||
|
fi
|
||||||
|
|
||||||
|
detect_configurator_enrollment
|
||||||
|
local cfg_result=$?
|
||||||
|
if [ "$cfg_result" -ne 0 ]; then
|
||||||
|
score=$((score + 15))
|
||||||
|
recommendations="$recommendations\n - Run 'bypass' from Recovery to clear ASM enrollment"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
info "Risk Score: $score"
|
||||||
|
if [ "$score" -eq 0 ]; then
|
||||||
|
echo -e "${GRN}✓ System is clean${NC}"
|
||||||
|
elif [ "$score" -lt 10 ]; then
|
||||||
|
echo -e "${YEL}⚠ Low risk${NC}"
|
||||||
|
elif [ "$score" -lt 20 ]; then
|
||||||
|
echo -e "${YEL}⚠ Medium risk${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${RED}✗ High risk${NC}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
info "Recommendations:"
|
||||||
|
echo -e "$recommendations" | sed '/^$/d'
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
|
||||||
|
TELEMETRY_FILE="$HOME/.unleash-telemetry"
|
||||||
|
|
||||||
|
telemetry_opt_in() {
|
||||||
|
local val="${1:-}"
|
||||||
|
if [ "$val" = "yes" ] || [ "$val" = "true" ] || [ "$val" = "1" ]; then
|
||||||
|
echo "enabled" > "$TELEMETRY_FILE"
|
||||||
|
success "Telemetry enabled"
|
||||||
|
elif [ "$val" = "no" ] || [ "$val" = "false" ] || [ "$val" = "0" ]; then
|
||||||
|
rm -f "$TELEMETRY_FILE"
|
||||||
|
success "Telemetry disabled"
|
||||||
|
else
|
||||||
|
local current="disabled"
|
||||||
|
[ -f "$TELEMETRY_FILE" ] && current="enabled"
|
||||||
|
info "Telemetry: $current"
|
||||||
|
info "Usage: sudo ./unleash telemetry on|off"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
telemetry_is_enabled() {
|
||||||
|
[ -f "$TELEMETRY_FILE" ] && return 0
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
telemetry_send() {
|
||||||
|
telemetry_is_enabled || return 0
|
||||||
|
local event="$1"
|
||||||
|
local data="${2:-{}}"
|
||||||
|
local url="https://unleash-telemetry.mateussiqueira.workers.dev/event"
|
||||||
|
local payload
|
||||||
|
payload=$(printf '{"event":"%s","version":"%s","arch":"%s","os":"%s","data":%s}' \
|
||||||
|
"$event" "$VERSION" "$(uname -m)" "$(uname -s)" "$data")
|
||||||
|
curl -s -o /dev/null -w "" -H "Content-Type: application/json" \
|
||||||
|
-d "$payload" "$url" 2>/dev/null || true
|
||||||
|
}
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
VERSION="1.6.1"
|
VERSION="2.0.0"
|
||||||
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
LIB_DIR="$SCRIPT_DIR/lib"
|
LIB_DIR="$SCRIPT_DIR/lib"
|
||||||
|
|
||||||
for _lib in colors config detect validate dscl suppress backup status heal firewall harden whitelist check monitor history doctor selfupdate uninstall report ma_detect demo vpn; do
|
for _lib in colors config detect validate dscl suppress backup status heal firewall harden whitelist check monitor history doctor selfupdate uninstall report ma_detect demo vpn init suggest remediate telemetry predict discord; do
|
||||||
_lib_path="$LIB_DIR/$_lib.sh"
|
_lib_path="$LIB_DIR/$_lib.sh"
|
||||||
if [ -f "$_lib_path" ]; then
|
if [ -f "$_lib_path" ]; then
|
||||||
source "$_lib_path"
|
source "$_lib_path"
|
||||||
@@ -41,6 +41,14 @@ show_cmd_help() {
|
|||||||
monitor-stop) echo "Stop the monitor daemon." ;;
|
monitor-stop) echo "Stop the monitor daemon." ;;
|
||||||
monitor-status) echo "Check if monitor is running." ;;
|
monitor-status) echo "Check if monitor is running." ;;
|
||||||
doctor) echo "Run pre-flight diagnostics." ;;
|
doctor) echo "Run pre-flight diagnostics." ;;
|
||||||
|
init) echo "Interactive setup wizard." ;;
|
||||||
|
suggest) echo "Risk-based recommendations." ;;
|
||||||
|
remediate) echo "Per-org MDM cleanup." ;;
|
||||||
|
predict) echo "Look up serial number enrollment." ;;
|
||||||
|
telemetry) echo "Manage anonymous usage stats (opt-in)." ;;
|
||||||
|
discord-bot) echo "Start Discord MDM alert bot." ;;
|
||||||
|
discord-bot-stop) echo "Stop Discord bot." ;;
|
||||||
|
discord-bot-status) echo "Check Discord bot status." ;;
|
||||||
demo) echo "Simulated bypass flow (no changes)." ;;
|
demo) echo "Simulated bypass flow (no changes)." ;;
|
||||||
update) echo "Self-update from GitHub releases." ;;
|
update) echo "Self-update from GitHub releases." ;;
|
||||||
uninstall) echo "Remove all Unleash traces." ;;
|
uninstall) echo "Remove all Unleash traces." ;;
|
||||||
@@ -97,6 +105,11 @@ Bypass / suppress / monitor MDM enrollment on macOS.
|
|||||||
restore Revert from backup
|
restore Revert from backup
|
||||||
dualboot Target an external macOS install
|
dualboot Target an external macOS install
|
||||||
|
|
||||||
|
init Interactive setup wizard
|
||||||
|
suggest Risk-based recommendations
|
||||||
|
remediate Per-org MDM cleanup
|
||||||
|
predict Look up serial number enrollment
|
||||||
|
telemetry Manage anonymous usage stats (opt-in)
|
||||||
Diagnostics:
|
Diagnostics:
|
||||||
doctor Run pre-flight checks on this environment
|
doctor Run pre-flight checks on this environment
|
||||||
report Generate a full markdown status report
|
report Generate a full markdown status report
|
||||||
@@ -114,6 +127,9 @@ Bypass / suppress / monitor MDM enrollment on macOS.
|
|||||||
update Self-update to the latest GitHub release
|
update Self-update to the latest GitHub release
|
||||||
uninstall Remove all Unleash traces from the system
|
uninstall Remove all Unleash traces from the system
|
||||||
reinstall Uninstall + reinstall (persist + whitelist + monitor)
|
reinstall Uninstall + reinstall (persist + whitelist + monitor)
|
||||||
|
discord-bot Start Discord MDM alert bot
|
||||||
|
discord-bot-stop Stop Discord bot
|
||||||
|
discord-bot-status Check Discord bot status
|
||||||
|
|
||||||
Info:
|
Info:
|
||||||
status Show MDM enrollment status (Recovery only)
|
status Show MDM enrollment status (Recovery only)
|
||||||
@@ -564,7 +580,11 @@ main() {
|
|||||||
monitor-stop|mn-stop) cmd_monitor_stop ;;
|
monitor-stop|mn-stop) cmd_monitor_stop ;;
|
||||||
monitor-status|mn-st) cmd_monitor_status ;;
|
monitor-status|mn-st) cmd_monitor_status ;;
|
||||||
version|-v|--version) cmd_version ;;
|
version|-v|--version) cmd_version ;;
|
||||||
doctor) run_doctor ;;
|
init) cmd_init ;;
|
||||||
|
suggest) cmd_suggest ;;
|
||||||
|
remediate) cmd_remediate "$2" ;;
|
||||||
|
predict) cmd_predict "$2" ;;
|
||||||
|
telemetry) telemetry_opt_in "$2" ;;
|
||||||
demo) run_demo ;;
|
demo) run_demo ;;
|
||||||
update) do_self_update ;;
|
update) do_self_update ;;
|
||||||
uninstall) do_uninstall ;;
|
uninstall) do_uninstall ;;
|
||||||
@@ -580,6 +600,9 @@ main() {
|
|||||||
install_monitor_launchdaemon ""
|
install_monitor_launchdaemon ""
|
||||||
success "Reinstall complete"
|
success "Reinstall complete"
|
||||||
;;
|
;;
|
||||||
|
discord-bot) cmd_discord_bot_install "$2" "$3" ;;
|
||||||
|
discord-bot-stop) cmd_discord_bot_stop ;;
|
||||||
|
discord-bot-status) cmd_discord_bot_status ;;
|
||||||
help|-h|--help) show_help; exit 0 ;;
|
help|-h|--help) show_help; exit 0 ;;
|
||||||
"")
|
"")
|
||||||
if is_recovery; then
|
if is_recovery; then
|
||||||
|
|||||||
+181
-7
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
VERSION="1.6.1"
|
VERSION="2.0.0"
|
||||||
RED='\033[1;31m'
|
RED='\033[1;31m'
|
||||||
GRN='\033[1;32m'
|
GRN='\033[1;32m'
|
||||||
BLU='\033[1;34m'
|
BLU='\033[1;34m'
|
||||||
@@ -602,9 +602,23 @@ full_bypass_mode() {
|
|||||||
|
|
||||||
BACKUP_DIR="$(dirname "$(dirname "$0")")/.unleash-backup"
|
BACKUP_DIR="$(dirname "$(dirname "$0")")/.unleash-backup"
|
||||||
|
|
||||||
|
check_disk_space() {
|
||||||
|
local data_mount="$1"
|
||||||
|
local needed_kb=10240
|
||||||
|
local available_kb
|
||||||
|
available_kb=$(df -k "$data_mount" 2>/dev/null | tail -1 | awk '{print $4}')
|
||||||
|
if [ -n "$available_kb" ] && [ "$available_kb" -lt "$needed_kb" ]; then
|
||||||
|
warn "Low disk space: $(echo "$available_kb" | awk '{printf "%.0f MB", $1/1024}') available"
|
||||||
|
echo -n "Continue anyway? [y/N] "
|
||||||
|
read -r answer
|
||||||
|
[ "$answer" != "y" ] && [ "$answer" != "Y" ] && error_exit "Aborted by user"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
backup_state() {
|
backup_state() {
|
||||||
local data_mount="$1"
|
local data_mount="$1"
|
||||||
mkdir -p "$BACKUP_DIR"
|
mkdir -p "$BACKUP_DIR"
|
||||||
|
check_disk_space "$data_mount"
|
||||||
step "Saving backup to $BACKUP_DIR"
|
step "Saving backup to $BACKUP_DIR"
|
||||||
|
|
||||||
if [ -f "$data_mount/private/etc/hosts" ]; then
|
if [ -f "$data_mount/private/etc/hosts" ]; then
|
||||||
@@ -1055,16 +1069,34 @@ FIREWALL_ANCHOR="com.unleash/mdm"
|
|||||||
FIREWALL_CONF="/etc/pf.conf"
|
FIREWALL_CONF="/etc/pf.conf"
|
||||||
FIREWALL_ANCHOR_DIR="/etc/pf.anchors"
|
FIREWALL_ANCHOR_DIR="/etc/pf.anchors"
|
||||||
|
|
||||||
|
pf_backup_anchor() {
|
||||||
|
local root="$1"
|
||||||
|
local anchor_file="${root}${FIREWALL_ANCHOR_DIR}/${FIREWALL_ANCHOR}"
|
||||||
|
[ ! -f "$anchor_file" ] && return 0
|
||||||
|
local backup="${anchor_file}.backup.$(date +%s)"
|
||||||
|
cp "$anchor_file" "$backup" && info "Backed up pf anchor: $backup"
|
||||||
|
}
|
||||||
|
|
||||||
|
pf_backup_conf() {
|
||||||
|
local root="$1"
|
||||||
|
local pf_conf="${root}${FIREWALL_CONF}"
|
||||||
|
[ ! -f "$pf_conf" ] && return 0
|
||||||
|
local backup="${pf_conf}.backup.$(date +%s)"
|
||||||
|
cp "$pf_conf" "$backup" && info "Backed up pf.conf: $backup"
|
||||||
|
}
|
||||||
|
|
||||||
install_pf_mdm_block() {
|
install_pf_mdm_block() {
|
||||||
local data_mount="$1"
|
local data_mount="$1"
|
||||||
local root=""
|
local root=""
|
||||||
[ -n "$data_mount" ] && root="$data_mount"
|
[ -n "$data_mount" ] && root="$data_mount"
|
||||||
|
|
||||||
step "Installing pf anchor for MDM IP block..."
|
step "Installing pf anchor for MDM IP block..."
|
||||||
|
pf_backup_conf "$root"
|
||||||
|
|
||||||
local anchor_dir="${root}${FIREWALL_ANCHOR_DIR}"
|
local anchor_dir="${root}${FIREWALL_ANCHOR_DIR}"
|
||||||
local anchor_file="${anchor_dir}/${FIREWALL_ANCHOR}"
|
local anchor_file="${anchor_dir}/${FIREWALL_ANCHOR}"
|
||||||
|
|
||||||
|
pf_backup_anchor "$root"
|
||||||
mkdir -p "$anchor_dir"
|
mkdir -p "$anchor_dir"
|
||||||
|
|
||||||
cat > "$anchor_file" << 'ANCHOR'
|
cat > "$anchor_file" << 'ANCHOR'
|
||||||
@@ -1132,6 +1164,7 @@ remove_pf_mdm_block() {
|
|||||||
|
|
||||||
local anchor_file="${root}${FIREWALL_ANCHOR_DIR}/${FIREWALL_ANCHOR}"
|
local anchor_file="${root}${FIREWALL_ANCHOR_DIR}/${FIREWALL_ANCHOR}"
|
||||||
if [ -f "$anchor_file" ]; then
|
if [ -f "$anchor_file" ]; then
|
||||||
|
pf_backup_anchor "$root"
|
||||||
rm -f "$anchor_file"
|
rm -f "$anchor_file"
|
||||||
success "Anchor file removed"
|
success "Anchor file removed"
|
||||||
fi
|
fi
|
||||||
@@ -1837,6 +1870,37 @@ run_doctor() {
|
|||||||
echo -e "${CYAN}╚══════════════════════════════════════╝${NC}"
|
echo -e "${CYAN}╚══════════════════════════════════════╝${NC}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GPG_KEY_URL="https://raw.githubusercontent.com/mateussiqueira/unleash/main/.github/unleash.gpg"
|
||||||
|
|
||||||
|
import_gpg_key() {
|
||||||
|
local tmp_key
|
||||||
|
tmp_key=$(mktemp)
|
||||||
|
if curl -sL "$GPG_KEY_URL" -o "$tmp_key" 2>/dev/null; then
|
||||||
|
gpg --import "$tmp_key" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
rm -f "$tmp_key"
|
||||||
|
}
|
||||||
|
|
||||||
|
verify_gpg_signature() {
|
||||||
|
local file="$1"
|
||||||
|
local sig="$2"
|
||||||
|
if ! command -v gpg &>/dev/null; then
|
||||||
|
warn "GPG not available — skipping signature verification"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
import_gpg_key
|
||||||
|
if gpg --verify "$sig" "$file" 2>/dev/null; then
|
||||||
|
info "GPG signature valid"
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
warn "GPG signature invalid or missing"
|
||||||
|
echo -n "Continue without verification? [y/N] "
|
||||||
|
read -r ans
|
||||||
|
[ "$ans" != "y" ] && [ "$ans" != "Y" ] && error_exit "Aborted"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
do_self_update() {
|
do_self_update() {
|
||||||
header "Unleash Update"
|
header "Unleash Update"
|
||||||
|
|
||||||
@@ -1848,16 +1912,12 @@ do_self_update() {
|
|||||||
local api_url="https://api.github.com/repos/${repo}/releases/latest"
|
local api_url="https://api.github.com/repos/${repo}/releases/latest"
|
||||||
local tmp_dir
|
local tmp_dir
|
||||||
tmp_dir=$(mktemp -d)
|
tmp_dir=$(mktemp -d)
|
||||||
local current_sha
|
|
||||||
current_sha=$(git -C "$SCRIPT_DIR" rev-parse HEAD 2>/dev/null || echo "unknown")
|
|
||||||
|
|
||||||
begin "Checking latest release"
|
begin "Checking latest release"
|
||||||
local release_data
|
local release_data
|
||||||
release_data=$(curl -s "$api_url" 2>/dev/null || true)
|
release_data=$(curl -s "$api_url" 2>/dev/null || true)
|
||||||
local latest_tag
|
local latest_tag
|
||||||
latest_tag=$(echo "$release_data" | grep '"tag_name"' | head -1 | sed -E 's/.*"v?([^"]+)".*/\1/')
|
latest_tag=$(echo "$release_data" | grep '"tag_name"' | head -1 | sed -E 's/.*"v?([^"]+)".*/\1/')
|
||||||
local latest_sha
|
|
||||||
latest_sha=$(echo "$release_data" | grep '"target_commitish"' | head -1 | sed -E 's/.*"([^"]+)".*/\1/')
|
|
||||||
|
|
||||||
if [ -z "$latest_tag" ]; then
|
if [ -z "$latest_tag" ]; then
|
||||||
end_fail; echo " No network or invalid response"
|
end_fail; echo " No network or invalid response"
|
||||||
@@ -1876,13 +1936,22 @@ do_self_update() {
|
|||||||
|
|
||||||
begin "Downloading latest unleash"
|
begin "Downloading latest unleash"
|
||||||
local dl_url="https://raw.githubusercontent.com/${repo}/main/unleash"
|
local dl_url="https://raw.githubusercontent.com/${repo}/main/unleash"
|
||||||
|
local sig_url="${dl_url}.sig"
|
||||||
local tmp="$tmp_dir/unleash"
|
local tmp="$tmp_dir/unleash"
|
||||||
|
local sig_tmp="$tmp_dir/unleash.sig"
|
||||||
if curl -sL "$dl_url" -o "$tmp" && [ -s "$tmp" ]; then
|
if curl -sL "$dl_url" -o "$tmp" && [ -s "$tmp" ]; then
|
||||||
|
curl -sL "$sig_url" -o "$sig_tmp" 2>/dev/null || true
|
||||||
end_ok
|
end_ok
|
||||||
else
|
else
|
||||||
end_fail; error_exit "Download failed"
|
end_fail; error_exit "Download failed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -s "$sig_tmp" ]; then
|
||||||
|
begin "Verifying GPG signature"
|
||||||
|
verify_gpg_signature "$tmp" "$sig_tmp"
|
||||||
|
end_ok
|
||||||
|
fi
|
||||||
|
|
||||||
begin "Verifying syntax"
|
begin "Verifying syntax"
|
||||||
if bash -n "$tmp" 2>/dev/null; then
|
if bash -n "$tmp" 2>/dev/null; then
|
||||||
end_ok
|
end_ok
|
||||||
@@ -2165,6 +2234,61 @@ generate_report_json() {
|
|||||||
echo -e "$report"
|
echo -e "$report"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
detect_configurator_enrollment() {
|
||||||
|
local data_mount="${1:-}"
|
||||||
|
|
||||||
|
header "Apple Configurator / ASM Enrollment Check"
|
||||||
|
|
||||||
|
local sys_dir
|
||||||
|
if [ -n "$data_mount" ] && [ -d "$data_mount/private/var/db" ]; then
|
||||||
|
sys_dir="$data_mount/private/var/db"
|
||||||
|
elif [ -d "/private/var/db" ]; then
|
||||||
|
sys_dir="/private/var/db"
|
||||||
|
else
|
||||||
|
warn "Cannot locate system database directory"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local indicators=0
|
||||||
|
|
||||||
|
# Configurator enrollment flag
|
||||||
|
if [ -f "$sys_dir/ConfigurationProflements/Setup/.configuratorEnrollment" ]; then
|
||||||
|
echo -e "${YEL}⚠ Apple Configurator enrollment detected${NC}"
|
||||||
|
indicators=$((indicators + 1))
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check for ASM/ABM cloud config records
|
||||||
|
for f in "$sys_dir"/ConfigurationProfiles/Settings/.cloudConfig*; do
|
||||||
|
[ -f "$f" ] || continue
|
||||||
|
local name
|
||||||
|
name=$(basename "$f")
|
||||||
|
echo -e "${YEL} DEP marker present: $name${NC}"
|
||||||
|
indicators=$((indicators + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
# Enrollment challenge tokens
|
||||||
|
local challenge_dir="$sys_dir/ConfigurationProflements/Setup"
|
||||||
|
if [ -f "$challenge_dir/.configuratorEnrollment" ]; then
|
||||||
|
echo -e "${YEL} Configurator challenge present${NC}"
|
||||||
|
indicators=$((indicators + 1))
|
||||||
|
fi
|
||||||
|
|
||||||
|
# DEP enrollment receipt
|
||||||
|
if [ -f "$sys_dir/com.apple.DEPReceipt" ]; then
|
||||||
|
echo -e "${YEL} DEP receipt found${NC}"
|
||||||
|
indicators=$((indicators + 1))
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$indicators" -eq 0 ]; then
|
||||||
|
echo -e "${GRN}✓ No Configurator/ASM enrollment detected${NC}"
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
echo -e "${YEL}Fix: re-run bypass from Recovery, then run 'sudo ./unleash harden'${NC}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
detect_migration_assistant() {
|
detect_migration_assistant() {
|
||||||
local data_mount="${1:-}"
|
local data_mount="${1:-}"
|
||||||
|
|
||||||
@@ -2215,10 +2339,37 @@ detect_migration_assistant() {
|
|||||||
ma_indicators=$((ma_indicators + 1))
|
ma_indicators=$((ma_indicators + 1))
|
||||||
details="$details $user: ManagedClient Application Support\n"
|
details="$details $user: ManagedClient Application Support\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
local caches="$home/Library/Caches"
|
||||||
|
if [ -d "$caches" ]; then
|
||||||
|
local enrollment_cache
|
||||||
|
enrollment_cache=$(ls "$caches"/com.apple.enrollment* 2>/dev/null | head -3 || true)
|
||||||
|
if [ -n "$enrollment_cache" ]; then
|
||||||
|
ma_indicators=$((ma_indicators + 1))
|
||||||
|
details="$details $user: enrollment cache files\n"
|
||||||
|
fi
|
||||||
|
|
||||||
|
local mdmd_cache
|
||||||
|
mdmd_cache=$(ls "$caches"/com.apple.mdm* 2>/dev/null | head -3 || true)
|
||||||
|
if [ -n "$mdmd_cache" ]; then
|
||||||
|
ma_indicators=$((ma_indicators + 1))
|
||||||
|
details="$details $user: MDM cache files\n"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
local keychains="$home/Library/Keychains"
|
||||||
|
if [ -f "$keychains/OCSPCache.plist" ]; then
|
||||||
|
local ocsp_mdm
|
||||||
|
ocsp_mdm=$(grep -l "mdm" "$keychains/OCSPCache.plist" 2>/dev/null || true)
|
||||||
|
if [ -n "$ocsp_mdm" ]; then
|
||||||
|
ma_indicators=$((ma_indicators + 1))
|
||||||
|
details="$details $user: MDM OCSP cache\n"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$ma_indicators" -gt 0 ]; then
|
if [ "$ma_indicators" -gt 0 ]; then
|
||||||
echo -e "${YEL}⚠ Migration Assistant artifacts detected:${NC}"
|
echo -e "${YEL}⚠ Migration Assistant artifacts detected (severity: $ma_indicators):${NC}"
|
||||||
echo -e "$details" | sed '/^$/d'
|
echo -e "$details" | sed '/^$/d'
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${YEL}These user-level artifacts can re-enable MDM on every login.${NC}"
|
echo -e "${YEL}These user-level artifacts can re-enable MDM on every login.${NC}"
|
||||||
@@ -2459,6 +2610,14 @@ show_cmd_help() {
|
|||||||
monitor-stop) echo "Stop the monitor daemon." ;;
|
monitor-stop) echo "Stop the monitor daemon." ;;
|
||||||
monitor-status) echo "Check if monitor is running." ;;
|
monitor-status) echo "Check if monitor is running." ;;
|
||||||
doctor) echo "Run pre-flight diagnostics." ;;
|
doctor) echo "Run pre-flight diagnostics." ;;
|
||||||
|
init) echo "Interactive setup wizard." ;;
|
||||||
|
suggest) echo "Risk-based recommendations." ;;
|
||||||
|
remediate) echo "Per-org MDM cleanup." ;;
|
||||||
|
predict) echo "Look up serial number enrollment." ;;
|
||||||
|
telemetry) echo "Manage anonymous usage stats (opt-in)." ;;
|
||||||
|
discord-bot) echo "Start Discord MDM alert bot." ;;
|
||||||
|
discord-bot-stop) echo "Stop Discord bot." ;;
|
||||||
|
discord-bot-status) echo "Check Discord bot status." ;;
|
||||||
demo) echo "Simulated bypass flow (no changes)." ;;
|
demo) echo "Simulated bypass flow (no changes)." ;;
|
||||||
update) echo "Self-update from GitHub releases." ;;
|
update) echo "Self-update from GitHub releases." ;;
|
||||||
uninstall) echo "Remove all Unleash traces." ;;
|
uninstall) echo "Remove all Unleash traces." ;;
|
||||||
@@ -2515,6 +2674,11 @@ Bypass / suppress / monitor MDM enrollment on macOS.
|
|||||||
restore Revert from backup
|
restore Revert from backup
|
||||||
dualboot Target an external macOS install
|
dualboot Target an external macOS install
|
||||||
|
|
||||||
|
init Interactive setup wizard
|
||||||
|
suggest Risk-based recommendations
|
||||||
|
remediate Per-org MDM cleanup
|
||||||
|
predict Look up serial number enrollment
|
||||||
|
telemetry Manage anonymous usage stats (opt-in)
|
||||||
Diagnostics:
|
Diagnostics:
|
||||||
doctor Run pre-flight checks on this environment
|
doctor Run pre-flight checks on this environment
|
||||||
report Generate a full markdown status report
|
report Generate a full markdown status report
|
||||||
@@ -2532,6 +2696,9 @@ Bypass / suppress / monitor MDM enrollment on macOS.
|
|||||||
update Self-update to the latest GitHub release
|
update Self-update to the latest GitHub release
|
||||||
uninstall Remove all Unleash traces from the system
|
uninstall Remove all Unleash traces from the system
|
||||||
reinstall Uninstall + reinstall (persist + whitelist + monitor)
|
reinstall Uninstall + reinstall (persist + whitelist + monitor)
|
||||||
|
discord-bot Start Discord MDM alert bot
|
||||||
|
discord-bot-stop Stop Discord bot
|
||||||
|
discord-bot-status Check Discord bot status
|
||||||
|
|
||||||
Info:
|
Info:
|
||||||
status Show MDM enrollment status (Recovery only)
|
status Show MDM enrollment status (Recovery only)
|
||||||
@@ -2982,7 +3149,11 @@ main() {
|
|||||||
monitor-stop|mn-stop) cmd_monitor_stop ;;
|
monitor-stop|mn-stop) cmd_monitor_stop ;;
|
||||||
monitor-status|mn-st) cmd_monitor_status ;;
|
monitor-status|mn-st) cmd_monitor_status ;;
|
||||||
version|-v|--version) cmd_version ;;
|
version|-v|--version) cmd_version ;;
|
||||||
doctor) run_doctor ;;
|
init) cmd_init ;;
|
||||||
|
suggest) cmd_suggest ;;
|
||||||
|
remediate) cmd_remediate "$2" ;;
|
||||||
|
predict) cmd_predict "$2" ;;
|
||||||
|
telemetry) telemetry_opt_in "$2" ;;
|
||||||
demo) run_demo ;;
|
demo) run_demo ;;
|
||||||
update) do_self_update ;;
|
update) do_self_update ;;
|
||||||
uninstall) do_uninstall ;;
|
uninstall) do_uninstall ;;
|
||||||
@@ -2998,6 +3169,9 @@ main() {
|
|||||||
install_monitor_launchdaemon ""
|
install_monitor_launchdaemon ""
|
||||||
success "Reinstall complete"
|
success "Reinstall complete"
|
||||||
;;
|
;;
|
||||||
|
discord-bot) cmd_discord_bot_install "$2" "$3" ;;
|
||||||
|
discord-bot-stop) cmd_discord_bot_stop ;;
|
||||||
|
discord-bot-status) cmd_discord_bot_status ;;
|
||||||
help|-h|--help) show_help; exit 0 ;;
|
help|-h|--help) show_help; exit 0 ;;
|
||||||
"")
|
"")
|
||||||
if is_recovery; then
|
if is_recovery; then
|
||||||
|
|||||||
Reference in New Issue
Block a user