Bug 1007957

Summary: avc: denied { write } for pid=15191 comm="sleep.sh" name="sleep.log" dev="sda8" ino=792198 scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=file
Product: [Fedora] Fedora Reporter: Orion Poplawski <orion>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 19CC: dominick.grift, dwalsh, lvrabec, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-16 19:29:25 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:

Description Orion Poplawski 2013-09-13 15:47:40 UTC
Description of problem:

Seeing this when I close the lid on my laptop:

avc:  denied  { write } for  pid=15191 comm="sleep.sh" name="sleep.log" dev="sda8" ino=792198 scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=file

coming from /etc/acpi/actions/sleep.sh.

In permissive I get:

type=AVC msg=audit(1379087014.778:876): avc:  denied  { write } for  pid=25933 comm="sleep.sh" name="sleep.log" dev="sda8" ino=792198 scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=file
type=AVC msg=audit(1379087014.778:876): avc:  denied  { open } for  pid=25933 comm="sleep.sh" path="/var/log/sleep.log" dev="sda8" ino=792198 scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=file

/var/log/sleep.log already existed at that point, but wouldn't necessarily on a newly installed system.


Version-Release number of selected component (if applicable):
acpid-2.0.19-6.fc19.i686
selinux-policy-3.12.1-74.3.fc19.noarch

Comment 1 Daniel Walsh 2013-09-16 18:37:17 UTC
Where does /etc/acpi/actions/sleep.sh come from, it looks like we need  label for /var/log/sleep.log

apmd_log_t

If you renamed this to /var/log/acpid.sleep.log it would be labeled correctly.

Or 

semanage fcontext -a -t apmd_log_t '/var/log/sleep\.log'
restorecon -R -v /var/log/sleep.log

Comment 2 Orion Poplawski 2013-09-16 19:29:25 UTC
Sorry, I had thought this script was part of acpid, but it is our own custom script - so we need our own policy - or use the acpid.sleep.log name - thanks for that.