Bug 843431

Summary: SELinux is preventing /usr/bin/motion from 'write' accesses on the directory /var/motion.
Product: [Fedora] Fedora Reporter: D.S. Ljungmark <spider>
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
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:5a87c4ed54dce07ccc7c194d70b3a2d64c52808d793d27935b261d54323958e4
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-01 18:21:48 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 D.S. Ljungmark 2012-07-26 10:10:25 UTC
libreport version: 2.0.10
executable:     /usr/bin/python2.7
hashmarkername: setroubleshoot
kernel:         3.4.6-2.fc17.x86_64
time:           Thu 26 Jul 2012 12:10:09 PM CEST

description:
:SELinux is preventing /usr/bin/motion from 'write' accesses on the directory /var/motion.
:
:*****  Plugin catchall_labels (83.8 confidence) suggests  ********************
:
:If you want to allow motion to have write access on the motion directory
:Then you need to change the label on /var/motion
:Do
:# semanage fcontext -a -t FILE_TYPE '/var/motion'
:where FILE_TYPE is one of the following: tmpfs_t, zoneminder_var_lib_t, zoneminder_var_run_t, var_spool_t, var_log_t, var_lib_t, var_run_t, zoneminder_log_t, zoneminder_tmpfs_t, zoneminder_spool_t, root_t. 
:Then execute: 
:restorecon -v '/var/motion'
:
:
:*****  Plugin catchall (17.1 confidence) suggests  ***************************
:
:If you believe that motion should be allowed write access on the motion 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 motion /var/log/audit/audit.log | audit2allow -M mypol
:# semodule -i mypol.pp
:
:Additional Information:
:Source Context                system_u:system_r:zoneminder_t:s0
:Target Context                unconfined_u:object_r:var_t:s0
:Target Objects                /var/motion [ dir ]
:Source                        motion
:Source Path                   /usr/bin/motion
:Port                          <Unknown>
:Host                          (removed)
:Source RPM Packages           motion-3.3.0-trunkREV534.fc17.2.x86_64
:Target RPM Packages           
:Policy RPM                    selinux-policy-3.10.0-140.fc17.noarch
:Selinux Enabled               True
:Policy Type                   targeted
:Enforcing Mode                Enforcing
:Host Name                     (removed)
:Platform                      Linux (removed) 3.4.6-2.fc17.x86_64 #1 SMP
:                              Thu Jul 19 22:54:16 UTC 2012 x86_64 x86_64
:Alert Count                   4
:First Seen                    Thu 26 Jul 2012 12:02:42 PM CEST
:Last Seen                     Thu 26 Jul 2012 12:06:35 PM CEST
:Local ID                      a4daab9e-c165-4993-a32e-1492d3ebd8f4
:
:Raw Audit Messages
:type=AVC msg=audit(1343297195.189:119): avc:  denied  { write } for  pid=1917 comm="motion" name="motion" dev="dm-2" ino=2759320 scontext=system_u:system_r:zoneminder_t:s0 tcontext=unconfined_u:object_r:var_t:s0 tclass=dir
:
:
:type=AVC msg=audit(1343297195.189:119): avc:  denied  { add_name } for  pid=1917 comm="motion" name="02-20120726120635-00.jpg" scontext=system_u:system_r:zoneminder_t:s0 tcontext=unconfined_u:object_r:var_t:s0 tclass=dir
:
:
:type=AVC msg=audit(1343297195.189:119): avc:  denied  { create } for  pid=1917 comm="motion" name="02-20120726120635-00.jpg" scontext=system_u:system_r:zoneminder_t:s0 tcontext=system_u:object_r:var_t:s0 tclass=file
:
:
:type=AVC msg=audit(1343297195.189:119): avc:  denied  { write open } for  pid=1917 comm="motion" name="02-20120726120635-00.jpg" dev="dm-2" ino=2774183 scontext=system_u:system_r:zoneminder_t:s0 tcontext=system_u:object_r:var_t:s0 tclass=file
:
:
:type=SYSCALL msg=audit(1343297195.189:119): arch=x86_64 syscall=open success=yes exit=EBADF a0=7f6b1e739b20 a1=241 a2=1b6 a3=238 items=0 ppid=1 pid=1917 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=motion exe=/usr/bin/motion subj=system_u:system_r:zoneminder_t:s0 key=(null)
:
:Hash: motion,zoneminder_t,var_t,dir,write
:
:audit2allowunable to open /sys/fs/selinux/policy:  Permission denied
:
:
:audit2allow -Runable to open /sys/fs/selinux/policy:  Permission denied
:
:

Comment 1 Miroslav Grepl 2012-07-26 12:01:50 UTC
Please execute

# chcon -R -t zoneminder_var_lib_t /var/motion

will fix it for now.

Comment 2 Fedora Update System 2012-07-27 15:34:30 UTC
selinux-policy-3.10.0-142.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/selinux-policy-3.10.0-142.fc17

Comment 3 Fedora Update System 2012-07-28 01:24:19 UTC
Package selinux-policy-3.10.0-142.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-142.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-11215/selinux-policy-3.10.0-142.fc17
then log in and leave karma (feedback).

Comment 4 Fedora Update System 2012-08-01 18:21:48 UTC
selinux-policy-3.10.0-142.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.