Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ __pycache__/
/fido/aurora-fido
/luks/aurora-sep-fde
/luks/pam_aurora_sep_fde.so
/fido/aurora-passkeyd
/fido/aurora-passkeyd.service.out
57 changes: 56 additions & 1 deletion docs/fido.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,61 @@ available when per-user, password-keyed key bags land (below).
token with the credential-management permission takes a touch when it is
issued.

### Per-user credentials (preview, `vault = user`)

With `[authenticator] vault = user`, aurora-fidod keeps only the uhid device
and the CTAPHID framing. It forwards each CTAP2 request to `aurora-passkeyd`
(a user unit) of the user who owns the active local session on seat0, the
same user the hidraw `uaccess` ACL follows. That agent keeps the user's
credential records in `$XDG_DATA_HOME/aurora-passkeys` and makes the
`/dev/sep-key` calls as the user.

- The two talk over `$XDG_RUNTIME_DIR/aurora-passkeys/ctap.sock`
(SOCK_SEQPACKET): one request per connection, with "user present"
keepalives and cancel passed both ways.
- aurora-fidod checks that the socket's peer is that user. The agent accepts
only root (aurora-fidod) and its own user.
- With no active local user, or no agent running, nothing is signed:
getInfo still answers, and every other command gets
`CTAP2_ERR_OPERATION_DENIED`.
- U2F is not forwarded in this mode.

**Keys under your key bag (interface 4).** The agent needs `/dev/sep-key`
interface 4 (variant-5 key store: the Neo and the M4 Pro) and refuses to
start without it.

- **Credential keys** are `.userPresence` keys under the user's own key bag,
the bag whose secret is the login password. The enclave approves one of
these keys after a Touch ID match or after it has checked that password
itself. Root can ask the kernel to sign with such a key, but the enclave
still waits for the touch or the password. Nothing works while the bag is
locked (logged out, suspended).
- **The vault key**, 64 bytes that wrap credential IDs and records, is
sealed to a key with no list under the same bag (`vault.key`). It opens
with no touch while the bag is unlocked, and not at all while it is
locked. So the agent cannot start, and nobody can read the records, until
the user logs in. The agent unseals the vault key at the start of each
request and drops it at the end, so it is in memory only during a request
and only while the bag is unlocked. Python frees the key but cannot zero it.
- **The password route** exists only on the native front-end (`provider.py`,
for a credentials portal). A request may carry the login password, and the
enclave checks it in place of a touch: one call, no retries, and each
wrong password counts in the enclave (`CTAP2_ERR_PIN_INVALID`). CTAP over
hidraw has no route for it while clientPIN stays off.
- **Access to the device:** `/dev/sep-key` is root-only by default. For
per-user mode, give the user (or a group) access to it. The kernel lets a
non-root caller use only keys under that caller's own bag.

**Per-site rules.** `~/.config/aurora-passkeys/sites.conf` holds lines of
the form `site = policy`, for example `bank.example = touchid-or-password`. A
rule covers the site and every name under it, and the longest match wins.
The rule is written into the new credential's access-control list, so the
enclave enforces it. Changing a rule affects new credentials only. If the
kernel cannot make the key a rule asks for, the registration is refused
(`CTAP2_ERR_UNSUPPORTED_OPTION`); a weaker key is never made instead. Under a
user's bag the kernel makes `.userPresence` keys only, so biometric-only
rules (`touchid-any`, `touchid-current`) are refused there.

### Existing credentials (migration from 0.1)

