Bug 892630

Summary: SELinux is preventing /usr/bin/freshclam from 'write' accesses on the directory /tmp.
Product: [Fedora] Fedora Reporter: birger <b1r63r>
Component: clamavAssignee: Sergio Basto <sergio>
Status: CLOSED WORKSFORME QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 27CC: dominick.grift, dwalsh, mgrepl, nathanael, ondrejj, redhat-bugzilla, rh-bugzilla, sergio, steve
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:e413d2dd35442913cc2e20953b20cb4cefdb5de16ec3de2a4629b29af9283126
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-07-29 08:15:10 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 birger 2013-01-07 13:22:42 UTC
Description of problem:
freshclam runs as a cron job. I got this notification from selinux as I logged on.
SELinux is preventing /usr/bin/freshclam from 'write' accesses on the directory /tmp.

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

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

Additional Information:
Source Context                system_u:system_r:freshclam_t:s0-s0:c0.c1023
Target Context                system_u:object_r:tmp_t:s0
Target Objects                /tmp [ dir ]
Source                        freshclam
Source Path                   /usr/bin/freshclam
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           clamav-update-0.97.6-1800.fc18.x86_64
Target RPM Packages           filesystem-3.1-2.fc18.x86_64
Policy RPM                    selinux-policy-3.11.1-67.fc18.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     (removed)
Platform                      Linux (removed) 3.6.10-5.fc18.x86_64 #1 SMP Fri
                              Dec 14 17:14:37 UTC 2012 x86_64 x86_64
Alert Count                   2
First Seen                    2013-01-06 09:12:01 CET
Last Seen                     2013-01-07 08:18:01 CET
Local ID                      52230957-c6fc-4e09-86cc-03d3b92c8c05

Raw Audit Messages
type=AVC msg=audit(1357543081.350:98): avc:  denied  { write } for  pid=8407 comm="freshclam" name="/" dev="tmpfs" ino=9804 scontext=system_u:system_r:freshclam_t:s0-s0:c0.c1023 tcontext=system_u:object_r:tmp_t:s0 tclass=dir


type=AVC msg=audit(1357543081.350:98): avc:  denied  { add_name } for  pid=8407 comm="freshclam" name="clamav-cron.log.8405" scontext=system_u:system_r:freshclam_t:s0-s0:c0.c1023 tcontext=system_u:object_r:tmp_t:s0 tclass=dir


type=AVC msg=audit(1357543081.350:98): avc:  denied  { create } for  pid=8407 comm="freshclam" name="clamav-cron.log.8405" scontext=system_u:system_r:freshclam_t:s0-s0:c0.c1023 tcontext=system_u:object_r:tmp_t:s0 tclass=file


type=AVC msg=audit(1357543081.350:98): avc:  denied  { open } for  pid=8407 comm="freshclam" path="/tmp/clamav-cron.log.8405" dev="tmpfs" ino=295991 scontext=system_u:system_r:freshclam_t:s0-s0:c0.c1023 tcontext=system_u:object_r:tmp_t:s0 tclass=file


type=SYSCALL msg=audit(1357543081.350:98): arch=x86_64 syscall=open success=yes exit=ESRCH a0=19c6230 a1=441 a2=1b6 a3=238 items=0 ppid=8405 pid=8407 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=3 comm=freshclam exe=/usr/bin/freshclam subj=system_u:system_r:freshclam_t:s0-s0:c0.c1023 key=(null)

Hash: freshclam,freshclam_t,tmp_t,dir,write

audit2allow

#============= freshclam_t ==============
#!!!! The source type 'freshclam_t' can write to a 'dir' of the following types:
# var_log_t, clamd_var_lib_t, clamd_var_run_t, var_run_t, antivirus_db_t, systemd_passwd_var_run_t, freshclam_var_log_t, amavis_spool_t

allow freshclam_t tmp_t:dir { write add_name };
#!!!! This avc can be allowed using the boolean 'antivirus_can_scan_system'

allow freshclam_t tmp_t:file open;
allow freshclam_t tmp_t:file create;

audit2allow -R

#============= freshclam_t ==============
#!!!! The source type 'freshclam_t' can write to a 'dir' of the following types:
# var_log_t, clamd_var_lib_t, clamd_var_run_t, var_run_t, antivirus_db_t, systemd_passwd_var_run_t, freshclam_var_log_t, amavis_spool_t

allow freshclam_t tmp_t:dir { write add_name };
#!!!! This avc can be allowed using the boolean 'antivirus_can_scan_system'

allow freshclam_t tmp_t:file open;
allow freshclam_t tmp_t:file create;


Additional info:
hashmarkername: setroubleshoot
kernel:         3.6.11-3.fc18.x86_64
type:           libreport

Comment 1 Daniel Walsh 2013-01-07 21:51:29 UTC
Why did you setup the log files to go to /tmp rather then /var/log?

Comment 2 birger 2013-01-08 06:46:09 UTC
No, this system was installed with f17 shortly before f18 went beta and then upgraded the first day of the beta. I think clam was installed on f17

Comment 3 Daniel Walsh 2013-01-09 22:13:35 UTC
Could you look at your configuration and see if it is setup to write to /tmp?

comm="freshclam" path="/tmp/clamav-cron.log.8405"

Comment 4 birger 2013-01-17 10:24:33 UTC
The only lines in my /etc/freshclam.conf that are not commented out are:

LogSyslog yes
DatabaseMirror db.no.clamav.net
DatabaseMirror database.clamav.net

Comment 5 Daniel Walsh 2013-01-21 21:55:27 UTC
I guess clam guys will hve to figure this out.

Comment 6 Fedora Admin XMLRPC Client 2013-02-27 21:05:51 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 7 Fedora End Of Life 2013-12-21 10:14:16 UTC
This message is a reminder that Fedora 18 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 18. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '18'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 18's end of life.

Thank you for reporting this issue and we are sorry that we may not be 
able to fix it before Fedora 18 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior to Fedora 18's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 8 Fedora End Of Life 2014-02-05 14:31:13 UTC
Fedora 18 changed to end-of-life (EOL) status on 2014-01-14. Fedora 18 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 9 Sergio Basto 2018-03-12 22:09:08 UTC
A good howto [1] to help to fix selinux problems 

[1] 
https://hostpresto.com/community/tutorials/how-to-install-clamav-on-centos-7/

Comment 10 Sergio Basto 2018-07-29 08:15:10 UTC
This bug is not seen in el7 right now , Fedora 18 was a long time ago, closing worksforme