Bug 1005693 - SELinux is preventing /usr/bin/clamscan from 'write' accesses on the directory /home/frank/Viruses.
SELinux is preventing /usr/bin/clamscan from 'write' accesses on the director...
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: selinux-policy (Show other bugs)
20
x86_64 Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Miroslav Grepl
Fedora Extras Quality Assurance
abrt_hash:27c47b31bee900e81bf507a070a...
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-09 04:06 EDT by Frank Murphy
Modified: 2013-09-11 06:11 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-09-10 11:27:58 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Frank Murphy 2013-09-09 04:06:06 EDT
Description of problem:
booleans antivirus_use_jit, antivirus_can_scan_system, are in use.

This ia a daily cronjob as:
#!/bin/bash
clamscan -r / --exclude-dir=/proc --exclude-dir=/sys --exclude-dir=/dev --exclude=/home/frank/Viruses  --move=/home/frank/Viruses -i --log=/var/log/clamscan.log

already have a local fix in use:

cat F20clamscan01.te

module F20clamscan01 1.0;

require {
	type antivirus_t;
	type user_home_t;
	class dir add_name;
}

#============= antivirus_t ==============
allow antivirus_t user_home_t:dir add_name;



Now this new one:
grep clamscan /var/log/audit/audit.log | audit2allow -M F20clamscan02
Nothing to do

Confused, hence the report.
SELinux is preventing /usr/bin/clamscan from 'write' accesses on the directory /home/frank/Viruses.

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

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

Additional Information:
Source Context                system_u:system_r:antivirus_t:s0-s0:c0.c1023
Target Context                unconfined_u:object_r:user_home_t:s0
Target Objects                /home/frank/Viruses [ dir ]
Source                        clamscan
Source Path                   /usr/bin/clamscan
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           clamav-0.97.8-4.fc20.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-75.fc20.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.11.0-300.fc20.x86_64 #1 SMP Thu
                              Sep 5 18:52:54 UTC 2013 x86_64 x86_64
Alert Count                   1
First Seen                    2013-09-09 03:41:55 IST
Last Seen                     2013-09-09 03:41:55 IST
Local ID                      74a2e74b-f86d-4bd0-ab49-20036aa23ba7

Raw Audit Messages
type=AVC msg=audit(1378694515.604:24805): avc:  denied  { write } for  pid=19974 comm="clamscan" name="Viruses" dev="dm-2" ino=9307472 scontext=system_u:system_r:antivirus_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=dir


type=SYSCALL msg=audit(1378694515.604:24805): arch=x86_64 syscall=open success=no exit=EACCES a0=efdf30 a1=c1 a2=180 a3=2b items=0 ppid=19972 pid=19974 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=88 tty=(none) comm=clamscan exe=/usr/bin/clamscan subj=system_u:system_r:antivirus_t:s0-s0:c0.c1023 key=(null)

Hash: clamscan,antivirus_t,user_home_t,dir,write

Additional info:
reporter:       libreport-2.1.6
hashmarkername: setroubleshoot
kernel:         3.11.0-300.fc20.x86_64
type:           libreport
Comment 1 Miroslav Grepl 2013-09-09 13:30:17 EDT
You will need to add labeling (antivirus_db_t) for /home/frank/Viruses. Is this a default directory or your own setup?

You can test it using

# chcon -R -t antivirus_db_t /home/frank/Viruses

if it works.
Comment 2 Frank Murphy 2013-09-10 03:02:49 EDT
(In reply to Miroslav Grepl from comment #1)
> You will need to add labeling (antivirus_db_t) for /home/frank/Viruses. Is
> this a default directory or your own setup?

This was my own "virus-store"
move rather than remove.

> 
> You can test it using
> 
> # chcon -R -t antivirus_db_t /home/frank/Viruses
> 
> if it works.

That test worked

Appreciate the work you do.
Comment 3 Daniel Walsh 2013-09-10 11:27:58 EDT
Maybe we should add an antivirus_home_t?
Comment 4 Miroslav Grepl 2013-09-11 06:11:24 EDT
Yes, has been added.

Note You need to log in before you can comment on or make changes to this bug.