Bug 963631

Summary: SELinux is preventing /usr/sbin/openvpn from read, write access on the directory /var/log/openvpn.
Product: [Fedora] Fedora Reporter: bob mckay <urilabob>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: dominick.grift, dwalsh, mgrepl, rhbugzilla
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:9d8466b1cd5450d9479df7dbb1822b1dd63f76bdccd1df823472a205604529aa
Fixed In Version: selinux-policy-3.10.0-170.fc17 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-06-24 03:28:17 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 bob mckay 2013-05-16 09:51:14 UTC
Description of problem:
Installed openvpn server long ago

openvpn server stopped working after the latest (3.8.12) kernel update to F17 (server will not start due to selinux errors on /var/log/openvpn/openvpn). The included sealert message comes from

    systemctl restart scopen.openvpn.service

I followed the sealert instructions to allow this access, which changed the results, but am still getting 

   Options error: --status fails with '/var/log/openvpn/openvpn-status.log': Permission denied
   Options error: Please correct these errors.

in /var/log/messages and /var/log/openvpn/openvpn.log. The permissions of openvpn.log and openvpn-status.log are identical

   -rw-rw----. root openvpn system_u:object_r:openvpn_var_log_t:s0 openvpn.log
   -rw-rw----. root openvpn system_u:object_r:openvpn_var_log_t:s0 openvpn-status.log

hence it's hard to understand how the process is able to write the error message to openvpn.log, but not the status to openvpn-status.log
SELinux is preventing /usr/sbin/openvpn from read, write access on the directory /var/log/openvpn.

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

If you believe that openvpn should be allowed read write access on the openvpn directory 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 openvpn /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:openvpn_t:s0
Target Context                system_u:object_r:openvpn_var_log_t:s0
Target Objects                /var/log/openvpn [ dir ]
Source                        openvpn
Source Path                   /usr/sbin/openvpn
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           openvpn-2.3.1-2.fc17.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.10.0-169.fc17.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.8.12-100.fc17.x86_64 #1 SMP Wed
                              May 8 15:36:14 UTC 2013 x86_64 x86_64
Alert Count                   7
First Seen                    2013-05-16 16:57:34 KST
Last Seen                     2013-05-16 18:09:48 KST
Local ID                      b9a06393-08aa-480f-b821-1edd1b964abb

Raw Audit Messages
type=AVC msg=audit(1368695388.284:327): avc:  denied  { read write } for  pid=5450 comm="openvpn" name="openvpn" dev="dm-22" ino=2430 scontext=system_u:system_r:openvpn_t:s0 tcontext=system_u:object_r:openvpn_var_log_t:s0 tclass=dir


type=SYSCALL msg=audit(1368695388.284:327): arch=x86_64 syscall=access success=no exit=EACCES a0=7f91c12759f0 a1=7 a2=7f91c1275a00 a3=2e7375746174732d items=0 ppid=1 pid=5450 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm=openvpn exe=/usr/sbin/openvpn subj=system_u:system_r:openvpn_t:s0 key=(null)

Hash: openvpn,openvpn_t,openvpn_var_log_t,dir,read,write

audit2allow

#============= openvpn_t ==============
#!!!! This avc is allowed in the current policy

allow openvpn_t openvpn_var_log_t:dir { read write };

audit2allow -R

#============= openvpn_t ==============
#!!!! This avc is allowed in the current policy

allow openvpn_t openvpn_var_log_t:dir { read write };


Additional info:
hashmarkername: setroubleshoot
kernel:         3.8.12-100.fc17.x86_64
type:           libreport

Comment 1 Miroslav Grepl 2013-05-16 11:29:33 UTC
commit 6a593af6c95531cd8d3104935eec25185f86fe04
Author: Miroslav Grepl <mgrepl>
Date:   Thu May 16 13:29:20 2013 +0200

    Allow openvpn to add own log files

Comment 2 Fedora Update System 2013-06-07 07:00:19 UTC
selinux-policy-3.10.0-170.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/selinux-policy-3.10.0-170.fc17

Comment 3 Fedora Update System 2013-06-07 23:27:17 UTC
Package selinux-policy-3.10.0-170.fc17:
* should fix your issue,
* was pushed to the Fedora 17 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.10.0-170.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-10302/selinux-policy-3.10.0-170.fc17
then log in and leave karma (feedback).

Comment 4 Fedora Update System 2013-06-24 03:28:17 UTC
selinux-policy-3.10.0-170.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.