Bug 1519810

Summary: SELinux is preventing charon-nm from 'map' accesses on the file /home/mirek/.pki/goodboyKey.der.
Product: [Fedora] Fedora Reporter: Mirek Svoboda <goodmirek>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 27CC: dwalsh, lvrabec, mgrepl, plautrba, pmoore
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:0237fd26f53f96c19864d9861b2f2c9d14f1e670240b1a0b5e6c7a3b1c26f40e;VARIANT_ID=workstation;
Fixed In Version: selinux-policy-3.13.1-283.19.fc27 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-01-02 16:46:49 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 Mirek Svoboda 2017-12-01 13:36:14 UTC
Description of problem:
Trying to use IPSEC (strongswan) VPN connection via Gnome UI, with certificates stored at ~/.pki or ~/.cert

My investigation so far is below. My conclusions might be wrong as of my limited selinux knowledge.

Storing certificates at ~/.pki or ~/.cert works for OpenVPN.
OpenVPN arranges that probably via
userdom_read_home_certs(openvpn_t)
which seems to grant home_cert_t to openvpn_t.

We might need the same for ipsec_t, i.e.:
userdom_read_home_certs(ipsec_t)

as charon-nm runs as ipsec_t:
sudo ps -efZ | grep charon-nm
system_u:system_r:ipsec_t:s0    root      5968     1  0 12:08 ?        00:00:00 /usr/libexec/strongswan/charon-nm
SELinux is preventing charon-nm from 'map' accesses on the file /home/mirek/.pki/goodboyKey.der.

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

If you believe that charon-nm should be allowed map access on the goodboyKey.der 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 'charon-nm' --raw | audit2allow -M my-charonnm
# semodule -X 300 -i my-charonnm.pp

Additional Information:
Source Context                system_u:system_r:ipsec_t:s0
Target Context                unconfined_u:object_r:home_cert_t:s0
Target Objects                /home/mirek/.pki/goodboyKey.der [ file ]
Source                        charon-nm
Source Path                   charon-nm
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-283.17.fc27.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 4.14.2-300.fc27.x86_64 #1 SMP Mon
                              Nov 27 16:50:24 UTC 2017 x86_64 x86_64
Alert Count                   12
First Seen                    2017-12-01 12:08:23 CET
Last Seen                     2017-12-01 12:37:59 CET
Local ID                      2bc5dbd4-a342-4b5e-b111-0e506d38f026

Raw Audit Messages
type=AVC msg=audit(1512128279.544:524): avc:  denied  { map } for  pid=5968 comm="charon-nm" path="/home/mirek/.pki/goodboyKey.der" dev="sda1" ino=538683507 scontext=system_u:system_r:ipsec_t:s0 tcontext=unconfined_u:object_r:home_cert_t:s0 tclass=file permissive=0


Hash: charon-nm,ipsec_t,home_cert_t,file,map

Version-Release number of selected component:
selinux-policy-3.13.1-283.17.fc27.noarch

Additional info:
component:      selinux-policy
reporter:       libreport-2.9.3
hashmarkername: setroubleshoot
kernel:         4.14.2-300.fc27.x86_64
type:           libreport

Comment 1 Fedora Update System 2017-12-13 08:24:38 UTC
selinux-policy-3.13.1-283.18.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2017-8225c4e502

Comment 2 Fedora Update System 2017-12-14 11:11:05 UTC
selinux-policy-3.13.1-283.18.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-8225c4e502

Comment 3 Mirek Svoboda 2017-12-15 21:44:46 UTC
Description of problem:
Using NetworkManager, trying to establish IPSEC VPN connection with certificates (CA, user) and key (user) stored at ~/.pki

Version-Release number of selected component:
selinux-policy-3.13.1-283.18.fc27.noarch

Additional info:
reporter:       libreport-2.9.3
hashmarkername: setroubleshoot
kernel:         4.14.5-300.fc27.x86_64
type:           libreport

Comment 5 Fedora Update System 2017-12-20 11:22:23 UTC
selinux-policy-3.13.1-283.19.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2017-8225c4e502

Comment 6 Fedora Update System 2017-12-21 20:20:10 UTC
selinux-policy-3.13.1-283.19.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-8225c4e502

Comment 7 Fedora Update System 2018-01-02 16:46:49 UTC
selinux-policy-3.13.1-283.19.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.