Bug 216260

Summary: SELinux policy prevents clamd from starting
Product: [Fedora] Fedora Reporter: Gerald Leung <gerald.leung>
Component: selinux-policyAssignee: Daniel Walsh <dwalsh>
Status: CLOSED NOTABUG QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: 6CC: dwalsh
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-11-20 19:07:39 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 Gerald Leung 2006-11-18 04:46:02 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20061027 Firefox/2.0

Description of problem:
Clamd fails to start. Below is the information from /var/log/messages and /var/log/audit/audit.log.

Information from /var/log/messages:
Nov 17 23:08:38 doghouse clamd[22881]: clamd daemon 0.88.6 (OS: linux-gnu, ARCH:
 i386, CPU: i386) 
Nov 17 23:08:38 doghouse clamd[22881]: Log file size limit disabled. 
Nov 17 23:08:38 doghouse clamd[22881]: Running as user clamav (UID 514, GID 514)
 
Nov 17 23:08:38 doghouse clamd[22881]: Reading databases from /var/clamav 
Nov 17 23:08:38 doghouse clamd[22881]: Unable to open file or directory 


information from /var/log/audit/audit.log:
type=AVC msg=audit(1163822928.122:347): avc:  denied  { search } for  pid=22897 
comm="clamd" name="sys" dev=proc ino=-268435429 scontext=user_u:system_r:clamd_t
:s0 tcontext=system_u:object_r:sysctl_t:s0 tclass=dir
type=SYSCALL msg=audit(1163822928.122:347): arch=40000003 syscall=5 success=no e
xit=-13 a0=4fc7b35f a1=0 a2=4fc93ff4 a3=8d1c420 items=0 ppid=22896 pid=22897 aui
d=500 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) comm="c
lamd" exe="/usr/sbin/clamd" subj=user_u:system_r:clamd_t:s0 key=(null)
type=AVC msg=audit(1163822928.125:348): avc:  denied  { read } for  pid=22897 co
mm="clamd" name="clamav" dev=hda8 ino=256259 scontext=user_u:system_r:clamd_t:s0
 tcontext=system_u:object_r:var_t:s0 tclass=dir
type=SYSCALL msg=audit(1163822928.125:348): arch=40000003 syscall=5 success=no e
xit=-13 a0=8d1c2e8 a1=18800 a2=0 a3=8d1c420 items=0 ppid=22896 pid=22897 auid=50
0 uid=514 gid=514 euid=514 suid=514 fsuid=514 egid=514 sgid=514 fsgid=514 tty=(n
one) comm="clamd" exe="/usr/sbin/clamd" subj=user_u:system_r:clamd_t:s0 key=(nul
l)


Version-Release number of selected component (if applicable):
selinux-policy-2.4.3-2

How reproducible:
Always


Steps to Reproduce:
1. # /etc/init.d/clamd start

Actual Results:
Clamd fails to start and terminal displays the following message:
Starting Clam AntiVirus Daemon:                            [FAILED]


Expected Results:
Clamd starts and terminal displays the following message:
Starting Clam AntiVirus Daemon:                            [  OK  ]


Additional info:
clamav-0.88.6-1

Comment 1 Daniel Walsh 2006-11-20 19:07:39 UTC
This looks like a packageing problem.  SELinux expects /var/lib/clamav instead
of /var/clamav.  THis is the path in the fedora-extras package.

If you need to use /var/clamav, you can change the file context to 
clamd_var_lib_t

And then use semanage fcontext -a -t clamd_var_lib_t /var/clamav

Or if you move the directory to /var/lib you need to restorecon -R -v
/var/lib/clamav  (Which I recommend)