Installing Simscan is quite easy, but be aware due to the dependency of gcc this takes a lot of time to install.
Before we install Simscan we need to install ripmime and gcc.
cd /usr/ports/mail/ripmime && make install clean BATCH=yes
Note This may take over an hour to install depending on your system.
cd /usr/ports/lang/gcc && make install clean BATCH=yes
Next lets grab Simscan and patch it.
fetch http://www.xfiles.dk/content/files/freebsd-qmail/simscan-1.4.0.tar.gz tar zxvfp simscan-1.4.0.tar.gz rm simscan-1.4.0.tar.gz cd simscan-1.4.0 patch < simscan-1.4.0-combined.4.patch
Next we ned to preconfigure Simscan.
./configure --enable-user=qscand --enable-spamc-user=y --enable-clamav=y --enable-attach=y --enable-spam=y --enable-dropmsg=y --enable-custom-smtp-reject=y --enable-spam-hits=12 --enable-spam-passthru=y --enable-clamdscan=/usr/local/bin/clamdscan --enable-ripmime=/usr/local/bin/ripmime --enable-sigtool-path=/usr/bin/sigtool
And finally install it.
make make install
Now create a simple control file.
vi /var/qmail/control/simcontrol
In that file enter the following (adjust to your needs).
:clam=yes,spam=yes,spam_hits=9.5,attach=.cmd:.com:.dll:.dot:.eml:.exe:.hta:.lnk:.pif:.reg:.scr:.url:.vbs:.wsh
We need to set the executable bit on the file as well.
chmod 755 /var/qmail/control/simcontrol
Next update the Simscan CDB file.
/var/qmail/bin/simscanmk /var/qmail/bin/simscanmk -g
And finally enable it every time qmail smtp is called.
vi /service/qmail-smtpd/run
Find all the “simscan” entry and uncomment i.e. remove the # so they look like this.
QMAILQUEUE="$VQ/bin/simscan" NOP0FCHECK=1 SIMSCAN_DEBUG=0 SIMSCAN_DEBUG_FILES=0
Note The line NOP0FCHECK=1 should stay the same this disregards windows machines with invalid reverse DNS.
We are all set after restarting qmail.
qmailctl restart
If you have a feeling this is not working for some reason you can debug simscan, edit the smtp run file and set debug to 3 then restart qmail
vi /service/qmail-smtpd/run
Change
SIMSCAN_DEBUG=0
To
SIMSCAN_DEBUG=3
And restart qmail.
qmailctl restart
Next inject a test msg and follow the log on screen as well as in /var/log/qmail/qmail-smtpd
cd /tmp fetch http://www.xfiles.dk/content/files/freebsd-qmail/mailtest.txt env QMAILQUEUE=/var/qmail/bin/simscan SIMSCAN_DEBUG=3 /var/qmail/bin/qmail-inject [email protected] < /tmp/mailtest.txt
Once you are done set back the debug flag to 0 in the smtp run file.
vi /service/qmail-smtpd/run
Change
SIMSCAN_DEBUG=3
To
SIMSCAN_DEBUG=0
And restart qmail
qmailctl restart