anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

Blame SOURCES/0117-journald-add-syslog-fields-for-audit-messages.patch

923a60
From 5e565da856cf4cf919ed1045b01ab461c586395a Mon Sep 17 00:00:00 2001
923a60
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
923a60
Date: Wed, 4 Mar 2015 10:31:42 -0500
923a60
Subject: [PATCH] journald: add syslog fields for audit messages
923a60
923a60
Audit messages would be displayed as "unknown[1]".
923a60
923a60
Also specify AUTH as facility... This seems to be the closest match
923a60
(/* security/authorization messages */).
923a60
923a60
(cherry picked from commit cd556b6ca8aec8dd371806afedec45f852f8f724)
923a60
---
923a60
 src/journal/journald-audit.c | 6 +++++-
923a60
 1 file changed, 5 insertions(+), 1 deletion(-)
923a60
923a60
diff --git a/src/journal/journald-audit.c b/src/journal/journald-audit.c
923a60
index 151097a6e6..77abe2e63c 100644
923a60
--- a/src/journal/journald-audit.c
923a60
+++ b/src/journal/journald-audit.c
923a60
@@ -373,7 +373,7 @@ static void process_audit_string(Server *s, int type, const char *data, size_t s
923a60
         if (isempty(p))
923a60
                 return;
923a60
 
923a60
-        n_iov_allocated = N_IOVEC_META_FIELDS + 5;
923a60
+        n_iov_allocated = N_IOVEC_META_FIELDS + 7;
923a60
         iov = new(struct iovec, n_iov_allocated);
923a60
         if (!iov) {
923a60
                 log_oom();
923a60
@@ -392,6 +392,10 @@ static void process_audit_string(Server *s, int type, const char *data, size_t s
923a60
         sprintf(id_field, "_AUDIT_ID=%" PRIu64, id);
923a60
         IOVEC_SET_STRING(iov[n_iov++], id_field);
923a60
 
923a60
+        assert_cc(32 == LOG_AUTH);
923a60
+        IOVEC_SET_STRING(iov[n_iov++], "SYSLOG_FACILITY=32");
923a60
+        IOVEC_SET_STRING(iov[n_iov++], "SYSLOG_IDENTIFIER=audit");
923a60
+
923a60
         m = alloca(strlen("MESSAGE=<audit-") + DECIMAL_STR_MAX(int) + strlen("> ") + strlen(p) + 1);
923a60
         sprintf(m, "MESSAGE=<audit-%i> %s", type, p);
923a60
         IOVEC_SET_STRING(iov[n_iov++], m);