aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOndrej Mosnáček <omosnace@redhat.com>2018-05-30 04:45:24 -0400
committerPaul Moore <paul@paul-moore.com>2018-06-19 09:33:42 -0400
commit29c1372d6a9b872acf479ba2744e4e7f043981c0 (patch)
tree05bbfde74456e7b8aaccd618a5c05dd5cc10d02c
parentce397d215ccd07b8ae3f71db689aedb85d56ab40 (diff)
audit: allow other filter list types for AUDIT_EXE
This patch removes the restriction of the AUDIT_EXE field to only SYSCALL filter and teaches audit_filter to recognize this field. This makes it possible to write rule lists such as: auditctl -a exit,always [some general rule] # Filter out events with executable name /bin/exe1 or /bin/exe2: auditctl -a exclude,always -F exe=/bin/exe1 auditctl -a exclude,always -F exe=/bin/exe2 See: https://github.com/linux-audit/audit-kernel/issues/54 Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com> Reviewed-by: Richard Guy Briggs <rgb@redhat.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
-rw-r--r--kernel/auditfilter.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index eaa320148d97..6db9847ca031 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -428,8 +428,6 @@ static int audit_field_valid(struct audit_entry *entry, struct audit_field *f)
428 case AUDIT_EXE: 428 case AUDIT_EXE:
429 if (f->op != Audit_not_equal && f->op != Audit_equal) 429 if (f->op != Audit_not_equal && f->op != Audit_equal)
430 return -EINVAL; 430 return -EINVAL;
431 if (entry->rule.listnr != AUDIT_FILTER_EXIT)
432 return -EINVAL;
433 break; 431 break;
434 } 432 }
435 return 0; 433 return 0;
@@ -1360,6 +1358,11 @@ int audit_filter(int msgtype, unsigned int listtype)
1360 f->type, f->op, f->lsm_rule, NULL); 1358 f->type, f->op, f->lsm_rule, NULL);
1361 } 1359 }
1362 break; 1360 break;
1361 case AUDIT_EXE:
1362 result = audit_exe_compare(current, e->rule.exe);
1363 if (f->op == Audit_not_equal)
1364 result = !result;
1365 break;
1363 default: 1366 default:
1364 goto unlock_and_return; 1367 goto unlock_and_return;
1365 } 1368 }