How to disable/enable SA, Clam AV or both in qmail-scanner.

At times you may want to disable/enable ClamAV or Spamassissin for a period of time without taking
the whole mailserver offline. An example of when you might want to do this is when upgrading to a
new version of either program, but doing it during normal hours rather than the middle of the
night. Of course, with this method if you disable or enable ClamAV for an upgrade you have no
antivirus/SA for incoming mail other than the simple checks that qmail-scanner makes.

To disable/enable SA, Clam or both:

Make a backup copy of qmail-scanner since editing it can be sometimes be touchy.


# cp /var/qmail/bin/qmail-scanner-queue.pl /var/qmail/bin/qmail-scanner-queue.pl.old

Now we need to edit qmail-scanner:


# vi /var/qmail/bin/qmail-scanner-queue.pl

Find the section that looks like the following:


my @scanners_installed=("clamdscan_scanner","spamassassin","perlscan_scanner");

The next section looks like this:


my @scanners_default=("clamdscan_scanner","spamassassin","perlscan_scanner");

Change the line to look like the follwing to run SA only:


my @scanners_installed=("spamassassin");

The next section should look like this:


my @scanners_default=("spamassassin");

Change the line to look like the follwing to run clamd only (this will be very rare if you have to do this):


my @scanners_installed=("clamdscan_scanner");

The next section should look like this:


my @scanners_default=("clamdscan_scanner");

Save the file and run the following commands for your OS to update qmail-scanner.


# setuidgid qscand /var/qmail/bin/qmail-scanner-queue.pl -g
# setuidgid qscand /var/qmail/bin/qmail-scanner-queue.pl -z