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.

Bug 1548350

Summary: SELinux prevents traceroute from using DCCP sockets
Product: Red Hat Enterprise Linux 7 Reporter: Milos Malik <mmalik>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.4CC: lvrabec, mgrepl, mmalik, plautrba, ssekidde
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.13.1-203.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1561460 (view as bug list) Environment:
Last Closed: 2018-10-30 10:02:53 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 2018-02-23 09:36:10 UTC
Description of problem:
 * when an unconfined user runs traceroute, the program runs as unconfined_t, because SELinux policy does not define any transition from unconfined_t to traceroute_t
 * but if traceroute is executed by systemd or from an init script then transition to traceroute_t happens and the problem with DCCP becomes visible

Version-Release number of selected component (if applicable):
selinux-policy-3.13.1-191.el7.noarch
selinux-policy-targeted-3.13.1-191.el7.noarch
traceroute-2.0.22-2.el7.x86_64

How reproducible:
* always

Steps to Reproduce:
0) get a RHEL-7.4 machine (targeted policy is active)
# traceroute -D 127.0.0.1
traceroute to 127.0.0.1 (127.0.0.1), 30 hops max, 40 byte packets
socket: Socket type not supported
# runcon system_u:system_r:initrc_t:s0 bash -c 'traceroute -D 127.0.0.1'
traceroute to 127.0.0.1 (127.0.0.1), 30 hops max, 40 byte packets
socket: Permission denied
#

Actual results (enforcing mode):
----
type=PROCTITLE msg=audit(02/23/2018 04:30:43.399:288) : proctitle=traceroute -D 127.0.0.1 
type=SYSCALL msg=audit(02/23/2018 04:30:43.399:288) : arch=x86_64 syscall=socket success=no exit=EACCES(Permission denied) a0=inet a1=SOCK_DCCP a2=dccp a3=0x2 items=0 ppid=8055 pid=8124 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=pts0 ses=2 comm=traceroute exe=/usr/bin/traceroute subj=system_u:system_r:traceroute_t:s0 key=(null) 
type=AVC msg=audit(02/23/2018 04:30:43.399:288) : avc:  denied  { create } for  pid=8124 comm=traceroute scontext=system_u:system_r:traceroute_t:s0 tcontext=system_u:system_r:traceroute_t:s0 tclass=dccp_socket permissive=0 
----

Expected results:
 * no SELinux denials

Comment 1 Milos Malik 2018-02-23 09:41:26 UTC
# setenforce 0
# runcon system_u:system_r:initrc_t:s0 bash -c 'traceroute -D 127.0.0.1'
traceroute to 127.0.0.1 (127.0.0.1), 30 hops max, 40 byte packets
socket: Socket type not supported
#

Comment 3 Milos Malik 2018-03-03 09:46:44 UTC
The automated TC also triggers following SELinux denial in enforcing mode:
----
type=PROCTITLE msg=audit(03/03/2018 04:41:57.141:1373) : proctitle=/usr/bin/traceroute -T 172.16.36.1 
type=SYSCALL msg=audit(03/03/2018 04:41:57.141:1373) : arch=x86_64 syscall=open success=no exit=EACCES(Permission denied) a0=0x7ffe565ab9b0 a1=O_RDONLY a2=0x0 a3=0x7ffe565ab420 items=0 ppid=31068 pid=31072 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=pts0 ses=2 comm=traceroute exe=/usr/bin/traceroute subj=system_u:system_r:traceroute_t:s0 key=(null) 
type=AVC msg=audit(03/03/2018 04:41:57.141:1373) : avc:  denied  { search } for  pid=31072 comm=traceroute name=net dev="proc" ino=8797 scontext=system_u:system_r:traceroute_t:s0 tcontext=system_u:object_r:sysctl_net_t:s0 tclass=dir permissive=0 
----

Comment 4 Milos Malik 2018-03-03 09:53:18 UTC
Following SELinux denials appeared in permissive mode:
----
type=PROCTITLE msg=audit(03/03/2018 04:51:13.131:2431) : proctitle=/usr/bin/traceroute -T 172.16.36.1 
type=SYSCALL msg=audit(03/03/2018 04:51:13.131:2431) : arch=x86_64 syscall=open success=yes exit=4 a0=0x7ffe8df96220 a1=O_RDONLY a2=0x0 a3=0x7ffe8df95ca0 items=0 ppid=6269 pid=6273 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=pts0 ses=2 comm=traceroute exe=/usr/bin/traceroute subj=system_u:system_r:traceroute_t:s0 key=(null) 
type=AVC msg=audit(03/03/2018 04:51:13.131:2431) : avc:  denied  { open } for  pid=6273 comm=traceroute path=/proc/sys/net/ipv4/tcp_ecn dev="proc" ino=72378 scontext=system_u:system_r:traceroute_t:s0 tcontext=system_u:object_r:sysctl_net_t:s0 tclass=file permissive=1 
type=AVC msg=audit(03/03/2018 04:51:13.131:2431) : avc:  denied  { read } for  pid=6273 comm=traceroute name=tcp_ecn dev="proc" ino=72378 scontext=system_u:system_r:traceroute_t:s0 tcontext=system_u:object_r:sysctl_net_t:s0 tclass=file permissive=1 
type=AVC msg=audit(03/03/2018 04:51:13.131:2431) : avc:  denied  { search } for  pid=6273 comm=traceroute name=net dev="proc" ino=8797 scontext=system_u:system_r:traceroute_t:s0 tcontext=system_u:object_r:sysctl_net_t:s0 tclass=dir permissive=1 
----
type=PROCTITLE msg=audit(03/03/2018 04:51:28.241:2432) : proctitle=/usr/bin/traceroute -D 172.16.36.1 
type=SYSCALL msg=audit(03/03/2018 04:51:28.241:2432) : arch=x86_64 syscall=socket success=no exit=ESOCKTNOSUPPORT(Socket type not supported) a0=inet a1=SOCK_DCCP a2=dccp a3=0x2 items=0 ppid=6428 pid=6432 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=pts0 ses=2 comm=traceroute exe=/usr/bin/traceroute subj=system_u:system_r:traceroute_t:s0 key=(null) 
type=AVC msg=audit(03/03/2018 04:51:28.241:2432) : avc:  denied  { module_request } for  pid=6432 comm=traceroute kmod="net-pf-2-proto-33-type-6" scontext=system_u:system_r:traceroute_t:s0 tcontext=system_u:system_r:kernel_t:s0 tclass=system permissive=1 
type=AVC msg=audit(03/03/2018 04:51:28.241:2432) : avc:  denied  { create } for  pid=6432 comm=traceroute scontext=system_u:system_r:traceroute_t:s0 tcontext=system_u:system_r:traceroute_t:s0 tclass=dccp_socket permissive=1 
----

Comment 12 errata-xmlrpc 2018-10-30 10:02:53 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-2018:3111