Bug 1883666

Summary: libreswan moved NSS directory requires selinux-policy change
Product: [Fedora] Fedora Reporter: Paul Wouters <pwouters>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: high    
Version: 32CC: djuran, dwalsh, grepl.miroslav, jcall, komusubi, lvrabec, mmalik, plautrba, rl, stuart.lindley, tis, vmojzis, zpytela
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.14.5-46.fc32 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1895436 (view as bug list) Environment:
Last Closed: 2021-01-19 01:51:41 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:
Bug Depends On:    
Bug Blocks: 1895436    

Description Paul Wouters 2020-09-29 19:48:43 UTC
As of libreswan 4.0, the NSS database used is moved from /etc/ipsec.d to /var/lib/nss/ipsec/

This requires a selinux policy addition:


/var/lib/ipsec(/.*)?       gen_context(system_u:object_r:ipsec_key_file_t,s0)

Comment 1 Remco Luitwieler 2020-11-06 06:02:28 UTC
Fedora 32 has the same problem

Comment 2 Stuart 2020-11-06 11:05:55 UTC
I'm also experiencing this on Fedora 32 after downgrading(reinstalling) from 33

Comment 3 Paul Wouters 2020-11-06 13:38:39 UTC
as a workaround, you can specify nssdir=/etc/ipsec.d   in /etc/ipsec.conf  in "config setup"

Comment 4 Stuart 2020-11-06 13:44:16 UTC
Thats good to know. I've already posted this on the libswan's github tracker and a kind sole there gave me the following SELinux workaround:

semanage fcontext --add --type ipsec_key_file_t '/var/lib/ipsec(/.*)?'
restorecon -rv /var/lib/ipsec

And to undo after the package is fixed

semanage fcontext --delete --type ipsec_key_file_t '/var/lib/ipsec(/.*)?'

Comment 5 Zdenek Pytela 2020-11-06 18:44:42 UTC
In the bz description I can see contradicting path specification, I suppose it should be this one, but I'd rather have if confirmed: /var/lib/ipsec/nss

If keys are only in the nss subdirectory, I will set the file context only for this one.

I've just submitted a Fedora PR to address the issue:
https://github.com/fedora-selinux/selinux-policy/pull/472

Comment 6 Paul Wouters 2020-11-06 20:45:32 UTC
Yes, key material (public, private keys and certs) will only appear in /var/lib/ipsec/nss/

libreswna currently stores only the nss dir in /var/lib/ipsec/
We would have prefered to store it all there, but the debian maintainer wanted a seperate dir for nss, so we think it is better now to stick to one place instead of ending up with different places.

Setting it for only the nss directory is fine.

Comment 7 Zdenek Pytela 2020-12-03 14:28:03 UTC
Changing version for this BZ. This fix was backported.

Comment 8 Zdenek Pytela 2020-12-07 18:44:39 UTC
*** Bug 1895436 has been marked as a duplicate of this bug. ***

Comment 9 Fedora Update System 2021-01-13 20:01:20 UTC
FEDORA-2021-3036e7bf00 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2021-3036e7bf00

Comment 10 Fedora Update System 2021-01-14 02:22:43 UTC
FEDORA-2021-3036e7bf00 has been pushed to the Fedora 32 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-3036e7bf00`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-3036e7bf00

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 11 Fedora Update System 2021-01-19 01:51:41 UTC
FEDORA-2021-3036e7bf00 has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.