aurora-fido 0.1 checked the touch in the daemon (fprintd, or a polkit
Expand Down Expand Up @@ -326,7 +381,7 @@ security key.

## Tests

make -C fido check # unit tests, no root, no hardware
make -C fido check # unit tests, no root, no hardware (agent tests: Linux)
sudo make -C fido check-uhid # real uhid device: libfido2, OpenSSH, pam_u2f, cryptenroll
make -C fido test/aurora-fido-seal && sudo make -C fido check-seal

Expand Down
3 changes: 3 additions & 0 deletions fido/90-aurora-passkeyd.preset
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: MIT
# Per-user passkey agent: opt in, installed off (see [authenticator] vault in aurora-fido.conf).
disable aurora-passkeyd.service
18 changes: 14 additions & 4 deletions fido/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@ PREFIX ?= /usr
LIBEXECDIR ?= $(PREFIX)/libexec/aurora-fido
PYDIR ?= $(PREFIX)/lib/aurora-fido
UNITDIR ?= $(PREFIX)/lib/systemd/system
USERUNITDIR ?= $(PREFIX)/lib/systemd/user
UDEVRULESDIR ?= $(PREFIX)/lib/udev/rules.d
SYSCONFDIR ?= /etc
DOCDIR ?= $(PREFIX)/share/doc/aurora-fido
BINDIR ?= $(PREFIX)/bin
PRESETDIR ?= $(PREFIX)/lib/systemd/system-preset
USERPRESETDIR ?= $(PREFIX)/lib/systemd/user-preset

SEAL := aurora-fido-seal
SRC := aurora-fido-seal.c ../luks/sep-seal.c ../luks/sep-seal.h
PY := $(wildcard aurora_fido/*.py)

all: $(SEAL) aurora-fidod aurora-fido aurora-fido.service.out
all: $(SEAL) aurora-fidod aurora-fido aurora-passkeyd aurora-fido.service.out aurora-passkeyd.service.out

$(SEAL): $(SRC)
$(CC) $(CFLAGS) $(DEPS_CFLAGS) -fPIE -pie -Wl,-z,relro,-z,now -o $@ \
Expand All @@ -39,18 +41,23 @@ test/$(SEAL): $(SRC)

# Generated from the install paths: always regenerated (FORCE), so that
# `make install LIBEXECDIR=...` after a plain `make` never ships stale paths.
aurora-fidod aurora-fido: %: %.in FORCE
aurora-fidod aurora-fido aurora-passkeyd: %: %.in FORCE
sed -e 's|@PYDIR@|$(PYDIR)|' -e 's|@LIBEXECDIR@|$(LIBEXECDIR)|' -e 's|@DOCDIR@|$(DOCDIR)|' $< > $@
chmod 755 $@

aurora-fido.service.out: aurora-fido.service FORCE
aurora-fido.service.out aurora-passkeyd.service.out: %.service.out: %.service FORCE
sed 's|@LIBEXECDIR@|$(LIBEXECDIR)|' $< > $@

FORCE:

# Unit tests: no root, no hardware (software keys with a scripted enclave touch).
check:
$(PYTHON) tests/test_ctap.py
$(PYTHON) tests/test_agent.py
$(PYTHON) tests/test_provider.py
if command -v dbus-run-session >/dev/null 2>&1; then \
dbus-run-session -- $(PYTHON) tests/test_dbus_provider.py; \
else $(PYTHON) tests/test_dbus_provider.py; fi

# As root: the real uhid device with libfido2, OpenSSH, pam_u2f, cryptenroll.
check-uhid:
Expand All @@ -63,6 +70,9 @@ check-seal: test/$(SEAL)
install: all
install -Dm755 aurora-fidod $(DESTDIR)$(LIBEXECDIR)/aurora-fidod
install -Dm755 aurora-fido $(DESTDIR)$(BINDIR)/aurora-fido
install -Dm755 aurora-passkeyd $(DESTDIR)$(LIBEXECDIR)/aurora-passkeyd
install -Dm644 aurora-passkeyd.service.out $(DESTDIR)$(USERUNITDIR)/aurora-passkeyd.service
install -Dm644 90-aurora-passkeyd.preset $(DESTDIR)$(USERPRESETDIR)/90-aurora-passkeyd.preset
install -Dm644 90-aurora-fido.preset $(DESTDIR)$(PRESETDIR)/90-aurora-fido.preset
install -Dm755 $(SEAL) $(DESTDIR)$(LIBEXECDIR)/$(SEAL)
for f in $(PY); do install -Dm644 $$f $(DESTDIR)$(PYDIR)/$$f; done
Expand All @@ -72,6 +82,6 @@ install: all
install -Dm644 ../docs/fido.md $(DESTDIR)$(DOCDIR)/fido.md

clean:
rm -rf $(SEAL) test aurora-fidod aurora-fido aurora-fido.service.out aurora_fido/__pycache__ tests/__pycache__
rm -rf $(SEAL) test aurora-fidod aurora-fido aurora-passkeyd aurora-fido.service.out aurora-passkeyd.service.out aurora_fido/__pycache__ tests/__pycache__

.PHONY: all check check-uhid check-seal install clean FORCE
12 changes: 12 additions & 0 deletions fido/aurora-fido.conf
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,20 @@ attestation = self
max_resident = 256
# Answer CTAP1/U2F requests too.
u2f = yes
# Whose credentials: "system" keeps them in /var/lib/aurora-fido. "user" (preview)
# forwards each request to the passkey agent of the user active on seat0
# (aurora-passkeyd, a user unit); it needs /dev/sep-key interface 4, and has no U2F.
vault = system

[keys]
# Where credential keys live: the Secure Enclave (/dev/sep-key), always.
# "auto" and "sep-key" mean the same; there is no other store.
store = auto

[native]
# Per-user mode only: aurora-passkeyd also serves the native (platform
# authenticator) front-end on the session bus as org.aurora.Passkeys1.
# Bus names allowed to call it, separated by spaces (a credentials portal).
# Empty: any process of the user, which can reach the security key through
# hidraw anyway.
portal_names =
9 changes: 9 additions & 0 deletions fido/aurora-passkeyd.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/python3 -I
# SPDX-License-Identifier: MIT
# aurora-passkeyd: one user's passkeys, kept and used as that user (per-user vault mode).
import sys

sys.path.insert(0, "@PYDIR@")
from aurora_fido import agent # noqa: E402

sys.exit(agent.main())
20 changes: 20 additions & 0 deletions fido/aurora-passkeyd.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# SPDX-License-Identifier: MIT
# User unit. Used when aurora-fido.conf has [authenticator] vault = user:
# aurora-fidod (system) forwards each request to this agent of the active user.
[Unit]
Description=Aurora passkeys (this user's Secure Enclave credentials)
Documentation=file:///usr/share/doc/aurora-fido/fido.md

[Service]
Type=simple
ExecStart=@LIBEXECDIR@/aurora-passkeyd
Restart=on-failure
RestartSec=5
UMask=0077
PrivateNetwork=yes
RestrictAddressFamilies=AF_UNIX
LockPersonality=yes
NoNewPrivileges=yes

[Install]
WantedBy=default.target
Loading
Loading