Changes

From Amahi Wiki
Jump to: navigation, search
2,242 bytes added ,  01:05, 15 September 2015
no edit summary
ClamAV is an open source (GPL) antivirus engine designed for detecting Trojans, viruses, malware and other malicious threats on Linux. In this article, we will only be configuring ClamAV to run scheduled/on-demand scans; not resident scans.
 
'''NOTE:''' This guidance is for Amahi 7/8, but can be easily adapted for Ubuntu.
== Install ==
And you’re done! That should be the minimum required to install ClamAV and Perform a daily scan of a specific directory.
'''NOTE:''' You will need to enable email on your HDA to use option "b". See [[Main_Page#Community_Tutorials|Community Tutorials]] for guidance.
== Configure Virus Definitions Update ==The following will ensure your virus definitions are updated hourly. * Execute the following as root user: touch /var/log/clamav/freshclam.log chmod 600 /var/log/clamav/freshclam.log chown clamupdate /var/log/clamav/freshclam.log* Set up cron job N * * * * /bin/freshclam --quiet '''NOTE:''' You will need Change N to enable email on your HDA to use option "b"any value between 3 and 57 for minutes. See [[Main_Page#Community_Tutorials|Community Tutorials]] for guidanceThis will help prevent conflicts with other cron jobs that typically run at 0.
==== Using Greyhole ====
You will need to do some additional setup to scan files when using Greyhole.
* Set up [https://wiki.amahi.org/index.php/[Mount_Shares_Locally |mount shares locally]]
* Ensure the SCAN_DIR= <code>/mnt/samba/share</code> and not <code>/var/hda/files/share</code>
 
Now when the daily scan runs, it will scan the Greyhole enabled share correctly.
==Incremental Daily and Full Weekly Scans ==ReferencesYou can expand on the above by making a daily cronjob script that only scans files changed in the last 24 hours, and a weekly cronjob script ("a" or "b" above) that does a full filesystem scan. You may choose to do this for reasons of efficiency, as scanning only the files changed in the last 24 hours is an order of magnitude faster. Your daily cron file would look something more like this:<pre>#!/usr/bin/env bash # VariablesDATE=$(date +%Y%m%d)DIR="/var/log/clamav"LIST="${DIR}/scan.$DATE"RESULTS="${DIR}/scanresults.${DATE}"# A list of partitions and/or directories to scan, in this example /, /boot and /home are on separate partitionsSCANDIRS="/ /boot /home"# Number of days to keep files generated by this script. Default is 7.LOGROTATION=7 # Remove files older than the number of days set with the $LOGROTATION variable.# One might choose to comment this out and keep the files for trend-tracing, breakfix etc), find ${DIR} -name "scan*" -mtime +${LOGROTATION} -exec rm -f {} \; # Generate a list of files created in the last 24 hours, this list is fed into clamscan# Because we're using -mount to prevent unwanted filesystem traversal, # you'll need to specify per partition or directory with the SCANDIRS variable.for S in ${SCANDIRS}; do find "${S}" -mount -mtime 0 >> "${LIST}"done # Run clamscan against the list of files and pipe the results out to the results file# -i prints only infected files, -f is the list of files to scan, and -l is the output logclamscan -i -f "${LIST}" -l "${RESULTS}"# Send email with results (uncomment line below to enable)# mail -s "HDA Daily Virus Scan - ${DATE}" user@mail.com < ${RESULTS}</pre> ==References==
* [https://www.centosblog.com/how-to-install-clamav-and-configure-daily-scanning-on-centos/ How to Install ClamAV and Configure Daily Scanning on CentOS]
* [https://hacking.im/automated-clam-antivirus-scanning-for-centos-servers Automated Clam AntiVirus scanning for CentOS/Ubuntu/Debian servers]
12,424

edits