From: Steve Grubb <sgrubb@redhat.com>
To: Richard Guy Briggs <rgb@redhat.com>, Paul Moore <pmoore@redhat.com>
Cc: linux-audit@redhat.com
Subject: Re: [PATCH] filterexcl: allow filterkey
Date: Mon, 12 Jun 2017 20:05:46 -0400 [thread overview]
Message-ID: <1743418.zptp8gkKzQ@x2> (raw)
In-Reply-To: <1491302362-1302-1-git-send-email-rgb@redhat.com>
On Tuesday, April 4, 2017 6:39:22 AM EDT Richard Guy Briggs wrote:
> The exclude rules did not permit a filterkey to be added. This isn't as
> important for the exclude filter compared to the others since no records are
> generated with that key, but still helps identify rules in the rules list
> configuration.
How long ago did thkernel start allowing this? I'm trying to decide if this is
generally applicable or needs some kind of versioning.
Thanks,
-Steve
> Allow filterkeys to be used with the exclude filter.
>
> See: https://github.com/linux-audit/audit-userspace/issues/14
>
> Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
> ---
> lib/libaudit.c | 13 +++++++++++--
> lib/private.h | 1 +
> src/auditctl.c | 5 +++--
> 3 files changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/lib/libaudit.c b/lib/libaudit.c
> index b1f8f9c..028483d 100644
> --- a/lib/libaudit.c
> +++ b/lib/libaudit.c
> @@ -85,6 +85,7 @@ int _audit_permadded = 0;
> int _audit_archadded = 0;
> int _audit_syscalladded = 0;
> int _audit_exeadded = 0;
> +int _audit_filterexcladded = 0;
> unsigned int _audit_elf = 0U;
> static struct libaudit_conf config;
>
> @@ -1445,8 +1446,14 @@ int audit_rule_fieldpair_data(struct audit_rule_data
> **rulep, const char *pair, if (flags == AUDIT_FILTER_EXCLUDE) {
> uint32_t features = audit_get_features();
> if ((features & AUDIT_FEATURE_BITMAP_EXCLUDE_EXTEND) == 0) {
> - if (field != AUDIT_MSGTYPE)
> + switch(field) {
> + case AUDIT_MSGTYPE:
> + _audit_filterexcladded = 1;
> + case AUDIT_FILTERKEY:
> + break;
> + default:
> return -EAU_FIELDNOSUPPORT;
> + }
> } else {
> switch(field) {
> case AUDIT_PID:
> @@ -1459,6 +1466,8 @@ int audit_rule_fieldpair_data(struct audit_rule_data
> **rulep, const char *pair, case AUDIT_SUBJ_TYPE:
> case AUDIT_SUBJ_SEN:
> case AUDIT_SUBJ_CLR:
> + _audit_filterexcladded = 1;
> + case AUDIT_FILTERKEY:
> break;
> default:
> return -EAU_MSGTYPECREDEXCLUDE;
> @@ -1580,7 +1589,7 @@ int audit_rule_fieldpair_data(struct audit_rule_data
> **rulep, const char *pair, }
> if (field == AUDIT_FILTERKEY &&
> !(_audit_syscalladded || _audit_permadded ||
> - _audit_exeadded))
> + _audit_exeadded || _audit_filterexcladded))
> return -EAU_KEYDEP;
> vlen = strlen(v);
> if (field == AUDIT_FILTERKEY &&
> diff --git a/lib/private.h b/lib/private.h
> index cde1906..855187b 100644
> --- a/lib/private.h
> +++ b/lib/private.h
> @@ -139,6 +139,7 @@ extern int _audit_permadded;
> extern int _audit_archadded;
> extern int _audit_syscalladded;
> extern int _audit_exeadded;
> +extern int _audit_filterexcladded;
> extern unsigned int _audit_elf;
>
> #ifdef __cplusplus
> diff --git a/src/auditctl.c b/src/auditctl.c
> index 04765f4..c785087 100644
> --- a/src/auditctl.c
> +++ b/src/auditctl.c
> @@ -74,6 +74,7 @@ static int reset_vars(void)
> _audit_permadded = 0;
> _audit_archadded = 0;
> _audit_exeadded = 0;
> + _audit_filterexcladded = 0;
> _audit_elf = 0;
> add = AUDIT_FILTER_UNSET;
> del = AUDIT_FILTER_UNSET;
> @@ -936,8 +937,8 @@ static int setopt(int count, int lineno, char *vars[])
> break;
> case 'k':
> if (!(_audit_syscalladded || _audit_permadded ||
> - _audit_exeadded) || (add==AUDIT_FILTER_UNSET &&
> - del==AUDIT_FILTER_UNSET)) {
> + _audit_exeadded || _audit_filterexcladded) ||
> + (add==AUDIT_FILTER_UNSET && del==AUDIT_FILTER_UNSET)) {
> audit_msg(LOG_ERR,
> "key option needs a watch or syscall given prior to it");
> retval = -1;
next prev parent reply other threads:[~2017-06-13 0:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-04 10:39 [PATCH] filterexcl: allow filterkey Richard Guy Briggs
2017-06-13 0:05 ` Steve Grubb [this message]
2017-06-13 2:47 ` Richard Guy Briggs
2017-06-13 18:46 ` Richard Guy Briggs
2017-06-13 19:39 ` Steve Grubb
2017-06-13 19:58 ` Richard Guy Briggs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1743418.zptp8gkKzQ@x2 \
--to=sgrubb@redhat.com \
--cc=linux-audit@redhat.com \
--cc=pmoore@redhat.com \
--cc=rgb@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.