Bug 710739

Summary: SELinux is preventing /sbin/apcupsd from read access on the lnk_file /var/lock
Product: [Fedora] Fedora Reporter: Stephen Cuppett <steve>
Component: apcupsdAssignee: Michal Hlavinka <mhlavink>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 15CC: mgrepl, mhlavink
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-11-09 14:17:19 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Stephen Cuppett 2011-06-04 12:40:04 UTC
Description of problem:

When apcupsd daemon is installed by default on SELinux enforcing Fedora 15 system, the daemon is not permitted to write/access all the locations configured by default.

This message popped on a fresh install of Fedora 15 x86_64 with LVM-based root partition and btrfs filesystem

Version-Release number of selected component (if applicable):

apcupsd-3.14.8-7.fc15.x86_64

How reproducible:


Steps to Reproduce:
1. Install Fedora 15
2. yum install apcupsd
3. /sbins/service apcupsd start
  
Actual results:

Daemon starts and begins popping SEAlerts

Expected results:

Daemon should function without problems.

Additional info:

Here is the entire sealert:

SELinux is preventing /sbin/apcupsd from read access on the lnk_file /var/lock.                                                                                                                                
                                                                                                                                                                                                               
*****  Plugin restorecon (94.8 confidence) suggests  *************************                                                                                                                                 
                                                                                                                                                                                                               
If you want to fix the label.                                                                                                                                                                                  
/var/lock default label should be var_lock_t.                                                                                                                                                                  
Then you can run restorecon.                                                                                                                                                                                   
Do                                                                                                                                                                                                             
# /sbin/restorecon -v /var/lock                                                                                                                                                                                
                                                                                                                                                                                                               
*****  Plugin catchall_labels (5.21 confidence) suggests  ********************                                                                                                                                 
                                                                                                                                                                                                               
If you want to allow apcupsd to have read access on the lock lnk_file                                                                                                                                          
Then you need to change the label on /var/lock                                                                                                                                                                 
Do                                                                                                                                                                                                             
# semanage fcontext -a -t FILE_TYPE '/var/lock'                                                                                                                                                                
where FILE_TYPE is one of the following: var_run_t, device_t, ld_so_t, proc_t, mta_exec_type, textrel_shlib_t, rpm_script_tmp_t, var_run_t, var_lock_t, bin_t, cert_t, device_t, devlog_t, locale_t, etc_t, proc_t, apcupsd_t, abrt_t, lib_t, root_t, init_t. 
Then execute: 
restorecon -v '/var/lock'


*****  Plugin catchall (1.44 confidence) suggests  ***************************

If you believe that apcupsd should be allowed read access on the lock lnk_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:
# grep apcupsd /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Comment 1 Miroslav Grepl 2011-06-06 12:21:46 UTC
# restorecon -R -v /var

will fix this issue.

Comment 2 Michal Hlavinka 2011-11-09 14:17:19 UTC
this should be caused just by wrong selinux context that can be fixed with command from comment #1. If it does not help, feel free to reopen.