QClam is a simple program to plug ClamAV antivirus to your QMail mailbox. If has been tested with ClamAV version 0.8-0.88 and QMail 1.03 (should work with any newer versions). It runs from your ~/.qmail file. It receives incoming messages from QMail and scans them using clamscan; if a virus found, it returns 99 to QMail telling it that the message should not be processed (and it just gets removed). If no virus found, or there was an error calling clamscan, QClam returns 0 to QMail and it delivers message as usually. QClam also writes results of scanning into a log file (~/qclam.log by default) and can store copies of infected messages in a specified directory.
Advantages of QClam are that it's written in C and doesn't require any additional software (except OS, QMail and ClamAV) to run; it can be installed without "root" privileges; and its size is just a few kilobytes. The goal of creating QClam was to have a tiny, independent from any libraries (except standard runtime), easy to use "jackplug" between QMail and ClamAV. It's not going to be an all-in-one solution (capable to stick any antivirus into any function of any MTA or spam filter, with GUI and dozens plugins), but once you have ClamAV and QMail you can install it and have it working and killing virus emails in minutes.
When I wrote an original version of QClam, I couldn't find another similar solution. Unfortunately, my requests to put a link to QClam page I sent to QMail and ClamAV sites webmasters remained unreplied. When I looked at Third-party software at ClamAV homepage half year later, I was quite surprised how many people wrote very similar programs. Which one to use is fully up to you, of course.
PLEASE NOTE: by default, all messages in which clamscan will detect
viruses WILL BE DELETED!!!
Use --infected option if you don't trust ClamAV, but be careful with the saved infected files :-)
The installation is straightforward and should be familiar to anyone who uses Linux. Just note, there are two make targets:
$ su -c "make install"
- this will compile qclam and install it as /usr/local/bin/qclam
$ make install-home
- this will install qclam as ~/bin/qclam
Having qclam installed from RPM or source code,
edit your ~/.qmail file by adding a line:
|/path/to/qclam [qclam options]
Sample ~/.qmail file:
More "complex" example:
| nice -n 15 /usr/local/bin/qclam --temp /home/joe/qclam/temp --infected /home/joe/qclam/infected --log /home/joe/qclam/qclam.log ./Maildir/
Please refer to man qmail-command for more information about ~/.qmail.
qclam-0.8.tar.bz2 (17 Kb) [4376 d/l] - sources.
qclam-0.8-1.src.rpm (23 Kb) [4328 d/l] - source RPM.
qclam-0.8-1.i386.rpm (21 Kb) [4376 d/l] - binary RPM for ASP Linux 11.2.
v. 0.8, May 2007 - Dropped --mbox option. v. 0.7, January 2007 - Fixed 2 bugs, thanks to Thomas Feichter for spotting. - Names of saved infected messages contain date, not timestamp. v. 0.6, using a patch by Shlomi Fish, http://www.shlomifish.org/ - Conversion to C. - mkstemp() used to create temporary files (more secure) ;-) - A bit of bulletproofing. - --group is disabled when compiled with USEMKSTEMP. v. 0.5, January 2007 - Infected files can be saved into a custom directory specified by --infected. - Added --temp and --keep_tmp options. - tempnam() is used to create temporary file names. If you are concerned about "the potential security risk" with tempnam(), use some private directory for temporary files (see --temp option). - Added --group option. - Added --debug option. - Updates to Makefile. - Bugfixes. * v. 0.4, October 2004 - RPM/SRPM package. - Better AV execution error detection . * v. 0.3, October 3 2004 - clamdscan compatibility (doesn't work on some machines!) - Debugging options: - --log_stderr option; - QCLAM_DEBUG definition; - "make test" build target builds executable and executes 3 tests (requires RAR Archiver (http://rarsoft.com) to unpack Eicar AV test signature from eicar.rar) - Bugfixes. * v, 0.2, October 2 2004 - Added command-line options: --help, --version, --clam (allows to use custom path to clamscan executable), --log (allows to write log into a custom file). - Changed compiler command from gcc to g++ in Makefile (fixes compiling problems under recent Fedora, ASP Linux updates). - Fixed small typos in documentation. * v 0.1, March 2004 - First version released.