Okay, so I run a relatively small mail server to handle my email… My email server of choice is SmarterMail, the management interface is entirely web driven, and it’s IMHO the best commercial option out there, especially for the price. I wish the same could be said for Antivirus protection on servers. This is a quick tutorial on getting ClamAV (ClamWin) running for your windows email server.
Worth noting is the fact that you have two choices for how to run the scan, either clamscan, or clamdscan (connecting to a clam daemon). If you run a high volume server, you will want to look into the clamd setup. There are several tutorials out there to do this, I am using the clamscan command line version.
The first thing you will need to do, is download and install the latest ClamWin antivirus release. Once this is done, you will need to reboot, and will have a nice systray icon for the management of ClamWin. You can right click on this icon, and select Configure ClamWin.
- On the “Advanced” tab, check “Treat Files As Mailboxes”
- On the “Archives” tab, check “Scan In Archives.” You will probably want to make certain the file size to scan up to matches, or exceeds the maximum mail/file size in the mail server.
- On the “Internet Updates” tab, you will want this enabled, and I would suggest setting it to hourly updates. The ClamAV team does a great job at keeping up with virii as they come out.
The next thing you will want to do, is setup a batch file for the scan. Here is the one I am using. You can save this to the root of your C: drive if you like. Or, modify as needed.
NOTE: I have my system date set to use yyyy-MM-dd as formatting for dates, the default will likely have issues with this batch file as is.
After you have ClamWin and the batch file in place, you will want to login as the admin user in smartermail. From the settings menu, click on Protocol Settings. Once you are on the Protocol Settings page, you should see an entry for “Command-line EXE or batch file to run on new mail” in this box, you will want to enter the following: c:clamscan.bat %filepath
Once you’ve saved your settings in SmarterMail, you should be set. If you decide you need a higher performing option, you will want to download the win32 release of ClamAV instead of ClamWin, and setup the clamd service. Another option, which includes clamd and SpamAssassin support is SMFilter.
Hopefully this quick tutorial is helpful. Many email servers support an event for running scripts, or executables against the inbound email spool. Similar settings are easily made. I will probably follow up this article with instructions for using the clamav-win32 release with clamd.
[tags]smtp, mail, batch files, antivirus[/tags]