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 1539416

Summary: ipsec service with seccomp support and selinux denials
Product: Red Hat Enterprise Linux 7 Reporter: Ondrej Moriš <omoris>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED ERRATA QA Contact: Ondrej Moriš <omoris>
Severity: high Docs Contact:
Priority: high    
Version: 7.5CC: jreznik, lvrabec, mgrepl, mmalik, mthacker, omoris, plautrba, pwouters, ssekidde, tis
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.13.1-188.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 12:49:36 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 Ondrej Moriš 2018-01-28 19:30:01 UTC
Description of problem:

When seccomp filtering is enabled in ipsec service (ie. libreswan) and actual filtering happens (eg. during pluto seccomp selftest), service is restarted but some service actions are denied:

...
002 "test" #2: route-host output: /usr/libexec/ipsec/_updown.netkey: line 496: /usr/sbin/ip: Permission denied
...

# ausearch -ts recent -m AVC
type=PROCTITLE msg=audit(01/28/2018 20:24:31.687:956) : proctitle=/bin/sh /usr/libexec/ipsec/_updown.netkey 
type=SYSCALL msg=audit(01/28/2018 20:24:31.687:956) : arch=x86_64 syscall=execve success=no exit=EACCES(Permission denied) a0=0x14f5670 a1=0x14cae10 a2=0x14f8740 a3=0x7fff74ec99c0 items=0 ppid=25598 pid=25600 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=_updown.netkey exe=/usr/bin/bash subj=system_u:system_r:ipsec_t:s0 key=(null) 
type=AVC msg=audit(01/28/2018 20:24:31.687:956) : avc:  denied  { execute_no_trans } for  pid=25600 comm=_updown.netkey path=/usr/sbin/ip dev="dm-0" ino=171957 scontext=system_u:system_r:ipsec_t:s0 tcontext=system_u:object_r:ifconfig_exec_t:s0 tclass=file 
type=SELINUX_ERR msg=audit(01/28/2018 20:24:31.687:956) : op=security_bounded_transition seresult=denied oldcontext=system_u:system_r:ipsec_t:s0 newcontext=system_u:system_r:ifconfig_t:s0 

When the following rule is loaded into policy or selinux is in permissive mode, problem disappear:

allow ipsec_t ifconfig_exec_t:file execute_no_trans;

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

selinux-policy-3.13.1-166.el7.noarch
libreswan-3.23-1.el7
kernel-3.10.0-693.el7

How reproducible:

100%

Steps to Reproduce:

Non-trivial but I can share if needed.

Comment 2 Ondrej Moriš 2018-01-29 17:23:07 UTC
Paul Wouters noticed one interesting point - there is SELINUX_ERR event which is not really expected, right? Also, Paul suggested that the selinux policy has sysnet_domtrans_ifconfig(ipsec_t) which means ipsec_t should domtrans to ifconfig_t when running ip command and this domain transition in selinux doesn't work when seccomp is enabled for pluto (ipsec daemon).

Comment 3 Milos Malik 2018-01-30 10:41:57 UTC
Ondrej Moris and me will test the fix as soon as the new build becomes available.

Comment 4 Lukas Vrabec 2018-02-01 10:18:09 UTC
Ondrej, Milos: 

if you create local policy proposed in description, is the scenario working? 

Thanks,
Lukas.

Comment 5 Ondrej Moriš 2018-02-05 08:19:10 UTC
(In reply to Lukas Vrabec from comment #4)

> if you create local policy proposed in description, is the scenario working? 

Yes.

Comment 16 errata-xmlrpc 2018-04-10 12:49:36 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:0763