Bug 1012702

Summary: SELinux policy preventing openvpn_t file write access to openvpn_var_log_t
Product: [Fedora] Fedora Reporter: Scott Shambarger <scott-fedora>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: dominick.grift, dwalsh, lvrabec, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: selinux-policy-3.12.1-74.9.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-14 06:59:16 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:

Description Scott Shambarger 2013-09-26 23:25:30 UTC
Description of problem:
Openvpn cannot be configured to write log files.

Version-Release number of selected component (if applicable):
selinux-policy-3.12.1-74.4
openvpn-2.3.2-4

How reproducible:
Always

Steps to Reproduce:
1. Configure /etc/openvpn/server.conf to include the following entry:
--- edit begin
log /var/log/openvpn/openvpn.log
--- edit end
(note: /var/log/openvpn.log also fails)

2. Start the openvpn server

3. Check syslog and find the following error:
openvpn[####]: Warning: Error redirecting stdout/stderr to --log file: /var/log/openvpn/openvpn.log: Permission denied (errno=13)

Actual results:
Selinux prevented file write, audit2why shows:

type=AVC msg=audit(###): avc:  denied  { write } for  pid=#### comm="openvpn" name="openvpn.log" dev="dm-2" ino=1575681 scontext=system_u:system_r:openvpn_t:s0 tcontext=system_u:object_r:openvpn_var_log_t:s0 tclass=file

Expected results:
Log file may be written.

Additional info:

Relevant file_context is:

/var/log/openvpn.*      system_u:object_r:openvpn_var_log_t:s0                  

So any files prefixed with /var/log/openvpn should be an allowable log file context.

Adding the following to the policy

#============= openvpn_t ==============
allow openvpn_t openvpn_var_log_t:file write;

allows the log file to be written as expected, so no other permissions are in error.

Comment 3 Lukas Vrabec 2013-09-29 22:01:23 UTC
Hi Scott,

We fixed this bug. 
Fix will be included in the new version of selinux-policy package.

Comment 4 Fedora Update System 2013-10-08 20:47:15 UTC
selinux-policy-3.12.1-74.9.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/selinux-policy-3.12.1-74.9.fc19

Comment 5 Fedora Update System 2013-10-10 01:14:18 UTC
Package selinux-policy-3.12.1-74.9.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.9.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-18701/selinux-policy-3.12.1-74.9.fc19
then log in and leave karma (feedback).

Comment 6 Fedora Update System 2013-10-14 06:59:16 UTC
selinux-policy-3.12.1-74.9.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 7 Fedora Update System 2013-10-14 17:21:27 UTC
selinux-policy-3.12.1-74.9.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.