Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions mac-manual/content/04-security.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ If a bug ever writes that shared state wrongly, the enclave stops accepting it a
- With FileVault on, macOS can't unlock its disk and won't start, and the startup picker may not open. Getting the Mac back takes a DFU restore, which erases it.
- With FileVault off, macOS resets its keychain and Touch ID fingerprints and shows a warning.

On a MacBook Air M1, the first setup rewrites three records in that shared state that macOS created. The Secure Enclave driver lets those three through, and keeps refusing changes to every other macOS record. Back up macOS before you turn Touch ID on there too.

On a MacBook Neo, setup also reads the sensor's key from the factory records the installer left on the boot partition, into a firmware file only root can read. Turning Touch ID off deletes that file.

Turning Touch ID off later removes your fingerprints and stops the driver loading. The key store stays.
Expand Down
2 changes: 1 addition & 1 deletion omarchy-mac/README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions omarchy-mac/entrypoints/enable-fingerprint
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ if [[ -e /etc/omarchy-mac/touchid-on ]]; then
echo "Touch ID was turned off while this ran, so setup goes on without it."
exit 0
elif [[ ! -e $options ]]; then
{ mkdir -p -m 0755 "${options%/*}" &&
{ option_line=$(/usr/lib/omarchy-mac/touchid-options) && mkdir -p -m 0755 "${options%/*}" &&
printf '%s\n' "# The owner turned on Touch ID; omarchy-mac's disable-fingerprint removes this." \
"options apple_sep xart_writes=1 provision_keybag=1" >"$options.new" &&
"$option_line" >"$options.new" &&
chmod 0644 "$options.new" && mv -fT "$options.new" "$options"; } ||
{ rm -f "$options.new" 2>/dev/null; echo "Touch ID's driver options could not be written to $options" >&2; exit 1; }
fi
Expand Down
7 changes: 5 additions & 2 deletions omarchy-mac/lib/touchid-eligibility
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@ elif [[ -z $sensor ]]; then
fi

# The boards the aurora driver has a profile for. M1-family Macs cold-boot
# their enclave behind an xART guard that blocks matching, so they wait.
if compatible apple,t8103 || compatible apple,t6000 || compatible apple,t6001; then
# their enclave behind an xART guard that blocks matching; the M1 Air (J313)
# sets up with the guard pinning its setup lockers (touchid-options), the others wait.
if compatible apple,t8103 && compatible apple,j313; then
:
elif compatible apple,t8103 || compatible apple,t6000 || compatible apple,t6001; then
echo unsupported:m1-family
exit 0
elif ! compatible apple,t8112 && ! compatible apple,t6020 && ! compatible apple,t6021 && ! compatible apple,t8140 &&
Expand Down
3 changes: 2 additions & 1 deletion omarchy-mac/lib/touchid-enable
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,10 @@ if [[ -d $module && ! -e $options && ! -e $loaded ]]; then
fi
# A write that fails partway never replaces the options, since a file without
# them would load a read-only driver at every boot.
option_line=$("$helpers/touchid-options") || fail "this Mac's driver options could not be worked out"
{ mkdir -p -m 0755 "${options%/*}" &&
printf '%s\n' "# The owner turned on Touch ID; omarchy-mac's disable-fingerprint removes this." \
"options apple_sep xart_writes=1 provision_keybag=1" >"$options.new" &&
"$option_line" >"$options.new" &&
chmod 0644 "$options.new" && mv -fT "$options.new" "$options"; } ||
{ rm -f "$options.new" 2>/dev/null; fail "the driver's options could not be written to $options"; }
mkdir -p -m 0755 "${loaded%/*}"
Expand Down
18 changes: 18 additions & 0 deletions omarchy-mac/lib/touchid-options
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
# Prints the modprobe.d line that lets the Secure Enclave driver set up Touch ID
# on this Mac, for touchid-enable and enable-fingerprint to write.

tree=${OMARCHY_MAC_TOUCHID_TREE:-/proc/device-tree}
omarchy-hw-apple-silicon || exit 0

compatible() {
[[ -r $tree/compatible ]] && tr '\0' '\n' <"$tree/compatible" | grep -Fxq "$1"
}

options="xart_writes=1 provision_keybag=1"
# The M1 Air's first setup rewrites key-store session records macOS created, which
# the xART guard refuses; xart_guard_pin pins those and keeps the guard on (#486).
if compatible apple,t8103 && compatible apple,j313; then
options+=" xart_guard_pin=1"
fi
printf 'options apple_sep %s\n' "$options"
24 changes: 24 additions & 0 deletions omarchy-mac/test/touchid-consent-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ printf 'disabled\0' >"$tree/soc/spi@39b108000/fingerprint@0/status"
[[ $(eligibility) == "none" ]] || fail 'a disabled sensor node is no Touch ID'
machine apple,j314s apple,t6000 apple,arm-platform
[[ $(eligibility) == "unsupported:m1-family" ]] || fail 'M1-family Macs wait for their xART guard path'
machine apple,j293 apple,t8103 apple,arm-platform
[[ $(eligibility) == "unsupported:m1-family" ]] || fail 'a T8103 board other than the M1 Air still waits for its xART guard path'
machine apple,j313 apple,t8103 apple,arm-platform
[[ $(eligibility) == "available" ]] || fail 'the M1 Air J313 is available' "$(eligibility)"
machine apple,j504 apple,t8122 apple,arm-platform
[[ $(eligibility) == "unsupported:board" ]] || fail 'a T8122 board whose wiring the driver has not read is unsupported'
machine apple,j613 apple,t8122 apple,arm-platform
Expand Down Expand Up @@ -248,6 +252,16 @@ grep -Fxq 'options apple_sep xart_writes=1 provision_keybag=1' "$fixture/options
[[ $(<"$fixture/calls") == $'calibration\nmodprobe apple-sep\nsystemctl start omarchy-mac-touchid-activate.service\nsystemctl try-restart fprintd.service' ]] ||
fail 'it carves, loads the driver, waits for the activation, then restarts a running fprintd' "$(<"$fixture/calls")"
[[ $out == *"Touch ID is on."* ]] || fail 'it says so' "$out"
! grep -q xart_guard "$fixture/etc/modprobe.conf" || fail 'a Mac other than the M1 Air gets no xART guard option'
# The M1 Air loads with the guard off and carves its calibration under its sensor's name.
machine apple,j313 apple,t8103 apple,arm-platform
printf 'apple/mesacal-j313.bin\0' >"$tree/soc/spi@39b108000/fingerprint@0/firmware-name"
echo ready >"$fixture/activation"
out=$(run touchid-enable 2>&1) || fail 'the M1 Air turns on' "$out"
grep -Fxq 'options apple_sep xart_writes=1 provision_keybag=1 xart_guard_pin=1' "$fixture/options-at-load" ||
fail 'the M1 Air loads the driver with the xART guard pinning its setup lockers' "$(<"$fixture/options-at-load")"
[[ $(<"$fixture/firmware/updates/apple/mesacal-j313.bin") == "calibration" ]] ||
fail "the M1 Air's calibration is carved under its sensor's firmware name"
# A Neo's sensor key is rebuilt only now, from its factory records on the ESP,
# byte for byte, root-only, and nowhere else.
neo
Expand Down Expand Up @@ -521,6 +535,7 @@ for name in enable-fingerprint disable-fingerprint; do
sed -e "s|/run/omarchy-mac/touchid|$fixture/run/touchid|g" -e "s|/var/lib/aurora-sep-keybag.bin|$fixture/keybag|g" \
-e "s|/usr/lib/omarchy-mac/touchid-enable|$fixture/bin/enable-stub|g" -e "s|/etc/omarchy-mac/touchid-on|$fixture/etc/touchid-on|g" \
-e "s|/usr/lib/omarchy-mac/touchid-eligibility|$fixture/bin/eligibility-stub|g" \
-e "s|/usr/lib/omarchy-mac/touchid-options|OMARCHY_MAC_TOUCHID_TREE=$tree $ROOT/lib/touchid-options|g" \
-e "s|/etc/modprobe.d/omarchy-mac-touchid.conf|$fixture/etc/modprobe.conf|g" -e "s|/usr/lib/firmware/updates/|$fixture/firmware/updates/|g" \
-e "s|/proc/device-tree/compatible|$tree/compatible|g" -e "s|flock -w 300|flock -w 0|" "$ROOT/entrypoints/$name" >"$entry/$name"
chmod +x "$entry/$name"
Expand Down Expand Up @@ -554,6 +569,15 @@ touch "$fixture/etc/touchid-on"
ask ready '' && [[ ! -s $fixture/calls && ! -s $fixture/out ]] || fail 'a Touch ID the owner already turned on asks nothing'
grep -Fxq 'options apple_sep xart_writes=1 provision_keybag=1' "$fixture/etc/modprobe.conf" ||
fail 'a Touch ID turned on before the driver options existed gets them'
machine apple,j313 apple,t8103 apple,arm-platform
mkdir -p "$fixture/etc"
touch "$fixture/etc/touchid-on"
ask ready '' && grep -Fxq 'options apple_sep xart_writes=1 provision_keybag=1 xart_guard_pin=1' "$fixture/etc/modprobe.conf" ||
fail 'an M1 Air turned on before the driver options existed gets them with the pin' "$(<"$fixture/out")"
machine apple,j414c apple,t6021 apple,arm-platform
mkdir -p "$fixture/etc"
touch "$fixture/etc/touchid-on"
ask ready '' || fail 'an agreed M2 Max gets its options again' "$(<"$fixture/out")"
# No options yet, and none can be written.
rm "$fixture/etc/modprobe.conf"
mkdir -p "$fixture/etc/modprobe.conf.new/in-the-way"
Expand Down
Loading