Files
openbot/scripts/host-installation.ts
NB 7fada81c14 Ship managed Mac host updates, signed installer, and tenant setup (#638)
* Add host-managed automatic updates for multi-tenant Macs

Refs #634.

Per-instance Sunshine port families and WebRTC ranges so two tenants can run Remote Desktop at once. Sibling-process guard refuses tenant installs while another session runs from the shared bundle. HostUpdateCoordinator elects a leader over files in a shared directory, waits out the idle grace period, stops tenants via intent, installs once, relaunches via per-user LaunchAgents, and verifies per-tenant health with admin alerts. Host-managed tenants report status but never install on their own.

* Move shared Mac updates into a privileged host manager

* Keep tenant startup available after an aborted host download

* Require successful initialization and continuous idle before host restart

* Reserve media ranges across processes and fail closed on update scans

* Add administrator setup for Standard tenant accounts and generated passwords

* Ship signed macOS Host package and installed setup commands

* Allow the trusted Applications parent during host staging

* Recover stopped tenants after an aborted host shutdown

* Close failed UDP probes during port allocation
2026-09-20 18:28:18 +02:00

33 lines
1.4 KiB
TypeScript

import { z } from "zod";
import { HOST_MANAGER_DIRECTORY } from "../src/main/host-update-files";
export const HOST_TEAM_ID = "ZTRDTUL87R";
export const HOST_PACKAGE_ID = "app.openbot.host";
export const HOST_DAEMON_PLIST = "/Library/LaunchDaemons/app.openbot.host-manager.plist";
export const HOST_AGENT_PLIST = "/Library/LaunchAgents/app.openbot.desktop.relaunch.plist";
export const HOST_EXECUTABLES = ["host-manager", "openbot-host", "create-tenants"] as const;
export const HOST_FILES = [
...HOST_EXECUTABLES.map((name) => `${HOST_MANAGER_DIRECTORY}/${name}`),
`${HOST_MANAGER_DIRECTORY}/openbot-relaunch.sh`,
`${HOST_MANAGER_DIRECTORY}/host-release.json`,
HOST_DAEMON_PLIST,
HOST_AGENT_PLIST,
"/usr/local/bin/openbot-host",
] as const;
export const hostReleaseSchema = z
.object({
version: z.string().regex(/^\d+\.\d+\.\d+$/),
commit: z.string().regex(/^[a-f0-9]{40}$/),
arch: z.literal("arm64"),
})
.strict();
export function hostExecutableRequirement(name: string): string {
if (!HOST_EXECUTABLES.some((entry) => entry === name)) throw new Error("Unknown host executable.");
return `=anchor apple generic and identifier "app.openbot.host.${name}" and certificate leaf[subject.OU] = "${HOST_TEAM_ID}" and certificate leaf[field.1.2.840.113635.100.6.1.13] exists`;
}
export function hostFileMode(path: string) {
return path.endsWith(".plist") || path.endsWith(".json") ? 0o644 : 0o755;
}