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.
Bug 1765063 - AVCs seen on "fuser" when "tmpwatch --fuser ..." is used as a system cron job
Summary: AVCs seen on "fuser" when "tmpwatch --fuser ..." is used as a system cron job
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: selinux-policy
Version: 7.7
Hardware: All
OS: Linux
urgent
medium
Target Milestone: rc
: 7.8
Assignee: Lukas Vrabec
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks: 1766095
TreeView+ depends on / blocked
 
Reported: 2019-10-24 09:42 UTC by Renaud Métrich
Modified: 2020-03-31 19:11 UTC (History)
8 users (show)

Fixed In Version: selinux-policy-3.13.1-266.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1766095 (view as bug list)
Environment:
Last Closed: 2020-03-31 19:11:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:1007 0 None None None 2020-03-31 19:11:13 UTC

Description Renaud Métrich 2019-10-24 09:42:49 UTC
Description of problem:

With tmpwatch-2.11-6.el7 shipped with RHEL7.7, AVcs are seen when "tmpwatch" executes internally "fuser" while running as a system cron job (domain is then "tmpreaper_t").
These are due to "fuser" not being able to read /proc/<PID>, which is necessary to find processes having opened some file.

After adding "domain_read_all_domains_state(tmpreaper_t)" rules, "fuser" then works but still some AVCs are seen:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
allow tmpreaper_t fixed_disk_device_t:blk_file getattr;
allow tmpreaper_t proc_net_t:file read;
allow tmpreaper_t system_mail_t:unix_dgram_socket getattr;
allow tmpreaper_t system_mail_t:unix_stream_socket getattr;
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Note that there may be more, depending on what is read from /proc.
Very probably, all the other AVCs happening while reading /proc can be dont-audit'ed because fuser's use case here is to find out unused files, not other types.


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

selinux-policy-3.13.1-252.el7.1
tmpwatch-2.11-6.el7


How reproducible:

Always


Steps to Reproduce:
1. Install latest tmpwatch

  # yum -y install tmpwatch

2. Create a temporary file

  # mkdir /tmp/test
  # touch /tmp/test/file

3. Execute tmpwatch through crond with "-s" (i.e. "--fuser") option

  # echo "* * * * * root /usr/sbin/tmpwatch -vds -m 0 /tmp/test" >> /etc/crontab
  # sleep 60
  # ausearch -m avc -ts recent | audit2allow

Actual results:


#============= tmpreaper_t ==============
allow tmpreaper_t NetworkManager_t:dir { getattr search };
allow tmpreaper_t abrt_t:unix_dgram_socket getattr;
allow tmpreaper_t abrt_t:unix_stream_socket getattr;
allow tmpreaper_t auditd_t:dir { getattr search };
allow tmpreaper_t crond_t:dir { getattr search };
allow tmpreaper_t dhcpc_t:dir { getattr search };
allow tmpreaper_t fixed_disk_device_t:blk_file getattr;
..


Expected results:

No AVC


Additional info:

With tmpwatch-2.11-5.el7 shipped with RHEL7.6, this was not happening because "fuser" was not called, even if option was passed to "tmpwatch".
A workaround is to run "tmpwatch" as a user cron instead of system cron, which will then make "tmpwatch" run as the user's context (e.g. "unconfined_t").

Custom policy module that "helps" (but doesn't fix everything):

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
policy_module(local_tmpwatch, 1.0)

gen_require(`
	type tmpreaper_t;
')

domain_read_all_domains_state(tmpreaper_t)
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Comment 3 Zdenek Pytela 2019-10-24 14:29:36 UTC
Red Hat Enterprise Linux 7 is now in the Maintenance Support 1 phase of the product life cycle. Future minor releases will focus on retaining and improving stability and reliability, so that qualified Critical and Important Security errata advisories (RHSAs) and Urgent Priority Bug Fix errata advisories (RHBAs) may be released as they become available.

Please describe the impact of this issue and provide justification so that the bug can be properly assesed.

See the Red Hat Enterprise Linux Life Cycle document for more details:
https://access.redhat.com/support/policy/updates/errata/#Maintenance_Support_1_Phase

Comment 18 Lukas Vrabec 2019-10-30 16:52:16 UTC
commit 7a70acb74f1c856f5dc1e54b407632c2beb2db28 (HEAD -> rhel7.8-contrib, origin/rhel7.8-contrib)
Author: Lukas Vrabec <lvrabec>
Date:   Wed Oct 30 16:01:58 2019 +0100

    Allow tmpwatch process labeled as tmpreaper_t domain to execute fuser command.
    
    Resolves: rhbz#1765063

Comment 36 errata-xmlrpc 2020-03-31 19:11:00 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, 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-2020:1007


Note You need to log in before you can comment on or make changes to this bug.