Adding support for MAC_TASK_CONTEXTS and MAC_OBJ_CONTEXTS to userspace.

Casey Schaufler casey at schaufler-ca.com
Mon Jun 14 19:34:33 UTC 2021


I'm looking at the audit userspace implications of adding two
new kernel audit records. AUDIT_MAC_TASK_CONTEXTS and
AUDIT_MAC_OBJ_CONTEXTS are used when there are multiple security
modules with a "security context" active on the system. This
design has been discussed here at length. The records will look
like:

	AUDIT_MAC_TASK_CONTEXTS
	subj_<lsmname>=value
	subj_<lsmname>=value
	...

Looking at the audit user-space code I see several things
that have me concerned. The first is the use of WITH_APPARMOR.
Going forward what behavior would we want if subj_apparmor=something
shows up on a system that has not got WITH_APPARMOR defined?
The code is inconsistent in that it does not use WITH_SELINUX,
but that's hardly a surprise given its origins. There is also no
WITH_SMACK, but that's unlikely to be an issue since Smack's use
of audit is very much like SELinux's. The question is what to
do about filtering when subj=foo is specified. I suggest that if
any of subj_selinux, subj_smack or subj_something is "foo", it is
a match. But the SELinux components of a label (level, user, ...)
are also available for filtering. If someone wrote a simple Bell &
LaPadula LSM filtering by some of those fields could be useful
there, too.

I would like guidance on whether I ought to go the route of
more extensive use of WITH_APPARMOR (and WITH_SMACK, WITH_MUMBLE)
or take the path of greater generalization. Or, whether I should
treat each case individually and give it my best whack.

Thank you.






More information about the Linux-audit mailing list