Skip to content

macOS test machine#

For the Secure Enclave keystore backend and the macOS half of the break tests. What macOS gives this product and what it does not is exordos_nac/docs/macos.md; this page is how to get a machine to run the agent on.

What a VM can and cannot answer#

The Secure Enclave is a physical coprocessor. No hypervisor exposes it — not OSX-KVM on x86, not Virtualization.framework on Apple silicon — so in a VM an Enclave key simply cannot be created, and that failure is indistinguishable from "the agent cannot reach the Enclave". Anything about the Enclave has to be measured on hardware.

A VM still answers the rest, and it is most of the surface: the launchd plumbing, paths and permissions, what code signing the LaunchAgent needs, and the fallback backend, which on macOS is the honest software level.

Running the agent's own tests there#

cgo cannot be cross-compiled from Linux, so the darwin backends build on the machine itself:

go build ./...
go test ./...
make dist-darwin        # bare binaries, for working here
make dist-macos-pkg     # the installer a fleet actually takes

Both refuse to run anywhere but a Mac, and for the same reason: a darwin build without cgo cannot reach Security.framework and silently compiles the file-key fallback instead.

The difference between them is what a Mac can do with the result. dist-darwin gives bare binaries, which is what development wants and what a fleet must never be given - the Secure Enclave entitlement is authorised by a provisioning profile, a profile lives inside an app bundle, and a bare Mach-O has nowhere to keep one. dist-macos-pkg builds that bundle, signs it if the environment carries the credentials, and wraps it in the pkg with the LaunchAgent that keeps the lease renewed.

Bringing up the VM#

Built with OSX-KVM; the host needs ignore_msrs=1 and a Ryzen or Intel CPU. Apple's licence permits macOS virtualisation on Apple hardware only — the VM is a development convenience, and anything that decides the design still needs a Mac.

Setup notes for the documented host:

  • Use two vCPUs. The host is an AMD EPYC and OSX-KVM presents it as Intel. Higher vCPU counts have caused the guest to hang during boot or Setup Assistant. A hang appears as busy CPUs, no disk I/O and a frozen guest clock; check /proc/<qemu>/io and the guest clock before treating a slow setup step as stuck.
  • Allow Setup Assistant time to finish. Creating the account can take several minutes. Disk writes and a ticking guest clock indicate progress.
  • Verify text entered over QMP. QMP can send duplicate characters; count the dots in a password screenshot or verify the value after account creation.

Once it is up, enable SSH from a Terminal in the GUI session — systemsetup -setremotelogin on needs Full Disk Access and will refuse, but launchd will not:

sudo launchctl enable system/com.openssh.sshd
sudo launchctl bootstrap system /System/Library/LaunchDaemons/ssh.plist

A fresh install has neither a compiler nor Go. Install Command Line Tools using the label shown by softwareupdate -l (the label varies by macOS version):

softwareupdate -l
sudo softwareupdate -i "<exact Command Line Tools label from the list>" --verbose

Replace the quoted placeholder with the exact label printed by softwareupdate -l.

Fetch the Go tarball on the host and copy it in; the guest's user-mode NAT is slower than the host's network.

The hardware fingerprint is 1/3 on this VM and that is correct. OSX-KVM ships an all-zero IOPlatformUUID, which hwid's placeholder filter rejects on purpose — keeping it would make every OSX-KVM guest match every other one. Only the serial survives. Do not "fix" it.

Run user-keychain checks in the login session#

The agent's Secure Enclave key belongs to the logged-in user's data protection keychain, so its LaunchAgent runs in that user's Aqua bootstrap domain. An SSH command runs in Background and cannot stand in for an agent check. Run commands that inspect the agent's key from the login session with launchctl asuser.