Skip to content
Open
Show file tree
Hide file tree
Changes from 5 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
8 changes: 8 additions & 0 deletions mac-manual/content/04-security.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ Owner provisioning then asks for your name and password, as on x86. On an encryp

The next boot unlocks the disk with your password. At the prompt the built-in keyboard and trackpad work, because their drivers are loaded early in the initramfs. A Bluetooth keyboard does not, just as on x86: use the built-in keyboard or a wired one.

## Touch ID login

After you explicitly enable Touch ID, its driver starts at each boot and restores the fingerprints already enrolled for Linux. On a stock SDDM login screen, submit your username and touch the sensor when prompted. You can still use your password: if the reader is unavailable or the fingerprint attempt fails, authentication continues with the original password stack. A customized SDDM authentication stack is left for its administrator rather than rewritten.

On the 15-inch M4 Air (J715), support additionally requires a compatible kernel and this Mac's own FDR root key and FSC2 calibration. They are private, are not shipped in a package, and are not interchangeable with another Mac's files. The earlier J715 port has restored an existing enrollment and completed fingerprint login after a cold boot; the current upstream kernel still needs its own qualification.

Fingerprint login does not unlock an encrypted root disk or a password-encrypted desktop keyring. Keep using the disk password at the early boot prompt. Turning Touch ID off removes its SDDM authentication include, but does not delete the Linux key store.

## Changing passwords

Change passwords under _Update > Password_ in the Omarchy menu, as on x86. On a Mac your disk password and your login password start out the same, but each changes on its own: _Drive Encryption_ changes only the disk password, and _User_ only the login password. A disk password change is recorded step by step, so an interruption resumes rather than leaving the disk half changed. If you no longer know your password, see the next section.
Expand Down
12 changes: 11 additions & 1 deletion omarchy-mac/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# omarchy-mac

