Difference between revisions of "ClamAV"

From ArchWiki
Jump to: navigation, search
(Just a stub before, kinda is still but better, better organized, got the basics)
m (Scan for Viruses)
(40 intermediate revisions by 23 users not shown)
Line 1: Line 1:
{{i18n_links_start}}
+
[[Category:Security]]
{{i18n_entry|English|Install and configure Antivirus ClamAV}}
+
[[es:ClamAV]]
{{i18n_entry|Español|Cómo instalar y configurar ClamAV Antivirus}}
+
[[it:ClamAV]]
{{i18n_links_end}}
+
[[ru:ClamAV]]
 +
[[sr:ClamAV]]
 +
[[zh-CN:ClamAV]]
 +
[http://www.clamav.net Clam AntiVirus] is an open source (GPL) anti-virus toolkit for UNIX.  It provides a number of utilities including a flexible and scalable multi-threaded daemon, a command line scanner and advanced tool for automatic database updates.  Because ClamAV's main use is on file/mail servers for Windows desktops it primarily detects Windows viruses and malware.
  
Clam AntiVirus is an open source (GPL) anti-virus toolkit for UNIX.  It provides a number of utilities including a flexible and scalable multi-threaded daemon, a command line scanner and advanced tool for automatic database updates.  Because ClamAV's main use is on file/mail servers for Windows desktops it primarily detects Windows viruses and malware.
+
== Installation ==
 +
ClamAV can be [[pacman|installed]] with package {{Pkg|clamav}}, available in the [[Official Repositories]].
  
=Install=
+
== Configuration ==
 +
Whether you are going to use clamav as a daemon or use it as a simple file checker you need to comment out the line that contains the word ''Example'', usually it is found at the beginning of {{ic|/etc/clamav/freshclam.conf}} and {{ic|/etc/clamav/clamd.conf}} files.
  
Install with pacman by:
+
== Starting the daemon ==
 +
The service is called {{ic|clamd.service}}. Read [[Daemons]] for more information about starting it and enabling it to start at boot.
  
pacman -Sy clamav
+
Also change the start options from "no" to "yes":
  
=Configure=
+
{{hc|/etc/conf.d/clamav|<nowiki>
 
+
# change these to "yes" to start
To run as a server edit {{Filename|/etc/clamav/clamd.conf}} and {{Filename|/etc/clamav/freshclam.conf}} and comment out the ''Example'' flag.  In {{Filename|/etc/conf.d/clamav}} change the start options from "no" to "yes".
+
 
+
<pre># change these to "yes" to start
+
 
START_FRESHCLAM="yes"
 
START_FRESHCLAM="yes"
START_CLAMD="yes"</pre>
+
START_CLAMD="yes"
 +
</nowiki>}}
  
* To start clamav at boot edit {{Filename|/etc/rc.conf}} and add clamav.
+
== Updating database ==
 +
Edit the below file and comment out the line saying "Example"
 +
{{hc|/etc/clamav/freshclam.conf|
 +
# Comment or remove the line below.
 +
# Example
 +
}}
  
=Update Database=
+
Update the virus definitions with:
 +
# freshclam
  
The daemon needs to be running for the virus update to be updated:
+
The database files are saved in:
 +
/var/lib/clamav/daily.cvd
 +
/var/lib/clamav/main.cvd
  
/etc/rc.d/clamav start
+
== Scan for Viruses ==
 +
{{ic|clamscan}} can be used to scan certain files, home directory, or an entire system:
  
Then update the virus definitions with:
+
$ clamscan myfile
 +
$ clamscan -r -i /home
 +
$ clamscan -r -i --exclude-dir=^/sys\|^/proc\|^/dev /
  
freshclam
+
If you would like {{ic|clamscan}} to remove the infected file use the {{ic|--remove}} option in the command.
  
=Scan for Viruses=
+
Using the {{ic|-l <path to file>}} option will print the {{ic|clamscan}} logs to a text file for locating reported infections.
 
+
<code>clamscan</code> can be used to scan certain files, home directory, or an entire system:
+
 
+
  clamscan myfile
+
clamscan -r -i /home
+
clamscan -r -i --exclude-dir=^/sys\|^/proc\|^/dev /
+
 
+
If you'd like <code>clamscan</code> to remove the infected file use the <code>--remove</code> variable in the command.
+
 
+
=Troubleshooting=
+
  
 +
== Troubleshooting ==
 +
=== Error: Clamd was NOT notified ===
 
If you get the following messages after running freshclam:
 
If you get the following messages after running freshclam:
 +
{{bc|
 +
WARNING: Clamd was NOT notified: Cannot connect to clamd through
 +
/var/lib/clamav/clamd.sock connect(): No such file or directory
 +
}}
  
<pre>WARNING: Clamd was NOT notified: Can't connect to clamd through
+
Add a sock file for clamav:
/var/lib/clamav/clamd.sock connect(): No such file or directory </pre>
+
{{bc|
 
+
# touch /var/lib/clamav/clamd.sock
Add a sock file for clamav
+
# chown clamav:clamav /var/lib/clamav/clamd.sock
 
+
}}
touch /var/lib/clamav/clamd.sock
+
Then, edit {{Ic|/etc/clamav/clamd.conf}} &ndash; uncomment this line:
chown clamav:clamav /var/lib/clamav/clamd.sock
+
{{bc|LocalSocket /var/lib/clamav/clamd.sock}}
 +
Save the file and [[Daemons|restart the daemon]]
  
 +
=== Error: No supported database files found ===
 
If you get the next error when starting the daemon:
 
If you get the next error when starting the daemon:
<pre>LibClamAV Error: cli_loaddb(): No supported database files found
+
{{bc|
in /var/lib/clamav ERROR: Not supported data format</pre>
+
LibClamAV Error: cli_loaddb(): No supported database files found
 +
in /var/lib/clamav ERROR: Not supported data format
 +
}}
 
   
 
   
 
Run freshclam as root:
 
Run freshclam as root:
freshclam -v
+
{{bc|# freshclam -v}}
 +
 
 +
=== Error: Can't create temporary directory ===
 +
If you get the following error, along with a 'HINT' containing a UID and a GID number:
 +
{{bc|# can't create temporary directory}}
 +
 
 +
Do the following:
 +
{{bc|# chown UID:GID /var/lib/clamav & chmod 755 /var/lib/clamav}}

Revision as of 15:06, 9 March 2013

Clam AntiVirus is an open source (GPL) anti-virus toolkit for UNIX. It provides a number of utilities including a flexible and scalable multi-threaded daemon, a command line scanner and advanced tool for automatic database updates. Because ClamAV's main use is on file/mail servers for Windows desktops it primarily detects Windows viruses and malware.

Installation

ClamAV can be installed with package clamav, available in the Official Repositories.

Configuration

Whether you are going to use clamav as a daemon or use it as a simple file checker you need to comment out the line that contains the word Example, usually it is found at the beginning of /etc/clamav/freshclam.conf and /etc/clamav/clamd.conf files.

Starting the daemon

The service is called clamd.service. Read Daemons for more information about starting it and enabling it to start at boot.

Also change the start options from "no" to "yes":

/etc/conf.d/clamav
# change these to "yes" to start
START_FRESHCLAM="yes"
START_CLAMD="yes"

Updating database

Edit the below file and comment out the line saying "Example"

/etc/clamav/freshclam.conf
# Comment or remove the line below.
# Example

Update the virus definitions with:

# freshclam

The database files are saved in:

/var/lib/clamav/daily.cvd
/var/lib/clamav/main.cvd

Scan for Viruses

clamscan can be used to scan certain files, home directory, or an entire system:

$ clamscan myfile
$ clamscan -r -i /home
$ clamscan -r -i --exclude-dir=^/sys\|^/proc\|^/dev /

If you would like clamscan to remove the infected file use the --remove option in the command.

Using the -l <path to file> option will print the clamscan logs to a text file for locating reported infections.

Troubleshooting

Error: Clamd was NOT notified

If you get the following messages after running freshclam:

WARNING: Clamd was NOT notified: Cannot connect to clamd through 
/var/lib/clamav/clamd.sock connect(): No such file or directory

Add a sock file for clamav:

# touch /var/lib/clamav/clamd.sock
# chown clamav:clamav /var/lib/clamav/clamd.sock

Then, edit /etc/clamav/clamd.conf – uncomment this line:

LocalSocket /var/lib/clamav/clamd.sock

Save the file and restart the daemon

Error: No supported database files found

If you get the next error when starting the daemon:

LibClamAV Error: cli_loaddb(): No supported database files found
in /var/lib/clamav ERROR: Not supported data format

Run freshclam as root:

# freshclam -v

Error: Can't create temporary directory

If you get the following error, along with a 'HINT' containing a UID and a GID number:

# can't create temporary directory

Do the following:

# chown UID:GID /var/lib/clamav & chmod 755 /var/lib/clamav