Bug 2143337

Summary: certmonger emailed alerts incomplete due to local MTA unable to read /run/certmonger temp files
Product: Red Hat Enterprise Linux 8 Reporter: Josh Snyder <joshua.snyder>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.7CC: lvrabec, mmalik, nknazeko
Target Milestone: rcKeywords: Triaged
Target Release: 8.8Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.14.3-114.el8 Doc Type: No Doc Update
Doc Text:
If this bug requires documentation, please select an appropriate Doc Type value.
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-16 09:04:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Josh Snyder 2022-11-16 16:30:46 UTC
Description of problem:
When certmonger is configured to email alerts, the emails are incomplete - missing the email subject which contains the actual alert details.  This appears to be due to the local MTA's inability to read temp files created in /run/certmonger.  

Version-Release number of selected component (if applicable):
certmonger-0.79.13-5.el8.x86_64
selinux-policy-3.14.3-108.el8.noarch
mailx-12.5-29.el8.x86_64
postfix-3.5.8-4.el8.x86_64


How reproducible:
Always

Steps to Reproduce:
1. Configure certmonger to send email notifications

# grep -v '^#' /etc/certmonger/certmonger.conf 
[defaults]
notification_method = mail 
notification_destination = root

2. Add a certificate to certmonger for tracking

3. Generate an alert condition for the tracked certificate either by uploading an already expired cert or adjusting the certmonger alert thresholds to trigger alerts

4. Review emailed alert in root mail

Actual results:

Emailed alert does not contain a SUBJECT, which is where the alert details are written.

Expected results:

A complete alert email will be sent, including the certificate alert details in the email SUBJECT

Additional info:

# aureport -a

AVC Report
===============================================================
# date time comm subj syscall class permission obj result event
===============================================================
[...snip...]
4. 11/15/2022 16:34:10 sendmail system_u:system_r:system_mail_t:s0 59 file read system_u:object_r:certmonger_var_run_t:s0 denied 221
[...snip...]
6. 11/15/2022 16:46:16 sendmail system_u:system_r:system_mail_t:s0 5 file getattr system_u:object_r:certmonger_var_run_t:s0 denied 275


# grep AVC /var/log/audit/audit.log |audit2allow


#============= system_mail_t ==============
allow system_mail_t certmonger_var_run_t:file read;
allow system_mail_t certmonger_var_run_t:file getattr;



# ausearch -m avc -m user_avc -m selinux_err -m user_selinux_err -i -ts today
[...snip...]
----
type=PROCTITLE msg=audit(11/15/2022 16:34:10.124:221) : proctitle=send-mail -i -- root 
type=EXECVE msg=audit(11/15/2022 16:34:10.124:221) : argc=4 a0=send-mail a1=-i a2=-- a3=root 
type=SYSCALL msg=audit(11/15/2022 16:34:10.124:221) : arch=x86_64 syscall=execve success=yes exit=0 a0=0x5557f5afd3d2 a1=0x5557f6a68cf0 a2=0x7ffdd47a7b00 a3=0x8 items=0 ppid=1 pid=5164 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=sendmail exe=/usr/sbin/sendmail.postfix subj=system_u:system_r:system_mail_t:s0 key=(null) 
type=AVC msg=audit(11/15/2022 16:34:10.124:221) : avc:  denied  { read } for  pid=5164 comm=sendmail path=/run/certmonger/Rs3AjFJm (deleted) dev="tmpfs" ino=49425 scontext=system_u:system_r:system_mail_t:s0 tcontext=system_u:object_r:certmonger_var_run_t:s0 tclass=file permissive=0 
[...snip...]
----
type=PROCTITLE msg=audit(11/15/2022 16:46:16.320:275) : proctitle=send-mail -i -- root 
type=SYSCALL msg=audit(11/15/2022 16:46:16.320:275) : arch=x86_64 syscall=fstat success=no exit=EACCES(Permission denied) a0=0x0 a1=0x7ffe9ffa5cd0 a2=0x7ffe9ffa5cd0 a3=0x0 items=0 ppid=1 pid=7604 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=sendmail exe=/usr/sbin/sendmail.postfix subj=system_u:system_r:system_mail_t:s0 key=(null) 
type=AVC msg=audit(11/15/2022 16:46:16.320:275) : avc:  denied  { getattr } for  pid=7604 comm=sendmail path=/run/certmonger/Rs0eL010 (deleted) dev="tmpfs" ino=56370 scontext=system_u:system_r:system_mail_t:s0 tcontext=system_u:object_r:certmonger_var_run_t:s0 tclass=file permissive=0

Comment 10 errata-xmlrpc 2023-05-16 09:04:17 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (selinux-policy bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:2965