Bug 1607994

Summary: Cannot Connect To VPN After Update Due To SELinux
Product: Red Hat Enterprise Linux 7 Reporter: Brian <bsabatini>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.5CC: lvrabec, mgrepl, mmalik, plautrba, ssekidde
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-30 10:07:44 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 Brian 2018-07-24 17:22:05 UTC
SELinux is preventing /usr/libexec/ipsec/addconn from read access on the file nm-l2tp-ipsec-163eb469-8436-4da6-a0a3-3e29f8e3c412.conf.

*****  Plugin catchall (100. confidence) suggests   **************************

If you believe that addconn should be allowed read access on the nm-l2tp-ipsec-163eb469-8436-4da6-a0a3-3e29f8e3c412.conf file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'addconn' --raw | audit2allow -M my-addconn
# semodule -i my-addconn.pp

Additional Information:
Source Context                system_u:system_r:ipsec_t:s0
Target Context                system_u:object_r:l2tpd_var_run_t:s0
Target Objects                nm-l2tp-ipsec-
                              163eb469-8436-4da6-a0a3-3e29f8e3c412.conf [ file ]
Source                        addconn
Source Path                   /usr/libexec/ipsec/addconn
Port                          <Unknown>
Host                          tbs-hp
Source RPM Packages           libreswan-3.23-5.el7_5.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-192.el7_5.4.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     tbs-hp
Platform                      Linux tbs-hp 3.10.0-862.9.1.el7.x86_64 #1 SMP Wed
                              Jun 27 04:30:39 EDT 2018 x86_64 x86_64
Alert Count                   3
First Seen                    2018-07-24 13:11:59 EDT
Last Seen                     2018-07-24 13:14:19 EDT
Local ID                      7bbbf2be-ba7b-403a-8e7a-e37e8b7bcab3

Raw Audit Messages
type=AVC msg=audit(1532452459.665:1716): avc:  denied  { read } for  pid=19239 comm="addconn" name="nm-l2tp-ipsec-163eb469-8436-4da6-a0a3-3e29f8e3c412.conf" dev="tmpfs" ino=139872 scontext=system_u:system_r:ipsec_t:s0 tcontext=system_u:object_r:l2tpd_var_run_t:s0 tclass=file


type=SYSCALL msg=audit(1532452459.665:1716): arch=x86_64 syscall=open success=no exit=EACCES a0=55ed97f73050 a1=0 a2=1b6 a3=24 items=0 ppid=19238 pid=19239 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=addconn exe=/usr/libexec/ipsec/addconn subj=system_u:system_r:ipsec_t:s0 key=(null)

Hash: addconn,ipsec_t,l2tpd_var_run_t,file,read

Comment 2 Brian 2018-07-24 17:28:36 UTC
After installing the semodule from the details, this error appears:

SELinux is preventing addconn from open access on the file /run/nm-l2tp-ipsec-163eb469-8436-4da6-a0a3-3e29f8e3c412.conf.

*****  Plugin restorecon (99.5 confidence) suggests   ************************

If you want to fix the label. 
/run/nm-l2tp-ipsec-163eb469-8436-4da6-a0a3-3e29f8e3c412.conf default label should be var_run_t.
Then you can run restorecon. The access attempt may have been stopped due to insufficient permissions to access a parent directory in which case try to change the following command accordingly.
Do
# /sbin/restorecon -v /run/nm-l2tp-ipsec-163eb469-8436-4da6-a0a3-3e29f8e3c412.conf

*****  Plugin catchall (1.49 confidence) suggests   **************************

If you believe that addconn should be allowed open access on the nm-l2tp-ipsec-163eb469-8436-4da6-a0a3-3e29f8e3c412.conf file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'addconn' --raw | audit2allow -M my-addconn
# semodule -i my-addconn.pp

Additional Information:
Source Context                system_u:system_r:ipsec_t:s0
Target Context                system_u:object_r:l2tpd_var_run_t:s0
Target Objects                /run/nm-l2tp-ipsec-
                              163eb469-8436-4da6-a0a3-3e29f8e3c412.conf [ file ]
Source                        addconn
Source Path                   addconn
Port                          <Unknown>
Host                          tbs-hp
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-192.el7_5.4.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     tbs-hp
Platform                      Linux tbs-hp 3.10.0-862.9.1.el7.x86_64 #1 SMP Wed
                              Jun 27 04:30:39 EDT 2018 x86_64 x86_64
Alert Count                   1
First Seen                    2018-07-24 13:26:06 EDT
Last Seen                     2018-07-24 13:26:06 EDT
Local ID                      fa63bb32-54d9-47d5-8b80-c0c3801e8fe6

Raw Audit Messages
type=AVC msg=audit(1532453166.778:2156): avc:  denied  { open } for  pid=20595 comm="addconn" path="/run/nm-l2tp-ipsec-163eb469-8436-4da6-a0a3-3e29f8e3c412.conf" dev="tmpfs" ino=139872 scontext=system_u:system_r:ipsec_t:s0 tcontext=system_u:object_r:l2tpd_var_run_t:s0 tclass=file


Hash: addconn,ipsec_t,l2tpd_var_run_t,file,open

Comment 3 Brian 2018-07-24 17:31:33 UTC
The VPN would connect after installing the semodule again from previous details. There are 2 more SELinux errors that appear after it is established:

SELinux is preventing /usr/libexec/ipsec/addconn from ioctl access on the file /run/nm-l2tp-ipsec-163eb469-8436-4da6-a0a3-3e29f8e3c412.conf.

*****  Plugin restorecon (99.5 confidence) suggests   ************************

