linux-audit.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Paul Moore <pmoore@redhat.com>
To: Richard Guy Briggs <rgb@redhat.com>
Cc: v.rathor@gmail.com, linux-kernel@vger.kernel.org, linux-audit@redhat.com
Subject: Re: [PATCH 2/2] audit: log failed attempts to change audit_pid configuration
Date: Thu, 24 Sep 2015 16:12:18 -0400	[thread overview]
Message-ID: <3543168.OGyCZ6dDtT@sifl> (raw)
In-Reply-To: <1897d9f5007c4212aac4095b7fa2491e44cc880f.1442494593.git.rgb@redhat.com>

On Friday, September 18, 2015 03:59:59 AM Richard Guy Briggs wrote:
> Failed attempts to change the audit_pid configuration are not presently
> logged.  One case is an attempt to starve an old auditd by starting up a
> new auditd when the old one is still alive and active.  The other case
> is an attempt to orphan a new auditd when an old auditd shuts down.
> 
> Log both as AUDIT_CONFIG_CHANGE messages with failure result.
> 
> Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
> ---
>  kernel/audit.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)

This patch tends to reinforce the idea of a hijack message instead of a ping 
message.  Unfortunately, we can't use audit_log_config_change() to generate 
the hijack message as it queues the record, but you get the idea.

> diff --git a/kernel/audit.c b/kernel/audit.c
> index 3399ab2..65dcd45 100644
> --- a/kernel/audit.c
> +++ b/kernel/audit.c
> @@ -883,12 +883,16 @@ static int audit_receive_msg(struct sk_buff *skb,
> struct nlmsghdr *nlh) pid_t requesting_pid = task_tgid_vnr(current);
>  			u32 portid = NETLINK_CB(skb).portid;
> 
> -			if ((!new_pid) && (requesting_pid != audit_pid))
> +			if ((!new_pid) && (requesting_pid != audit_pid)) {
> +				audit_log_config_change("audit_pid", new_pid, audit_pid, 0);
>  				return -EACCES;
> +			}
>  			if (audit_pid && new_pid &&
>  			    audit_ping(requesting_pid, nlmsg_hdr(skb)->nlmsg_seq, portid) 
!=
> -			    -ECONNREFUSED)
> +			    -ECONNREFUSED) {
> +				audit_log_config_change("audit_pid", new_pid, audit_pid, 0);
>  				return -EEXIST;
> +			}
>  			if (audit_enabled != AUDIT_OFF)
>  				audit_log_config_change("audit_pid", new_pid, audit_pid, 1);
>  			audit_pid = new_pid;

-- 
paul moore
security @ redhat

  reply	other threads:[~2015-09-24 20:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-18  7:59 [PATCH 1/2] audit: stop an old auditd being starved out by a new auditd Richard Guy Briggs
2015-09-18  7:59 ` [PATCH 2/2] audit: log failed attempts to change audit_pid configuration Richard Guy Briggs
2015-09-24 20:12   ` Paul Moore [this message]
2015-09-24 20:07 ` [PATCH 1/2] audit: stop an old auditd being starved out by a new auditd Paul Moore
2015-09-25 11:10   ` Richard Guy Briggs
2015-09-25 21:14     ` Paul Moore
2015-09-28 11:17       ` Richard Guy Briggs
2015-09-28 18:55         ` Paul Moore
2015-09-29  4:36           ` Richard Guy Briggs
2015-09-29 22:24             ` Paul Moore

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=3543168.OGyCZ6dDtT@sifl \
    --to=pmoore@redhat.com \
    --cc=linux-audit@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rgb@redhat.com \
    --cc=v.rathor@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).