Difference between revisions of "ClamAV"

Proposal: Update - reorganization of the structure
(Removed invalid paramter clamdscan cronjob; add creating folder 'logs' +'quarantine' + ExcludePath in clamd.conf)
Tags: Mobile web edit Mobile edit
(Proposal: Update - reorganization of the structure)
Tags: Mobile web edit Mobile edit
Line 34: Line 34:
</syntaxhighlight>
</syntaxhighlight>


= Set up ClamAV = <!--T:8-->
= Set up ClamAV via CLI = <!--T:8-->
 
== Edit Config ==


<!--T:9-->
<!--T:9-->
Line 42: Line 44:
* <code>/etc/clamav/clamd.conf</code>
* <code>/etc/clamav/clamd.conf</code>
* <code>/etc/clamav/freshclam.conf</code>
* <code>/etc/clamav/freshclam.conf</code>
== Update Database ==


<!--T:11-->
<!--T:11-->
Line 53: Line 57:
<!--T:13-->
<!--T:13-->
You may get a notification that <code>clamd</code> was not notified.  This is normal because we haven't started the service yet.
You may get a notification that <code>clamd</code> was not notified.  This is normal because we haven't started the service yet.
== Services ==


<!--T:14-->
<!--T:14-->
Line 78: Line 84:
</syntaxhighlight>
</syntaxhighlight>


== Schedule scans and updates through <code>cron</code> == <!--T:23-->
== Schedule scans through 'cron' == <!--T:23-->
 
=== Edit 'crontab' ===


Run <code>crontab -e</code> to edit your <code>crontab</code> and add the following line, editing it to your needs:
Run <code>crontab -e</code> to edit your <code>crontab</code> and add the following line, editing it to your needs:
Line 88: Line 96:
This scans the entire <code>$HOME</code> directory every week on Saturday at 08:53. See <code>man 5 crontab</code> for more info on the formatting of this file and <code>man clamdscan</code> for an explanation of the options used.
This scans the entire <code>$HOME</code> directory every week on Saturday at 08:53. See <code>man 5 crontab</code> for more info on the formatting of this file and <code>man clamdscan</code> for an explanation of the options used.


=== Create directories 'logs' and 'quarantine' ===


If not already present, the directories for <code>'logs'</code> and <code>'quarantine'</code> are to be created in the <code>$HOME</code> directory:
If not already present, the directories for <code>'logs'</code> and <code>'quarantine'</code> are to be created in the <code>$HOME</code> directory:


<code>mkdir -p ${HOME}/.clam/quarantine && mkdir -p ${HOME}/.clam/logs</code>  
<syntaxhighlight lang="shell">
(Otherwise, for example, creating the logfile will fail due to missing authorization.)
mkdir -p "${HOME}/.clam/quarantine" && mkdir -p "${HOME}/.clam/logs"
</syntaxhighlight>
Otherwise, for example, creating the logfile may fail due to missing authorization.


=== Set ExcludePath for 'quarantine' folder ===


To exclude scanning the <code>'quarantine'</code> folder in the <code>$HOME</code> directory, add an <code>'ExcludePath'</code> to <code>'/etc/clamav/clamd.conf'</code> with your prefered editor, for example using 'vim':
To exclude scanning the <code>'quarantine'</code> folder in the <code>$HOME</code> directory, add an <code>'ExcludePath'</code> to <code>'/etc/clamav/clamd.conf'</code> with your prefered editor, for example using 'vim':


<code>sudo vim /etc/clamav/clamd.conf</code>
<syntaxhighlight lang="shell">
sudo vim /etc/clamav/clamd.conf
</syntaxhighlight>


Search for "ExcludePath" and add:
Search for <code>ExcludePath</code> and add:
<code>ExcludePath ^/home/.*/\.clam/quarantine</code>
<code>ExcludePath ^/home/.*/\.clam/quarantine</code>


Line 105: Line 119:
For more Information see <code>man clamdscan</code> and <code>man clamd.conf</code>.
For more Information see <code>man clamdscan</code> and <code>man clamd.conf</code>.


== Schedule updates through 'cron' ==


Then run <code>sudo crontab -e -u clamav</code> to set up automatic updates. (These should be run as the <code>clamav</code> user.) Add the following line to update these at 13 past every hour:
Then run <code>sudo crontab -e -u clamav</code> to set up automatic updates. (These should be run as the <code>clamav</code> user.) Add the following line to update these at 13 past every hour:
Line 112: Line 127:
</syntaxhighlight>
</syntaxhighlight>


= Alternatively, use ClamTK = <!--T:20-->
= Set up ClamAV via GUI (ClamTK) = <!--T:20-->


<!--T:21-->
<!--T:21-->
4

edits