If you want to fix the label. 
/run/nm-l2tp-ipsec-163eb469-8436-4da6-a0a3-3e29f8e3c412.conf default label should be var_run_t.
Then you can run restorecon. The access attempt may have been stopped due to insufficient permissions to access a parent directory in which case try to change the following command accordingly.
Do
# /sbin/restorecon -v /run/nm-l2tp-ipsec-163eb469-8436-4da6-a0a3-3e29f8e3c412.conf

*****  Plugin catchall (1.49 confidence) suggests   **************************

If you believe that addconn should be allowed ioctl access on the nm-l2tp-ipsec-163eb469-8436-4da6-a0a3-3e29f8e3c412.conf file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'addconn' --raw | audit2allow -M my-addconn
# semodule -i my-addconn.pp

Additional Information:
Source Context                system_u:system_r:ipsec_t:s0
Target Context                system_u:object_r:l2tpd_var_run_t:s0
Target Objects                /run/nm-l2tp-ipsec-
                              163eb469-8436-4da6-a0a3-3e29f8e3c412.conf [ file ]
Source                        addconn
Source Path                   /usr/libexec/ipsec/addconn
Port                          <Unknown>
Host                          tbs-hp
Source RPM Packages           libreswan-3.23-5.el7_5.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-192.el7_5.4.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     tbs-hp
Platform                      Linux tbs-hp 3.10.0-862.9.1.el7.x86_64 #1 SMP Wed
                              Jun 27 04:30:39 EDT 2018 x86_64 x86_64
Alert Count                   2
First Seen                    2018-07-24 13:29:14 EDT
Last Seen                     2018-07-24 13:29:14 EDT
Local ID                      ce84560a-08c9-4acf-a23f-12a3ab5daa57

Raw Audit Messages
type=AVC msg=audit(1532453354.965:2214): avc:  denied  { ioctl } for  pid=21347 comm="addconn" path="/run/nm-l2tp-ipsec-163eb469-8436-4da6-a0a3-3e29f8e3c412.conf" dev="tmpfs" ino=139872 scontext=system_u:system_r:ipsec_t:s0 tcontext=system_u:object_r:l2tpd_var_run_t:s0 tclass=file


type=SYSCALL msg=audit(1532453354.965:2214): arch=x86_64 syscall=ioctl success=no exit=EACCES a0=3 a1=5401 a2=7ffd7c74dac0 a3=55587d798640 items=0 ppid=21346 pid=21347 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=addconn exe=/usr/libexec/ipsec/addconn subj=system_u:system_r:ipsec_t:s0 key=(null)

Hash: addconn,ipsec_t,l2tpdSELinux is preventing /usr/libexec/ipsec/addconn from getattr access on the file /run/nm-l2tp-ipsec-163eb469-8436-4da6-a0a3-3e29f8e3c412.conf.

*****  Plugin restorecon (99.5 confidence) suggests   ************************

If you want to fix the label. 
/run/nm-l2tp-ipsec-163eb469-8436-4da6-a0a3-3e29f8e3c412.conf default label should be var_run_t.
Then you can run restorecon. The access attempt may have been stopped due to insufficient permissions to access a parent directory in which case try to change the following command accordingly.
Do
# /sbin/restorecon -v /run/nm-l2tp-ipsec-163eb469-8436-4da6-a0a3-3e29f8e3c412.conf




*****  Plugin catchall (1.49 confidence) suggests   **************************

If you believe that addconn should be allowed getattr access on the nm-l2tp-ipsec-163eb469-8436-4da6-a0a3-3e29f8e3c412.conf file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'addconn' --raw | audit2allow -M my-addconn
# semodule -i my-addconn.pp

Additional Information:
Source Context                system_u:system_r:ipsec_t:s0
Target Context                system_u:object_r:l2tpd_var_run_t:s0
Target Objects                /run/nm-l2tp-ipsec-
                              163eb469-8436-4da6-a0a3-3e29f8e3c412.conf [ file ]
Source                        addconn
Source Path                   /usr/libexec/ipsec/addconn
Port                          <Unknown>
Host                          tbs-hp
Source RPM Packages           libreswan-3.23-5.el7_5.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-192.el7_5.4.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     tbs-hp
Platform                      Linux tbs-hp 3.10.0-862.9.1.el7.x86_64 #1 SMP Wed
                              Jun 27 04:30:39 EDT 2018 x86_64 x86_64
Alert Count                   1
First Seen                    2018-07-24 13:29:14 EDT
Last Seen                     2018-07-24 13:29:14 EDT
Local ID                      4d4c3355-dbc7-40df-a211-5b71982ab552

Raw Audit Messages
type=AVC msg=audit(1532453354.965:2212): avc:  denied  { getattr } for  pid=21347 comm="addconn" path="/run/nm-l2tp-ipsec-163eb469-8436-4da6-a0a3-3e29f8e3c412.conf" dev="tmpfs" ino=139872 scontext=system_u:system_r:ipsec_t:s0 tcontext=system_u:object_r:l2tpd_var_run_t:s0 tclass=file


type=SYSCALL msg=audit(1532453354.965:2212): arch=x86_64 syscall=fstat success=no exit=EACCES a0=3 a1=7ffd7c74da50 a2=7ffd7c74da50 a3=55587d798640 items=0 ppid=21346 pid=21347 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=addconn exe=/usr/libexec/ipsec/addconn subj=system_u:system_r:ipsec_t:s0 key=(null)

Hash: addconn,ipsec_t,l2tpd_var_run_t,file,getattr
_var_run_t,file,ioctl

Comment 7 errata-xmlrpc 2018-10-30 10:07:44 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