chahinebrini 2cb1f8ad6e feat(binder-mac): SwiftUI Wizard für Self-Bind End-to-End-Flow
apps/rebreak-binder-mac/ — neue macOS-App die User durch den kompletten
Self-Bind-Prozess führt: Welcome → Preflight → Supervise → Enroll →
Configure (MDM-Push + Pre/Post-Check) → Sideload Lock-Profile (AirDrop).

3-Layer Smart-Resume: supervised? + Enrollment-Profil installed (cfgutil
Ground-Truth)? + MDM-Ack fresh (NanoMDM-DB via ssh+psql)?

Services: DeviceDetector (ideviceinfo + cfgutil), SuperviseRunner
(spawnt supervise-magic CLI), MDMClient (PUT /v1/enqueue?push=1, Apple
XML-Plist, identisch zum server-watcher-Format), MDMStatus (DB-Real-
Check + ManagedApplicationList-Result-Read).

Plus:
- fix(supervise-magic): EOF nach ProcessMessage Response (ErrorCode=0)
  ist Success, nicht Error — vermeidet false-fail bei iPhone-Restore-
  Reboot
- feat(mdm-profiles): rebreak-content-filter-mdm.mobileconfig als
  MDM-Push-Variante (ohne ConsentText, ohne globales allowAppRemoval=
  false — per-app via managed-state)

End-to-End validiert: App-Push via Ad-Hoc-Manifest (silent), Managed-
State via ManagedApplicationList-Query, NEFilter-Mode nach App-Force-
Quit, Lock-Profile non-removable nach Sideload.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-27 08:37:14 +02:00

93 lines
3.7 KiB
Markdown

# ReBreak Binder (Mac)
End-User-Wizard für Self-Binding eines iPhones an ReBreak. Macht in einem 5-Step-Flow:
1. **Welcome** — Detect iPhone via USB (lockdownd)
2. **Pre-Flight** — Find-My-iPhone + Stolen-Device-Protection prüfen/ausschalten
3. **Supervise**`supervise-magic` Plist-Inject + Reboot (kein Erase)
4. **Enroll** — MDM-Enrollment-Profile auf iPhone installieren
5. **Configure** — NanoMDM pusht: Lock-Profile + Take-Management + Settings(mdmSupervised=true)
Resultat: iPhone supervised by "ReBreak", App nicht löschbar, NEFilter aktiv (kein User-Toggle in Settings).
**Pre-Requirement**: ReBreak-App muss VOR Wizard-Start aus TestFlight installiert sein. Wizard nutzt `InstallApplication` mit `ChangeManagementState: Managed` (kein ManifestURL nötig, kein ABM-Account). Auto-Install via MDM-Push ist Phase 2 (braucht ABM oder Manifest-Hosting).
## Status
🚧 Phase 1 — Skelett. Nur lokal nutzbar (User+Olfa+Dev-iPhones).
## Voraussetzungen
| Tool | Wie |
|---|---|
| Xcode 26+ | App Store |
| xcodegen | `brew install xcodegen` |
| libimobiledevice | `brew install libimobiledevice` |
| supervise-magic binary | aus `../../ops/mdm/supervise-magic/` (`make build`) |
| cfgutil | Apple Configurator (App Store) → `/Applications/Apple Configurator.app/Contents/MacOS/cfgutil` für silent profile install |
## Build
```bash
cd apps/rebreak-binder-mac
# Einmalig: dependencies + supervise-magic-binary bauen
(cd ../../ops/mdm/supervise-magic && make tidy && make build)
# Xcode-Project generieren (oder neu generieren nach project.yml Änderungen)
xcodegen generate
# Bauen + öffnen
open RebreakBinder.xcodeproj
# → ⌘R in Xcode
```
Oder CLI-only:
```bash
xcodebuild -project RebreakBinder.xcodeproj -scheme RebreakBinder -configuration Debug build
open build/Debug/RebreakBinder.app
```
## Config (lokal)
NanoMDM-API-Key braucht die App für Step 5 (Configure). Lege ein lokales config-file an:
```bash
cat > ~/.config/rebreak-binder/config.json <<'EOF'
{
"mdmServer": "https://mdm.rebreak.org",
"mdmUser": "nanomdm",
"mdmApiKey": "<32-char-hex from /root/.nanomdm_admin_pass on rebreak-mdm>"
}
EOF
chmod 600 ~/.config/rebreak-binder/config.json
```
Production-Version legt das in Keychain ab — heute reicht plain JSON.
## TODOs (post-Skelett)
- [ ] **Lock-Profile-Refactor**: `allowAppRemoval=false` GLOBAL raus aus `rebreak-content-filter-sideload.mobileconfig`. Per-App-Lock kommt über Managed-App-State (MDM `InstallApplication` mit `ChangeManagementState: Managed` → iOS deaktiviert App-Wackel-„X" automatisch für managed apps). Andere Apps bleiben löschbar (bessere UX).
- [ ] App-Versions-Mgmt: `InstallApplication`-Manifest-URL-Pointer auf latest IPA (siehe `ops/mdm/PHASES.md` Phase F.5)
- [ ] Trustee-Setup-Optional in DoneView (Email an Vertrauensperson)
- [ ] 7-Tage-Cooldown-Persistenz (lokale SQLite oder Backend)
- [ ] Code-Signing + Notarization (Developer-ID)
- [ ] Backend `/api/binder/*` Endpoints — Mac-App spricht heute MDM-Server direkt
## Architektur
- **SwiftUI macOS-App** mit `@Observable` State-Machine (`WizardModel`)
- **Services** sind dünne Wrapper um:
- `ideviceinfo` (libimobiledevice) — Device-Detection
- `supervise-magic` Go-CLI — Supervise + Status-Check
- `cfgutil` (optional, Apple Configurator 2) — Silent Profile-Install
- NanoMDM HTTP-API (`mdm.rebreak.org`) — InstallProfile + Settings-Commands
- **Kein Backend-Account-Login** für MVP — API-Key in lokalem Config
## Sicherheit
- API-Key sollte langfristig in Keychain (heute: plain JSON, chmod 600)
- App ist **unsigned** für lokales Testen — Gatekeeper-Warning beim ersten Öffnen
- Process-Spawn von go-binaries braucht **disabled App-Sandbox** (gesetzt in `project.yml`)