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
15 changes: 14 additions & 1 deletion packages/aurora-sep/aurora-sep.spec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

Name: aurora-sep
Version: 1
Release: 17%{?dist}
Release: 18%{?dist}
Summary: SEP trusted-key and fingerprint integration for Aurora
License: GPL-2.0-only
URL: https://github.com/aurora-silicon/linux
Expand Down Expand Up @@ -133,6 +133,11 @@ fi
if selinuxenabled 2>/dev/null && [ -c /dev/sep-bio ]; then
restorecon /dev/sep-bio || :
fi
# The loader runs in its own domain from 1-18; label an installed copy now so
# the next boot starts it there.
if selinuxenabled 2>/dev/null && [ -f %{_libexecdir}/aurora-sep-load ]; then
restorecon %{_libexecdir}/aurora-sep-load || :
fi
# Move the driver's state files from var_lib_t to their own type. Only the
# labels change: the files are never moved, rewritten or removed.
if selinuxenabled 2>/dev/null; then
Expand Down Expand Up @@ -176,6 +181,14 @@ fi
%ghost %verify(not md5 size mode mtime) %{_sharedstatedir}/selinux/%{selinuxtype}/active/modules/200/%{modulename}

%changelog
* Tue Nov 03 2026 Ryan Murray <ryan@aurorasilicon.org> - 1-18
- SELinux: run aurora-sep-load in its own domain, aurora_sep_load_t, with the
same unconfined access it had as unconfined_service_t. Its probe keys then
carry that label, and a root process that lists /proc/keys while the probe
runs (the GDM session worker at an automatic login) is still denied view
of them, but the denial is no longer logged. This removes the boot AVC on
Macs where GDM starts before the probe ends.

* Mon Nov 02 2026 Ryan Murray <ryan@aurorasilicon.org> - 1-17
- SELinux: give the driver's state files in /var/lib their own type,
aurora_sep_state_t, label them so when the kernel creates them, relabel
Expand Down
2 changes: 2 additions & 0 deletions packages/aurora-sep/aurora_sep.fc
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
/var/lib/aurora-sep-refkey(-v2)?\.bin -- gen_context(system_u:object_r:aurora_sep_state_t,s0)
/var/lib/aurora-sep-host-state\.bin -- gen_context(system_u:object_r:aurora_sep_state_t,s0)
/var/lib/aurora-sep-xart-(owned|allow-once|policy-previous)\.bin -- gen_context(system_u:object_r:aurora_sep_state_t,s0)
/usr/libexec/aurora-sep-load -- gen_context(system_u:object_r:aurora_sep_load_exec_t,s0)
/usr/local/sbin/aurora-sep-load -- gen_context(system_u:object_r:aurora_sep_load_exec_t,s0)
21 changes: 20 additions & 1 deletion packages/aurora-sep/aurora_sep.te
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
policy_module(aurora_sep, 1.2.0)
policy_module(aurora_sep, 1.3.0)

########################################
#
Expand All @@ -19,6 +19,14 @@ dev_node(aurora_sep_device_t)
type aurora_sep_state_t;
files_type(aurora_sep_state_t)

# aurora-sep-load, which loads the driver and checks that the enclave seals
# and unseals a trusted key. It needs what the unconfined service domain gave
# it, so it stays unconfined; its own domain gives its probe keys their own
# label.
type aurora_sep_load_t;
type aurora_sep_load_exec_t;
init_daemon_domain(aurora_sep_load_t, aurora_sep_load_exec_t)

########################################
#
# Local policy
Expand Down Expand Up @@ -88,3 +96,14 @@ optional_policy(`

type_transition unconfined_t var_lib_t:file aurora_sep_state_t "aurora-sep-xart-allow-once.bin";
')

optional_policy(`
unconfined_domain(aurora_sep_load_t)
')

# The probe keys and their session keyring belong to the loader alone. A root
# process that lists /proc/keys while the probe runs, such as the GDM session
# worker at an automatic login, is asked for view on each of them: their user
# view bit lets the check reach SELinux, which denies it, and the listing
# leaves them out. That denial is the intended result, so do not log it.
dontaudit domain aurora_sep_load_t:key view;
18 changes: 18 additions & 0 deletions tests/test_aurora_sep_selinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,24 @@ def test_state_access_is_scoped(self):
self.assertEqual(allowed, {'kernel_t', 'init_t', 'fprintd_t', 'kmod_t'})
self.assertRegex(self.te, r'allow init_t aurora_sep_state_t:file read_file_perms;')

def test_the_loader_runs_in_its_own_domain(self):
for path in ('/usr/libexec/aurora-sep-load', '/usr/local/sbin/aurora-sep-load'):
hits = [c for r, k, c in self.contexts() if r.match(path)]
self.assertEqual(hits, ['gen_context(system_u:object_r:aurora_sep_load_exec_t,s0)'], path)
self.assertIn('init_daemon_domain(aurora_sep_load_t, aurora_sep_load_exec_t)', self.te)
self.assertRegex(self.te, r"optional_policy\(`\n\tunconfined_domain\(aurora_sep_load_t\)\n'\)")

def test_other_domains_only_stop_logging_the_view_of_probe_keys(self):
# Hiding the probe keys from /proc/keys listings is intended; only the
# log line goes. No domain gains any access to them.
self.assertEqual(re.findall(r'^dontaudit .*$', self.te, re.M),
['dontaudit domain aurora_sep_load_t:key view;'])
self.assertNotRegex(self.te, r'allow\s+\S+\s+\S+:key')

def test_upgrade_labels_an_installed_loader(self):
post = self.spec[self.spec.index('%posttrans selinux'):self.spec.index('%files')]
self.assertIn('restorecon %{_libexecdir}/aurora-sep-load', post)

def test_no_apostrophe_breaks_an_m4_quoted_block(self):
for block in re.findall(r"optional_policy\(`(.*?)\n'\)", self.te, re.S):
self.assertNotIn("'", block.replace("')", ''))
Expand Down
Loading