From 945838998d84dcd8f0aab147f228e244dc08a54e Mon Sep 17 00:00:00 2001 From: Petr Lautrbach Date: Fri, 28 Feb 2020 13:25:59 +0100 Subject: [PATCH] root user doesn't need to use SetroubleshootPrivileged API Fixes: $ sudo sealert -a ./short.log 2>&1 | tee /tmp/tmp.956wzqmMcR, with 15 seconds timeout ERROR:dbus.proxies:Introspect error on :1.38:/org/fedoraproject/SetroubleshootPrivileged/object: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.AccessDenied: Sender is not authorized to send message Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/setroubleshoot/util.py", line 494, in get_rpm_nvr_by_scontext dbus_interface = "org.fedoraproject.SetroubleshootPrivileged")) File "/usr/lib64/python3.7/site-packages/dbus/proxies.py", line 70, in __call__ return self._proxy_method(*args, **keywords) File "/usr/lib64/python3.7/site-packages/dbus/proxies.py", line 145, in __call__ **keywords) File "/usr/lib64/python3.7/site-packages/dbus/connection.py", line 651, in call_blocking message, timeout) dbus.exceptions.DBusException: org.freedesktop.DBus.Error.AccessDenied: Sender is not authorized to send message --- framework/src/setroubleshoot/signature.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/framework/src/setroubleshoot/signature.py b/framework/src/setroubleshoot/signature.py index 7287eec8af61..bcc37408c29c 100755 --- a/framework/src/setroubleshoot/signature.py +++ b/framework/src/setroubleshoot/signature.py @@ -314,7 +314,16 @@ class SEFaultSignatureInfo(XmlSerialize): setattr(self, k, v) self.report_count = 1 self.plugin_list = [] - self.environment.local_policy_rpm = get_rpm_nvr_by_scontext(self.scontext, use_dbus=True) + + use_dbus=True + if os.getuid() == 0: + # root doesn't need to use dbus + use_dbus=False + try: + self.environment.local_policy_rpm = get_rpm_nvr_by_scontext(self.scontext, use_dbus=use_dbus) + except: + # leave it as it is + pass def update_merge(self, siginfo): if siginfo.last_seen_date != self.last_seen_date: -- 2.25.1