Skip to content

Commit d29be15

Browse files
mtrmacAl Viro
authored and
Al Viro
committed
Audit: add support to match lsm labels on user audit messages
Add support for matching by security label (e.g. SELinux context) of the sender of an user-space audit record. The audit filter code already allows user space to configure such filters, but they were ignored during evaluation. This patch implements evaluation of these filters. For example, after application of this patch, PAM authentication logs caused by cron can be disabled using auditctl -a user,never -F subj_type=crond_t Signed-off-by: Miloslav Trmac <mitr@redhat.com> Acked-by: Eric Paris <eparis@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 2d10d87 commit d29be15

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

kernel/auditfilter.c

+12
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,18 @@ static int audit_filter_user_rules(struct netlink_skb_parms *cb,
12521252
case AUDIT_LOGINUID:
12531253
result = audit_comparator(cb->loginuid, f->op, f->val);
12541254
break;
1255+
case AUDIT_SUBJ_USER:
1256+
case AUDIT_SUBJ_ROLE:
1257+
case AUDIT_SUBJ_TYPE:
1258+
case AUDIT_SUBJ_SEN:
1259+
case AUDIT_SUBJ_CLR:
1260+
if (f->lsm_rule)
1261+
result = security_audit_rule_match(cb->sid,
1262+
f->type,
1263+
f->op,
1264+
f->lsm_rule,
1265+
NULL);
1266+
break;
12551267
}
12561268

12571269
if (!result)

0 commit comments

Comments
 (0)