Blame 0105-ccpp-include-the-system-logs-only-with-root-s-coredu.patch

fa19501
From 52b7072c2c821fcf7d132967a03a2086d4621069 Mon Sep 17 00:00:00 2001
fa19501
From: Jakub Filak <jfilak@redhat.com>
fa19501
Date: Mon, 18 May 2015 09:34:57 +0200
fa19501
Subject: [PATCH] ccpp: include the system logs only with root's coredumps
fa19501
fa19501
Search for suspicious lines in 'journalctl' only if uid == 0.  A problem
fa19501
of the type CCpp can be created only by root so no user can trick abrt
fa19501
to run 'post-create' on a malicious problem directory with uid == 0.
fa19501
fa19501
Related: rhbz#1212868
fa19501
fa19501
Signed-off-by: Jakub Filak <jfilak@redhat.com>
fa19501
---
fa19501
 src/plugins/ccpp_event.conf | 10 +++++++++-
fa19501
 1 file changed, 9 insertions(+), 1 deletion(-)
fa19501
fa19501
diff --git a/src/plugins/ccpp_event.conf b/src/plugins/ccpp_event.conf
fa19501
index 15bb18c..809c3b7 100644
fa19501
--- a/src/plugins/ccpp_event.conf
fa19501
+++ b/src/plugins/ccpp_event.conf
fa19501
@@ -33,14 +33,22 @@ EVENT=post-create analyzer=CCpp
fa19501
             journalctl --system -n1 >/dev/null
fa19501
             if [ $? -ne 0 ];
fa19501
             then
fa19501
+                # Remove the exit below if you don't mind sharing data from the
fa19501
+                # system logs with unprivileged users -> bugzilla.redhat.com/1212868
fa19501
+                exit 0
fa19501
                 # It's not an error if /var/log/messages isn't readable:
fa19501
                 test -f /var/log/messages || exit 0
fa19501
                 test -r /var/log/messages || exit 0
fa19501
                 log=`grep -F -e "$base_executable" /var/log/messages | tail -99`
fa19501
             else
fa19501
                 uid=`cat uid` &&
fa19501
+                (
fa19501
+                # Remove the line below if you don't mind sharing data from the
fa19501
+                # system logs with unprivileged users -> bugzilla.redhat.com/1212868
fa19501
+                [ "$uid" -ne 0 ] && exit 0
fa19501
                 log="[System Logs]:\n" &&
fa19501
-                log=$log`journalctl -b --since=-3m --system -n 99 _COMM="$base_executable"` &&
fa19501
+                log=$log`journalctl -b --since=-3m --system -n 99 _COMM="$base_executable"`
fa19501
+                ) &&
fa19501
                 log=$log"\n[User Logs]:\n" &&
fa19501
                 log=$log`journalctl -b --since=-3m -n 99 _COMM="$base_executable" _UID="$uid"` &&
fa19501
                 log=`echo -e "$log"`
fa19501
-- 
fa19501
2.1.0
fa19501