Blame SOURCES/Log-when-non-root-ksu-authorization-fails.patch

d738b9
From d5f22f9982dca7fa157d1d9b7488a671e0df72b8 Mon Sep 17 00:00:00 2001
d738b9
From: Robbie Harwood <rharwood@redhat.com>
d738b9
Date: Mon, 7 May 2018 16:42:59 -0400
d738b9
Subject: [PATCH] Log when non-root ksu authorization fails
d738b9
d738b9
If non-root user attempts to ksu but is denied by policy, log to
d738b9
syslog at LOG_WARNING in keeping with other failure messages.
d738b9
d738b9
ticket: 8270
d738b9
(cherry picked from commit 6cfa5c113e981f14f70ccafa20abfa5c46b665ba)
d738b9
---
d738b9
 src/clients/ksu/main.c | 10 ++++++++++
d738b9
 1 file changed, 10 insertions(+)
d738b9
d738b9
diff --git a/src/clients/ksu/main.c b/src/clients/ksu/main.c
d738b9
index cab0c1806..7959a0cba 100644
d738b9
--- a/src/clients/ksu/main.c
d738b9
+++ b/src/clients/ksu/main.c
d738b9
@@ -417,6 +417,16 @@ main (argc, argv)
d738b9
     if (hp){
d738b9
         if (gb_err) fprintf(stderr, "%s", gb_err);
d738b9
         fprintf(stderr, _("account %s: authorization failed\n"), target_user);
d738b9
+
d738b9
+        if (cmd != NULL) {
d738b9
+            syslog(LOG_WARNING,
d738b9
+                   "Account %s: authorization for %s for execution of %s failed",
d738b9
+                   target_user, source_user, cmd);
d738b9
+        } else {
d738b9
+            syslog(LOG_WARNING, "Account %s: authorization of %s failed",
d738b9
+                   target_user, source_user);
d738b9
+        }
d738b9
+
d738b9
         exit(1);
d738b9
     }
d738b9