Bug 2213573

Summary: arpwatch is not allowed to use msmtp as /usr/sbin/sendmail
Product: Red Hat Enterprise Linux 9 Reporter: Milos Malik <mmalik>
Component: selinux-policyAssignee: Nobody <nobody>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: medium    
Version: 9.3CC: lvrabec, mmalik, yann, zpytela
Target Milestone: rcKeywords: AutoVerified, Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-38.1.15-1.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: 2176583 Environment:
Last Closed: 2023-11-07 08:52:30 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 Milos Malik 2023-06-08 15:14:27 UTC
+++ This bug was initially created as a clone of Bug #2176583 +++

Description of problem:

  arpwatch would send an email on event, calling /usr/sbin/sendmail.

  msmtp is small MTA, like esmtp, that can be used to provide an alternative to /usr/sbin/sendmail.

  Unfortunately, arpwatch.service is not allowed to use msmtp

Version-Release number of selected component (if applicable):

arpwatch-3.3-10.el9.x86_64
msmtp-1.8.22-1.el9.x86_64
selinux-policy-38.1.14-1.el9.noarch
selinux-policy-devel-38.1.14-1.el9.noarch
selinux-policy-targeted-38.1.14-1.el9.noarch

Steps to Reproduce:

  In a virtual machine

  1. dnf install arpwatch  # esmtp is likely going to be installed as dependency
  2. dnf install msmtp     # msmtp should now provide mta
  3. systemctl start arpwatch
  4. journalctl --unit arpwatch --follow

Actual results:

  arpwatch[...]: execl: /usr/sbin/sendmail: Permission denied

Expected results:

  arpwatch should have been allowed to use the MTA.

Additional information:
 * both arpwatch and msmtp packages come from the EPEL repository

Comment 1 Milos Malik 2023-06-08 15:18:47 UTC
SELinux denials caught in enforcing mode:
----
type=PROCTITLE msg=audit(06/08/2023 11:07:37.880:372) : proctitle=/usr/sbin/arpwatch -u arpwatch -F -C 
type=PATH msg=audit(06/08/2023 11:07:37.880:372) : item=0 name=/usr/sbin/sendmail inode=4571724 dev=fd:01 mode=file,755 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:bin_t:s0 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0 
type=CWD msg=audit(06/08/2023 11:07:37.880:372) : cwd=/var/lib/arpwatch 
type=SYSCALL msg=audit(06/08/2023 11:07:37.880:372) : arch=x86_64 syscall=execve success=no exit=EACCES(Permission denied) a0=0x55737527c30a a1=0x7ffd994a7580 a2=0x7ffd994a8618 a3=0x55737527c314 items=1 ppid=13457 pid=14011 auid=unset uid=arpwatch gid=arpwatch euid=arpwatch suid=arpwatch fsuid=arpwatch egid=arpwatch sgid=arpwatch fsgid=arpwatch tty=(none) ses=unset comm=arpwatch exe=/usr/sbin/arpwatch subj=system_u:system_r:arpwatch_t:s0 key=(null) 
type=AVC msg=audit(06/08/2023 11:07:37.880:372) : avc:  denied  { execute } for  pid=14011 comm=arpwatch name=msmtp dev="vda1" ino=4571724 scontext=system_u:system_r:arpwatch_t:s0 tcontext=system_u:object_r:bin_t:s0 tclass=file permissive=0
----

SELinux denials caught in permissive mode:
----
type=PROCTITLE msg=audit(06/08/2023 11:16:47.642:385) : proctitle=sendmail -odi root 
type=PATH msg=audit(06/08/2023 11:16:47.642:385) : item=1 name=/lib64/ld-linux-x86-64.so.2 inode=6336596 dev=fd:01 mode=file,755 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:ld_so_t:s0 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0 
type=PATH msg=audit(06/08/2023 11:16:47.642:385) : item=0 name=/usr/sbin/sendmail inode=4571724 dev=fd:01 mode=file,755 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:bin_t:s0 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0 
type=CWD msg=audit(06/08/2023 11:16:47.642:385) : cwd=/var/lib/arpwatch 
type=EXECVE msg=audit(06/08/2023 11:16:47.642:385) : argc=3 a0=sendmail a1=-odi a2=root 
type=SYSCALL msg=audit(06/08/2023 11:16:47.642:385) : arch=x86_64 syscall=execve success=yes exit=0 a0=0x561eede2630a a1=0x7ffc41508890 a2=0x7ffc41509928 a3=0x561eede26314 items=2 ppid=23798 pid=24340 auid=unset uid=arpwatch gid=arpwatch euid=arpwatch suid=arpwatch fsuid=arpwatch egid=arpwatch sgid=arpwatch fsgid=arpwatch tty=(none) ses=unset comm=sendmail exe=/usr/bin/msmtp subj=system_u:system_r:arpwatch_t:s0 key=(null) 
type=AVC msg=audit(06/08/2023 11:16:47.642:385) : avc:  denied  { map } for  pid=24340 comm=sendmail path=/usr/bin/msmtp dev="vda1" ino=4571724 scontext=system_u:system_r:arpwatch_t:s0 tcontext=system_u:object_r:bin_t:s0 tclass=file permissive=1 
type=AVC msg=audit(06/08/2023 11:16:47.642:385) : avc:  denied  { execute_no_trans } for  pid=24340 comm=arpwatch path=/usr/bin/msmtp dev="vda1" ino=4571724 scontext=system_u:system_r:arpwatch_t:s0 tcontext=system_u:object_r:bin_t:s0 tclass=file permissive=1 
type=AVC msg=audit(06/08/2023 11:16:47.642:385) : avc:  denied  { execute } for  pid=24340 comm=arpwatch name=msmtp dev="vda1" ino=4571724 scontext=system_u:system_r:arpwatch_t:s0 tcontext=system_u:object_r:bin_t:s0 tclass=file permissive=1 
----

Comment 2 Nikola Knazekova 2023-06-15 08:08:00 UTC
PR: https://github.com/fedora-selinux/selinux-policy/pull/1623

Comment 13 errata-xmlrpc 2023-11-07 08:52:30 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:6617