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.
+++ This bug was initially created as a clone of Bug #1184260 +++
Description of problem:
If tcpdump is called with the -Z and -w options, unless the argument to the -Z option is "root", tcpdump will attempt to chown the capture file specified by the -w option to the user specified with the -Z option. (It takes this action even if the file is already owned by the user specified with -Z.)
However, even if the capture file has the netutils_tmp_t file context, SELinux denies tcpdump (that is, the netutils_t type) the ability to chown the capture file. This causes tcpdump to immediately fail and exit.
Similarly, tcpdump will call setattr() on a pre-existing capture file if the mode of the capture file isn't already what tcpdump expects. The call to setattr() also is denied by SELinux.
(Most people won't see these issues, because most people run tcpdump from interactive sessions that are in unconfined_t. But we are attempting to run tcpdump in an automated fashion via systemd, which is how we encountered the problem.)
Version-Release number of selected component (if applicable):
selinux-policy-3.7.19-287.el6.noarch
selinux-policy-doc-3.7.19-287.el6.noarch
selinux-policy-minimum-3.7.19-287.el6.noarch
selinux-policy-mls-3.7.19-287.el6.noarch
selinux-policy-targeted-3.7.19-287.el6.noarch
tcpdump-4.0.0-9.20090921gitdf3cb4.2.el6.x86_64
How reproducible:
Call tcpdump with "-Z tcpdump -w capturefile". (If your login is in the unconfined context, you will need to use runcon to ensure tcpdump runs in netutils_t.)
Steps to Reproduce:
# cd /tmp
# rm -f ./capturefile
# runcon system_u:system_r:initrc_t:s0 /bin/bash -c "/usr/sbin/tcpdump -i lo -Z tcpdump -w ./capturefile"
tcpdump: Couldn't change ownership of savefile
#
Actual results (enforcing mode):
----
type=PATH msg=audit(01/14/2016 10:57:05.059:287) : item=0 name=./capturefile inode=187869 dev=fc:03 mode=file,644 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:netutils_tmp_t:s0 nametype=NORMAL
type=CWD msg=audit(01/14/2016 10:57:05.059:287) : cwd=/tmp
type=SYSCALL msg=audit(01/14/2016 10:57:05.059:287) : arch=x86_64 syscall=chown success=no exit=-1(Operation not permitted) a0=0x1cf5a40 a1=tcpdump a2=tcpdump a3=0x7ffc6a439120 items=1 ppid=19664 pid=19668 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=pts0 ses=1 comm=tcpdump exe=/usr/sbin/tcpdump subj=system_u:system_r:netutils_t:s0 key=(null)
type=AVC msg=audit(01/14/2016 10:57:05.059:287) : avc: denied { chown } for pid=19668 comm=tcpdump capability=chown scontext=system_u:system_r:netutils_t:s0 tcontext=system_u:system_r:netutils_t:s0 tclass=capability
----
Expected results:
* no SELinux denials
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://rhn.redhat.com/errata/RHBA-2016-0763.html