File add_avc_denials_log_priority.patch of Package setroubleshoot
--- a/src/config.py.in
+++ b/src/config.py.in
@@ -271,6 +271,14 @@
[CRITICAL, ERROR, WARNING, INFO, DEBUG]''',
},
},
+ 'avc_denials_log_priority': {
+ 'level': {
+ 'value': 'error',
+ 'description': '''
+log level of avc denials send to journald or syslog. Levels are usual for syslog or journald. The defined levels in severity order are:
+[ERROR, WARNING, INFO]''',
+ },
+ },
'access': {
'client_users': {
'value': '*',
--- a/src/setroubleshoot/server.py
+++ b/src/setroubleshoot/server.py
@@ -224,8 +224,21 @@
log_debug("sending alert to all clients")
+ syslog_priority_mapping = {
+ 'DEBUG': syslog.LOG_DEBUG,
+ 'INFO': syslog.LOG_INFO,
+ 'NOTICE': syslog.LOG_NOTICE,
+ 'WARNING': syslog.LOG_WARNING,
+ 'ERR': syslog.LOG_ERR,
+ 'CRIT': syslog.LOG_CRIT,
+ 'ALERT': syslog.LOG_ALERT,
+ 'EMERG': syslog.LOG_EMERG
+ }
+ syslog_priority_str = get_config('avc_denials_log_priority', 'level')
+ syslog_priority = syslog_priority_mapping.get(syslog_priority_str.upper(), syslog.LOG_ERR
+
from setroubleshoot.html_util import html_to_text
- syslog.syslog(syslog.LOG_ERR, siginfo.summary() + _(" For complete SELinux messages run: sealert -l %s") % siginfo.local_id)
+ syslog.syslog(syslog_priority, siginfo.summary() + _(" For complete SELinux messages run: sealert -l %s") % siginfo.local_id)
for audit_record in siginfo.audit_event.records:
if audit_record.record_type == 'AVC':
pid = audit_record.fields["pid"]