Apple Silicon defaults and support services for Omarchy. Version: `0.2.3` (candidate). This add-on complements `omarchy` and `omarchy-settings`; it selects no kernel and contains no installer or repository trust configuration. It covers what stays on an installed Mac; installing one is the job of the [Omarchy Installer](https://github.com/omacom/omarchy-mac-installer), and boot support is the separate `omarchy-mac-boot` package beside this one.
Apple Silicon defaults and support services for Omarchy. Version: `0.2.4` (candidate). This add-on complements `omarchy` and `omarchy-settings`; it selects no kernel and contains no installer or repository trust configuration. It covers what stays on an installed Mac; installing one is the job of the [Omarchy Installer](https://github.com/omacom/omarchy-mac-installer), and boot support is the separate `omarchy-mac-boot` package beside this one.

## Build and stage

Expand Down Expand Up @@ -39,6 +39,16 @@ The logind drop-in `/usr/lib/systemd/logind.conf.d/20-omarchy-mac-sleep-key.conf

Vendor defaults use NetworkManager's `/usr/lib/NetworkManager/conf.d`, systemd's `/usr/lib/systemd` and `/usr/lib/tmpfiles.d`, modprobe's `/usr/lib/modprobe.d`, and WirePlumber's `/usr/share/wireplumber/wireplumber.conf.d`. Same-name `/etc` or user fragments retain precedence. iwd has no vendor directory, so an `iwd.service` drop-in lists `/usr/lib/omarchy-mac/iwd` after `/etc/iwd`; iwd loads the first `main.conf` it can read, so an `/etc/iwd/main.conf` replaces the Apple one whole. The Apple default keeps iwd off 6 GHz: on the BCM4388 a join the firmware makes to a 6 GHz access point reports connected and authorized, yet the access point drops everything the Mac sends and DHCP never completes, so a network that also offers 5 GHz joins there instead. The firmware's own roaming can still move a weak connection onto 6 GHz, and `omarchy network band 6` cannot reach 6 GHz. Like the backend, it applies when iwd next starts: setup restarts nothing, so an upgraded Mac keeps 6 GHz until it reboots. Setup reports effective live NetworkManager/module configuration and systemd fragments. Review those reports and any drop-ins when diagnosing overrides; custom policy is never normalized to the package default.

## J715 Touch ID and SDDM login

J715 (the 15-inch M4 Air, `apple,j715` and `apple,t8132`) additionally needs a kernel with the J715 nonce-session support and this Mac's own installed 10848-byte FDR MSRk body at `apple/msrk-j715.bin`. Its FSC2 calibration must already be installed under the sensor node's `firmware-name`, or `apple/mesa_calibration.bin` when the node omits it. There is no automatic extraction path for this board: the older calibration carve and the Neo's root-key envelope are not substitutes. Eligibility checks the files without reading or copying the key; enablement checks the existing body's observed size before it records consent or loads the driver. A length check does not authenticate the body: it must already have been acquired and verified for this Mac, and the enclave decides whether to accept it. Keep the key root-only. This package neither distributes private factory data nor recreates or resets existing enrollments.

The existing consent-gated boot service loads the driver before the display manager and fprintd. Its failure does not prevent password login. An already enrolled fingerprint still needs the driver's successful restore and matching diagnostics on the new boot; same-boot enrollment alone does not prove that.

Where SDDM is installed, enabling Touch ID also adds an authentication include to its stock `system-login` PAM stack. The include preserves shell, nologin and account-lock checks, accepts a fingerprint, and otherwise continues to the original password stack after at most three attempts or ten seconds. Account, password and session management remain the original SDDM configuration. The helper refuses custom authentication rules, symlinks and edited owned policy rather than overwriting them. Disabling Touch ID removes only its own include and restores the original bytes. No SDDM restart is needed. Fingerprint login does not unlock a password-encrypted keyring or the LUKS root volume.

The earlier J715 port has restored an existing Linux enrollment after a complete shutdown and power-on and completed an SDDM fingerprint login. The login keyring still required a separate unlock. This does not qualify the current upstream kernel or concurrent camera operation. The offline PAM tests exercise libpam itself, including password fallback and denied accounts; they do not replace hardware checks on the matching kernel. Release this support only after that kernel and the userspace driver are available and qualified together.

## Video decode in mpv

mpv has no vendor configuration directory and decodes in software unless told otherwise. The package ships its Apple default as `/usr/share/omarchy-mac/mpv/mpv.conf` and a systemd-tmpfiles rule that copies it to `/etc/mpv/mpv.conf` only when that file is missing. pacman's systemd hook applies the rule when the package is installed or upgraded, and boot applies it again. An existing `/etc/mpv/mpv.conf` is never overwritten, with one exception: `omarchy-mac-setup-system` replaces a regular file byte-identical to the earlier default, which lacks `gpu-sw=yes`, with the current default, and leaves an edited copy or a link alone. An upgrade alone does not apply this, because neither `omarchy update` nor a pacman upgrade runs setup: run `sudo omarchy-mac-setup-system`, or rerun hardware setup, to apply it. So edit it rather than delete it to change the system default; each user's `~/.config/mpv/mpv.conf` is read after it and wins, and `hwdec=no` there decodes in software.
Expand Down
1 change: 1 addition & 0 deletions omarchy-mac/entrypoints/disable-fingerprint
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ elif ! flock -w 300 "$lock_fd"; then
exit 1
fi

/usr/lib/omarchy-mac/touchid-sddm disable || exit 1
Comment thread
audreyt marked this conversation as resolved.
Resolved
key=/usr/lib/firmware/updates/apple/msrk-j700.bin
if [[ -e /etc/omarchy-mac/touchid-on || -e /etc/modprobe.d/omarchy-mac-touchid.conf || -e $key || -e $key.new ]]; then
# A record left behind, on a read-only root say, loads the driver again.
Expand Down
38 changes: 20 additions & 18 deletions omarchy-mac/entrypoints/enable-fingerprint
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,32 @@ if [[ -e /etc/omarchy-mac/touchid-on ]]; then
# whatever its status: on a kernel that loads the driver read-only, the
# options are what lets it reach ready after a restart.
options=/etc/modprobe.d/omarchy-mac-touchid.conf
if [[ ! -e $options ]]; then
# Under the Touch ID lock, so a removal running now can't be undone here.
lock=/run/omarchy-mac/touchid.lock
if ! { mkdir -p -m 0755 "${lock%/*}" && exec {lock_fd}>>"$lock"; } 2>/dev/null || ! flock -w 300 "$lock_fd"; then
echo "Touch ID's driver options could not be written: another Touch ID setup or removal is still running." >&2
exit 1
fi
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%/*}" &&
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" &&
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
exec {lock_fd}>&-
# Options and login policy share the setup/removal lock.
lock=/run/omarchy-mac/touchid.lock
if ! { mkdir -p -m 0755 "${lock%/*}" && exec {lock_fd}>>"$lock"; } 2>/dev/null || ! flock -w 300 "$lock_fd"; then
echo "Touch ID's driver options could not be written: another Touch ID setup or removal is still running." >&2
exit 1
fi
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%/*}" &&
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" &&
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
# The owner agreed already, so they are never asked again: a Touch ID that
# isn't ready yet needs a restart, and setup goes on with any other reader.
if [[ $status != "ready" ]]; then
echo "Touch ID is turned on but isn't ready yet ($recorded_status)."
echo "Restart this Mac, then set up the fingerprint again. If it still isn't"
echo "ready, see journalctl -u omarchy-mac-touchid-activate."
else
/usr/lib/omarchy-mac/touchid-sddm enable || exit 1
fi
exec {lock_fd}>&-
exit 0
fi
# Only a Touch ID that can be set up stops the setup: anywhere else it goes on,
Expand Down Expand Up @@ -100,6 +100,8 @@ echo "Turning Touch ID off later removes your fingerprints and stops the driver"
echo "loading. The key store stays."
echo
echo "This applies to every user on this Mac and needs an administrator."
echo "On a stock SDDM login screen, fingerprints also work for login; the"
echo "password remains available. A custom SDDM PAM configuration is kept."
echo "Saying no leaves Touch ID off. You can turn it on later from"
echo "Setup > Security > Fingerprint."
echo
Expand Down
11 changes: 9 additions & 2 deletions omarchy-mac/lib/touchid-eligibility
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ if compatible apple,t8103 || compatible apple,t6000 || compatible apple,t6001; t
echo unsupported:m1-family
exit 0
elif ! compatible apple,t8112 && ! compatible apple,t6020 && ! compatible apple,t6021 && ! compatible apple,t8140 &&
! { compatible apple,t8122 && { compatible apple,j613 || compatible apple,j615; }; }; then
! { compatible apple,t8122 && { compatible apple,j613 || compatible apple,j615; }; } &&
! { compatible apple,t8132 && compatible apple,j715; }; then
echo unsupported:board
exit 0
fi
Expand All @@ -68,7 +69,7 @@ calibration=apple/mesa_calibration.bin
if [[ -r $sensor/firmware-name ]]; then
calibration=$(tr -d '\0' <"$sensor/firmware-name")
fi
if ! installed "$calibration" && { compatible apple,t8140 || ! can_extract extract-mesa-calibration; }; then
if ! installed "$calibration" && { compatible apple,t8140 || compatible apple,t8132 || ! can_extract extract-mesa-calibration; }; then
echo unsupported:no-calibration
exit 0
Comment thread
audreyt marked this conversation as resolved.
Resolved
fi
Expand All @@ -79,4 +80,10 @@ if compatible apple,t8140 && ! installed apple/msrk-j700.bin &&
echo unsupported:no-root-key
exit 0
fi
# J715 needs its own FDR MSRk and FSC2, not the Neo's reconstructed key or
# the older calibration an extractor can find in the system container.
if compatible apple,t8132 && ! installed apple/msrk-j715.bin; then
echo unsupported:no-root-key
exit 0
fi

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed: eligibility now checks metadata for every present J715 key candidate, requiring a regular readable 10848-byte file and rejecting malformed shadows even beside a good copy. No private body is read. The new cases fail on the old helper; the calibration/key suite now passes 50 cases, including missing files, valid symlinks and unchanged non-J715 rules.

Fixed in 1e20d4c.

echo available
20 changes: 20 additions & 0 deletions omarchy-mac/lib/touchid-enable
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ container=${OMARCHY_MAC_TOUCHID_CONTAINER:-/dev/disk/by-partlabel/iBootSystemCon
python=${OMARCHY_MAC_TOUCHID_PYTHON:-python3}
lock_wait=${OMARCHY_MAC_TOUCHID_LOCK_WAIT:-300}
omarchy-hw-apple-silicon || exit 0
j715=0
if tr '\0' '\n' <"$tree/compatible" | grep -Fxq apple,t8132; then
j715=1
fi

# Once this run records the agreement, a failure takes it back, so a Touch ID
# that never came up doesn't load at every boot and is offered again after a
Expand Down Expand Up @@ -87,6 +91,18 @@ fi

eligibility=$("$helpers/touchid-eligibility")
[[ $eligibility == "available" ]] || fail "this Mac can't use it yet ($eligibility)"
if (( j715 )); then
found=0
for directory in "$firmware" "$firmware/vendor" "$firmware/updates"; do
key=$directory/apple/msrk-j715.bin
if [[ -e $key ]]; then
[[ -f $key && -r $key && $(wc -c <"$key") == 10848 ]] ||
fail "this Mac's FDR sensor key at $key must be a readable 10848-byte body"
found=1
fi
done
(( found )) || fail "this Mac's own FDR sensor key must be installed before enabling Touch ID"
fi

# Factory data from this Mac's own iBoot System Container, never another's.
sensor=$("$helpers/touchid-eligibility" sensor)
Expand Down Expand Up @@ -157,6 +173,10 @@ if [[ $(cat "$status_file" 2>/dev/null) == "ready" ]]; then
# An fprintd that started without the reader found none and kept no
# allowance for its node, so it starts again with both.
systemctl try-restart fprintd.service 2>/dev/null
if ! "$python" -I "$helpers/touchid-sddm" enable; then
echo "Touch ID is on, but SDDM's existing PAM configuration was left unchanged." >&2
exit 1
fi
echo "Touch ID is on."
exit 0
elif (( preloaded )); then
Expand Down
136 changes: 136 additions & 0 deletions omarchy-mac/lib/touchid-sddm
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
#!/usr/bin/python3 -I
# SPDX-License-Identifier: MIT
"""Add or remove Touch ID in a stock SDDM PAM stack under the Touch ID lock."""

import os
from pathlib import Path
import stat
import subprocess
import sys
import tempfile

PREFIX = "# omarchy-mac Touch ID\n" "auth include omarchy-mac-touchid\n"
POLICY = """#%PAM-1.0
auth requisite pam_shells.so
auth requisite pam_nologin.so
auth required pam_faillock.so preauth
auth sufficient pam_fprintd.so max-tries=3 timeout=10
"""
AUTH = {
("auth", "include", "system-login"),
("-auth", "optional", "pam_gnome_keyring.so"),
("-auth", "optional", "pam_kwallet5.so"),
("-auth", "optional", "pam_kwallet6.so"),
}
LOGIN_AUTH = [
("auth", "required", "pam_shells.so"),
("auth", "requisite", "pam_nologin.so"),
("auth", "include", "system-auth"),
]
SYSTEM_AUTH = [
("auth", "required", "pam_faillock.so", "preauth"),
("-auth", "[success=2", "default=ignore]", "pam_systemd_home.so"),
("auth", "[success=1", "default=bad]", "pam_unix.so", "try_first_pass", "nullok"),
("auth", "[default=die]", "pam_faillock.so", "authfail"),
("auth", "optional", "pam_permit.so"),
("auth", "required", "pam_env.so"),
("auth", "required", "pam_faillock.so", "authsucc"),
]


class Refused(Exception):
"""The existing PAM configuration is not one this helper owns."""


def read_regular(path: Path) -> str | None:
try:
mode = path.lstat().st_mode
except FileNotFoundError:
return None
if not stat.S_ISREG(mode):
raise Refused(f"{path} is not a regular file")
with path.open(encoding="utf-8", newline="") as stream:
return stream.read()


def write_atomic(path: Path, content: str) -> None:
fd, temporary = tempfile.mkstemp(prefix=f".{path.name}.", dir=path.parent)
try:
with os.fdopen(fd, "w", encoding="utf-8", newline="\n") as stream:
stream.write(content)
stream.flush()
os.fchmod(stream.fileno(), 0o644)
os.fsync(stream.fileno())
os.replace(temporary, path)
finally:
Path(temporary).unlink(missing_ok=True)


def auth_lines(content: str) -> list[tuple[str, ...]]:
auth: list[tuple[str, ...]] = []
for line in content.splitlines():
fields = line.split()
if not fields or fields[0].startswith("#"):
continue
kind = fields[0].lower()
if kind in ("auth", "-auth"):
auth.append(tuple(fields))
elif kind not in ("account", "-account", "password", "-password", "session", "-session"):
raise Refused("unrecognized PAM module type")
return auth


def configure(directory: Path, enable: bool) -> None:
if not directory.exists():
return
if not stat.S_ISDIR(directory.lstat().st_mode):
raise Refused(f"{directory} is not a regular directory")
sddm = directory / "sddm"
policy = directory / "omarchy-mac-touchid"
original = read_regular(sddm)
existing_policy = read_regular(policy)
if existing_policy not in (None, POLICY):
raise Refused(f"{policy} was changed; leaving it alone")
if original is None:
return
active = original.startswith(PREFIX)
original = original.removeprefix(PREFIX)
if "omarchy-mac-touchid" in original:
raise Refused(f"{sddm} has a custom Touch ID entry")
if enable:
auth = auth_lines(original)
if auth.count(("auth", "include", "system-login")) != 1 or any(
entry not in AUTH for entry in auth):
raise Refused(f"{sddm} is not the stock system-login stack")
for name, expected in (("system-login", LOGIN_AUTH), ("system-auth", SYSTEM_AUTH)):
content = read_regular(directory / name)
if content is None or auth_lines(content) != expected:
raise Refused(f"{directory / name} has custom authentication requirements")
if existing_policy is None:
write_atomic(policy, POLICY)
if not active:
write_atomic(sddm, PREFIX + original)
else:
if active:
write_atomic(sddm, original)
if existing_policy is not None:
policy.unlink()


def main() -> int:
if subprocess.run(["omarchy-hw-apple-silicon"], check=False).returncode != 0:
return 0
if len(sys.argv) != 2 or sys.argv[1] not in ("enable", "disable"):
print("Usage: touchid-sddm enable|disable", file=sys.stderr)
return 2
directory = Path(os.environ.get("OMARCHY_MAC_TOUCHID_PAM", "/etc/pam.d"))
try:
configure(directory, sys.argv[1] == "enable")
except (OSError, UnicodeError, Refused) as error:
print(f"touchid-sddm: {error}", file=sys.stderr)
return 1
return 0


if __name__ == "__main__":
sys.exit(main())
Loading