Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Version-Release number of selected component (if applicable):
selinux-policy-2.4.6-327.el5
selinux-policy-3.7.19-155.el6_3.4
selinux-policy-3.10.0-91.fc16
Description of problem:
We call clamdscan from a sendmail milter, in order to scan incoming mail messages for viruses in real time (during the SMTP dialog).
All versions of selinux-policy for RHEL5 and RHEL6 break the ability of clamd to read arbitrary files on the system, such as files underneath /var/spool:
$ getenforce
Permissive
$ clamdscan -c /etc/clamd.d/defang.conf /var/spool/mdspool/test
/var/spool/mdspool/test: OK
----------- SCAN SUMMARY -----------
Infected files: 0
Time: 0.001 sec (0 m 0 s)
$ ausearch -m avc -ts recent
----
time->Wed Sep 26 16:17:57 2012
type=SYSCALL msg=audit(1348690677.657:2883): arch=c000003e syscall=6 success=yes exit=0 a0=79144c0 a1=42539db0 a2=42539db0 a3=1 items=0 ppid=1 pid=19899 auid=4294967295 uid=501 gid=501 euid=501 suid=501 fsuid=501 egid=501 sgid=501 fsgid=501 tty=(none) ses=4294967295 comm="clamd" exe="/usr/sbin/clamd" subj=system_u:system_r:clamd_t:s0 key=(null)
type=AVC msg=audit(1348690677.657:2883): avc: denied { getattr } for pid=19899 comm="clamd" path="/var/spool/mdspool/test" dev=dm-1 ino=131117 scontext=system_u:system_r:clamd_t:s0 tcontext=user_u:object_r:var_spool_t:s0 tclass=file
----
time->Wed Sep 26 16:17:57 2012
type=SYSCALL msg=audit(1348690677.657:2884): arch=c000003e syscall=21 success=yes exit=0 a0=78d3c20 a1=4 a2=625d01 a3=0 items=0 ppid=1 pid=19899 auid=4294967295 uid=501 gid=501 euid=501 suid=501 fsuid=501 egid=501 sgid=501 fsgid=501 tty=(none) ses=4294967295 comm="clamd" exe="/usr/sbin/clamd" subj=system_u:system_r:clamd_t:s0 key=(null)
type=AVC msg=audit(1348690677.657:2884): avc: denied { read } for pid=19899 comm="clamd" name="test" dev=dm-1 ino=131117 scontext=system_u:system_r:clamd_t:s0 tcontext=user_u:object_r:var_spool_t:s0 tclass=file
I can resort to implementing local policy to override this; e.g.:
$ ausearch -m avc -ts this-month | audit2allow
allow clamd_t var_spool_t:dir read;
allow clamd_t var_spool_t:file { read getattr };
However, more recent versions of selinux-policy (e.g., selinux-policy-3.10.0-91.fc16 and possibly earlier) include a tunable that permits clamd to scan non-security system files. From policy/modules/services/clamav.te:
## <desc>
## <p>
## Allow clamscan to non security files on a system
## </p>
## </desc>
gen_tunable(clamscan_can_scan_system, false)
tunable_policy(`clamscan_can_scan_system',`
files_read_non_security_files(clamscan_t)
')
This is a much cleaner approach. If added as above (default == false), it would represent no change to existing policy, and is only a tiny (4-line) addition.
Could this be added to RHEL5 and RHEL6 selinux-policy, please?
(In reply to comment #2)
> Thanks for the RHEL6 add. Any chance of getting it added to RHEL5, too?
> Should I file a separate bug for that?
Yes, please.
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, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
http://rhn.redhat.com/errata/RHBA-2013-0314.html
Version-Release number of selected component (if applicable): selinux-policy-2.4.6-327.el5 selinux-policy-3.7.19-155.el6_3.4 selinux-policy-3.10.0-91.fc16 Description of problem: We call clamdscan from a sendmail milter, in order to scan incoming mail messages for viruses in real time (during the SMTP dialog). All versions of selinux-policy for RHEL5 and RHEL6 break the ability of clamd to read arbitrary files on the system, such as files underneath /var/spool: $ getenforce Permissive $ clamdscan -c /etc/clamd.d/defang.conf /var/spool/mdspool/test /var/spool/mdspool/test: OK ----------- SCAN SUMMARY ----------- Infected files: 0 Time: 0.001 sec (0 m 0 s) $ ausearch -m avc -ts recent ---- time->Wed Sep 26 16:17:57 2012 type=SYSCALL msg=audit(1348690677.657:2883): arch=c000003e syscall=6 success=yes exit=0 a0=79144c0 a1=42539db0 a2=42539db0 a3=1 items=0 ppid=1 pid=19899 auid=4294967295 uid=501 gid=501 euid=501 suid=501 fsuid=501 egid=501 sgid=501 fsgid=501 tty=(none) ses=4294967295 comm="clamd" exe="/usr/sbin/clamd" subj=system_u:system_r:clamd_t:s0 key=(null) type=AVC msg=audit(1348690677.657:2883): avc: denied { getattr } for pid=19899 comm="clamd" path="/var/spool/mdspool/test" dev=dm-1 ino=131117 scontext=system_u:system_r:clamd_t:s0 tcontext=user_u:object_r:var_spool_t:s0 tclass=file ---- time->Wed Sep 26 16:17:57 2012 type=SYSCALL msg=audit(1348690677.657:2884): arch=c000003e syscall=21 success=yes exit=0 a0=78d3c20 a1=4 a2=625d01 a3=0 items=0 ppid=1 pid=19899 auid=4294967295 uid=501 gid=501 euid=501 suid=501 fsuid=501 egid=501 sgid=501 fsgid=501 tty=(none) ses=4294967295 comm="clamd" exe="/usr/sbin/clamd" subj=system_u:system_r:clamd_t:s0 key=(null) type=AVC msg=audit(1348690677.657:2884): avc: denied { read } for pid=19899 comm="clamd" name="test" dev=dm-1 ino=131117 scontext=system_u:system_r:clamd_t:s0 tcontext=user_u:object_r:var_spool_t:s0 tclass=file I can resort to implementing local policy to override this; e.g.: $ ausearch -m avc -ts this-month | audit2allow allow clamd_t var_spool_t:dir read; allow clamd_t var_spool_t:file { read getattr }; However, more recent versions of selinux-policy (e.g., selinux-policy-3.10.0-91.fc16 and possibly earlier) include a tunable that permits clamd to scan non-security system files. From policy/modules/services/clamav.te: ## <desc> ## <p> ## Allow clamscan to non security files on a system ## </p> ## </desc> gen_tunable(clamscan_can_scan_system, false) tunable_policy(`clamscan_can_scan_system',` files_read_non_security_files(clamscan_t) ') This is a much cleaner approach. If added as above (default == false), it would represent no change to existing policy, and is only a tiny (4-line) addition. Could this be added to RHEL5 and RHEL6 selinux-policy, please?