Skip to content

Commit 935c9e7

Browse files
rgbriggspcmoore
authored andcommitted
audit: log failed attempts to change audit_pid configuration
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> Signed-off-by: Paul Moore <pmoore@redhat.com>
1 parent 133e1e5 commit 935c9e7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

kernel/audit.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -882,11 +882,15 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
882882
int new_pid = s.pid;
883883
pid_t requesting_pid = task_tgid_vnr(current);
884884

885-
if ((!new_pid) && (requesting_pid != audit_pid))
885+
if ((!new_pid) && (requesting_pid != audit_pid)) {
886+
audit_log_config_change("audit_pid", new_pid, audit_pid, 0);
886887
return -EACCES;
888+
}
887889
if (audit_pid && new_pid &&
888-
audit_replace(requesting_pid) != -ECONNREFUSED)
890+
audit_replace(requesting_pid) != -ECONNREFUSED) {
891+
audit_log_config_change("audit_pid", new_pid, audit_pid, 0);
889892
return -EEXIST;
893+
}
890894
if (audit_enabled != AUDIT_OFF)
891895
audit_log_config_change("audit_pid", new_pid, audit_pid, 1);
892896
audit_pid = new_pid;

0 commit comments

Comments
 (0)