Bug 1011808

Summary: SELinux is preventing /usr/libexec/nm-l2tp-service from 'rename' accesses on the file /etc/ipsec.secrets.
Product: [Fedora] Fedora Reporter: Hedayat Vatankhah <hedayatv>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: dominick.grift, dwalsh, lvrabec, mgrepl
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:430e0906728d93e79f8b3eed33f5fdb2900f541d5ad93bf4002660dcb1ede59a
Fixed In Version: selinux-policy-3.12.1-74.8.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-18 11:30:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Hedayat Vatankhah 2013-09-25 07:47:27 UTC
Description of problem:
I tried to connect a L2TP vpn, and this happened. The connection immediately fails with this error. Using 'setenforce 0', I can successfully connect to the VPN.
SELinux is preventing /usr/libexec/nm-l2tp-service from 'rename' accesses on the file /etc/ipsec.secrets.

*****  Plugin catchall_labels (83.8 confidence) suggests  ********************

If you want to allow nm-l2tp-service to have rename access on the ipsec.secrets file
Then you need to change the label on /etc/ipsec.secrets
Do
# semanage fcontext -a -t FILE_TYPE '/etc/ipsec.secrets'
where FILE_TYPE is one of the following: ipsec_key_file_t, l2tpd_var_run_t. 
Then execute: 
restorecon -v '/etc/ipsec.secrets'


*****  Plugin catchall (17.1 confidence) suggests  ***************************

If you believe that nm-l2tp-service should be allowed rename access on the ipsec.secrets 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:
# grep nm-l2tp-service /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:l2tpd_t:s0
Target Context                system_u:object_r:etc_t:s0
Target Objects                /etc/ipsec.secrets [ file ]
Source                        nm-l2tp-service
Source Path                   /usr/libexec/nm-l2tp-service
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           NetworkManager-l2tp-0.9.8-1.fc19.x86_64
Target RPM Packages           libreswan-3.5-2.fc19.x86_64
Policy RPM                    selinux-policy-3.12.1-74.4.fc19.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     (removed)
Platform                      Linux (removed) 3.11.1-200.fc19.x86_64 #1 SMP Sat
                              Sep 14 15:04:51 UTC 2013 x86_64 x86_64
Alert Count                   4
First Seen                    2013-09-25 10:40:32 IRST
Last Seen                     2013-09-25 10:41:46 IRST
Local ID                      b908206f-2004-47e9-9897-e70a8e00296c

Raw Audit Messages
type=AVC msg=audit(1380093106.700:493): avc:  denied  { rename } for  pid=2724 comm="nm-l2tp-service" name="ipsec.secrets" dev="sda6" ino=1983396 scontext=system_u:system_r:l2tpd_t:s0 tcontext=system_u:object_r:etc_t:s0 tclass=file


type=SYSCALL msg=audit(1380093106.700:493): arch=x86_64 syscall=rename success=yes exit=0 a0=405ff5 a1=7fff5861fa90 a2=7fff5861faa7 a3=0 items=0 ppid=474 pid=2724 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm=nm-l2tp-service exe=/usr/libexec/nm-l2tp-service subj=system_u:system_r:l2tpd_t:s0 key=(null)

Hash: nm-l2tp-service,l2tpd_t,etc_t,file,rename

Additional info:
reporter:       libreport-2.1.7
hashmarkername: setroubleshoot
kernel:         3.11.1-200.fc19.x86_64
type:           libreport

Comment 1 Daniel Walsh 2013-09-25 14:57:17 UTC
ec3b73d18f47adc64223bffc1a39429b24616d92 fixes this in git.

Comment 2 Lukas Vrabec 2013-09-26 06:53:00 UTC
Back ported. 
[f19-base 4d5a30e] Get labeling right on ipsec.secrets

Comment 3 Fedora Update System 2013-09-26 09:42:52 UTC
selinux-policy-3.12.1-74.8.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/selinux-policy-3.12.1-74.8.fc19

Comment 4 Fedora Update System 2013-09-27 00:47:52 UTC
Package selinux-policy-3.12.1-74.8.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.12.1-74.8.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-17739/selinux-policy-3.12.1-74.8.fc19
then log in and leave karma (feedback).

Comment 5 Hedayat Vatankhah 2013-09-28 09:07:40 UTC
Not fixed. 

The label after update:
[root@localhost Library]# ls -Z /etc/ipsec.secrets 
-rw-------. root root system_u:object_r:etc_t:s0       /etc/ipsec.secrets

Comment 6 Daniel Walsh 2013-09-28 10:47:12 UTC
Could you try restorecon -v /etc/ipsec.secrets

Comment 7 Hedayat Vatankhah 2013-09-28 12:02:55 UTC
No effect:


[root@localhost Library]# restorecon -v /etc/ipsec.secrets 
[root@localhost Library]# ls -Z /etc/ipsec.secrets 
-rw-------. root root system_u:object_r:etc_t:s0       /etc/ipsec.secrets
[root@localhost Library]# rpm -q selinux-policy
selinux-policy-3.12.1-74.8.fc19.noarch
[root@localhost Library]# rpm -q selinux-policy-targeted
selinux-policy-targeted-3.12.1-74.8.fc19.noarch

Comment 8 Daniel Walsh 2013-09-29 11:56:30 UTC
Strange I see the patch in selinux-policy-3.12.1-74.8.fc19

grep ipsec.*secret /etc/selinux/targeted/contexts/files/file_contexts

Comment 9 Fedora Update System 2013-09-30 00:35:20 UTC
selinux-policy-3.12.1-74.8.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 10 Hedayat Vatankhah 2013-09-30 17:59:50 UTC
Not fixed.
Is the patch actually 'applied' to the package?

Comment 11 Lukas Vrabec 2013-10-08 13:32:23 UTC
Yes, patch above is included in selinux-policy-3.12.1-74.8.fc19.noarch

Comment 12 Fedora End Of Life 2015-01-09 22:19:01 UTC
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 13 Fedora End Of Life 2015-02-18 11:30:12 UTC
Fedora 19 changed to end-of-life (EOL) status on 2015-01-06. Fedora 19 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.