Bug 660377 - selinux prevent openvpn read certs in user home dir
Summary: selinux prevent openvpn read certs in user home dir
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy-targeted
Version: 14
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-12-06 17:36 UTC by Gabriel Ramirez
Modified: 2011-01-24 19:26 UTC (History)
1 user (show)

Fixed In Version: selinux-policy-3.9.7-16.fc14
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-12-13 20:12:13 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
bug report from SELinux policy problem tool (2.89 KB, text/xml)
2011-01-24 19:09 UTC, Andrew Overholt
no flags Details

Description Gabriel Ramirez 2010-12-06 17:36:42 UTC
Description of problem:
Hello, 

I try to setup a openvpn client using kde-plasma-networkmanagement as non-root user and I put the openvpn files:
ca.crt
host.crt
host.key
ta.key

in ~/Profiles/openvpn

but selinux denies the openvpn access with two AVCs

1.- 
type=AVC msg=audit(1291655409.306:28134): avc:  denied  { read } for  pid=5671 comm="openvpn" name="host.crt" dev=dm-7 ino=1177596 scontext=system_u:system_r:openvpn_t:s0 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file

I fixed with:
sudo semanage fcontext -a --seuser system_u -t openvpn_etc_t '/home/user/Profiles/openvpn(/.*)?'

sudo restorecon -RFv /home/gabriel/Profiles/openvpn

2.-
type=AVC msg=audit(1291260835.088:27263): avc:  denied  { search } for  pid=3302 comm="openvpn" name="Profiles" dev=dm-7 ino=1175082 scontext=system_u:system_r:openvpn_t:s0 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=dir

and the above AVC I fixed generating a selinux module via audit2allow


Version-Release number of selected component (if applicable):
kde-plasma-networkmanagement-0.9-0.28.20101011.fc14.i686
knetworkmanager-openvpn-0.9-0.28.20101011.fc14.i686
NetworkManager-openvpn-0.8.1-1.fc14.i686
openvpn-2.1.1-2.fc13.i686
selinux-policy-targeted-3.9.7-14.fc14.noarch


How reproducible:
always

Steps to Reproduce:
1. try to setup a openvpn client via  kde-plasma-networkmanagement with the certs and key files in a user home dir
2.
3.
  
Actual results:

no openvpn connection will be initiated because selinux denies openvpn access to the files in the home dir

Expected results:

a working openvpn connection

Additional info:

I suppose which creating a openvpn_usercerts_t selinux type or something like that
and designate a directory under /home/user where to put the certs files will be sufficient,  because seems openvpn_t can read user_home_dir_t but not user_home_t

thanks,

Gabriel

Comment 1 Daniel Walsh 2010-12-06 19:28:31 UTC
~/.cert or ~/.pki are labeled for this purpose.  

Miroslav can you change user_read_home_certs to use

	userdom_search_user_home_content($1)

That way it can search any directory in ~ for home_cert_t.

Comment 2 Gabriel Ramirez 2010-12-06 21:50:51 UTC
thanks,

~/.pki/openvpn/ directory with the certs and keys worked just fine.

 thanks again, 

Gabriel

Comment 3 Miroslav Grepl 2010-12-09 11:46:52 UTC
Fixed in selinux-policy-3.9.7-16.fc14

Comment 4 Fedora Update System 2010-12-10 13:54:04 UTC
selinux-policy-3.9.7-16.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/selinux-policy-3.9.7-16.fc14

Comment 5 Fedora Update System 2010-12-10 20:28:30 UTC
selinux-policy-3.9.7-16.fc14 has been pushed to the Fedora 14 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update selinux-policy'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/selinux-policy-3.9.7-16.fc14

Comment 6 Fedora Update System 2010-12-13 20:11:12 UTC
selinux-policy-3.9.7-16.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 7 Andrew Overholt 2011-01-24 19:09:36 UTC
Created attachment 475024 [details]
bug report from SELinux policy problem tool

I just hit this with:

selinux-policy-targeted-3.9.7-20.fc14.noarch

I'll attach the report it generated.

Comment 8 Daniel Walsh 2011-01-24 19:26:24 UTC
Andrew the problem you have is the file is labeled incorrectly.

it should be home_cert_t.  Where is newca.crt located?


Note You need to log in before you can comment on or make changes to this bug.