From Indie IT Wiki
Jump to: navigation, search

HOWTO: Definitive Ubuntu Linux Installation Guide


HOWTO: Fix: Error: "plugin: failed to parse plugin (from @INC): Can't locate Mail/SpamAssassin/"

When you use Postfix and ClamAV for Ubuntu Server, and you run this command...

sudo -u postfix -g postfix /opt/MailScanner/bin/MailScanner --lint may receive this error...

plugin: failed to parse plugin (from @INC): Can't locate Mail/SpamAssassin/Plugin/   Permission denied at (eval 127) line 1.


The problem comes from running MailScanner --lint from the /root directory. Change to any other directory and the error goes away.

cd /var/spool/postfix
sudo -u postfix -g postfix /opt/MailScanner/bin/MailScanner --lint

Thanks -

HOWTO: Stop MailScanner

pkill MailScanner

HOWTO: Restart MailScanner

pkill -HUP MailScanner

HOWTO: Install On Ubuntu Linux

SPAM: Forward to Multiple Email Address

Set the following in MailScanner.conf

Spam Actions = /opt/MailScanner/etc/rules/spam.actions.rules

This is an example spam.actions.rules file...

FromOrTo:   delete   forward
FromOrTo:   delete   forward
FromOrTo:   delete   forward
FromOrTo:   default   delete   forward

Adding Multiple Signatures

Using Just The Server

Add the contents of the general signature to each one of the personal signatures.

Rename inline.sig.txt to uselesscrap.txt,

go to /opt/MailScanner/etc/reports/en/,

for a in *.sig.txt; do cat extrawords.txt >> $a; done

Then you can rename extrawords.txt back to inline.sig.txt.

Using The Client And The Server

Add the person's name, job title, email address + magic token.

Paul Littlefield
General Manager

...and make sure 'Sign Clean Messages' is enabled in the MailScanner.conf

Using ClamAV

Add or edit the following to the MailScanner configuration...

Incoming Work Dir = /var/spool/MailScanner/incoming
Incoming Work Group = clamav
Virus Scanners = clamd
Clamd Port = 3310
Clamd Socket = /var/run/clamav/clamd.sock
Clamd Lock File = # /var/lock/subsys/clamd
Clamd Use Threads = no
ClamAV Full Message Scan = yes

Fix the ownership and permissions of the working directory...

chgrp -R clamav /var/spool/MailScanner/incoming/*
chmod g+w /var/spool/MailScanner/incoming/*

Restart MailScanner...

killall MailScanner


If you receive the following errors on an auto update...

update.virus.scanners: Found generic installed
update.virus.scanners: Running autoupdate for generic
update.virus.scanners: Found clamav installed
update.virus.scanners: Running autoupdate for clamav
ClamAV-autoupdate[2903]: ClamAV updater /usr/local/bin/freshclam cannot be run

Then edit the virus scanners configuration file to (a) remove the generic option, and (b) put the correct path in...

clamd           /bin/false                              /usr      
#generic        /opt/MailScanner/lib/generic-wrapper    /

NOTE: freshclam is normally running and checks every hour anyway, so it be worth removing the update feature for this.

#clamd           /bin/false                              /usr      
#generic         /opt/MailScanner/lib/generic-wrapper    /

Using SpamAssassin


perl -MCPAN -e shell
razor-admin -home=/etc/mail/spamassassin/.razor -create
razor-admin -home=/etc/mail/spamassassin/.razor -discover
razor-admin -home=/etc/mail/spamassassin/.razor -register

HOWTO: Fix: ERROR:: UNKNOWN CLAMD RETURN ./lstat() failed: Permission denied. :: /var/spool/MailScanner/incoming/32410

sudo nano /etc/apparmor.d/usr.sbin.clamd
  /var/spool/MailScanner/** rw,
  /var/spool/MailScanner/incoming/** rw,
sudo /etc/init.d/apparmor reload
sudo start-stop-daemon -v --stop --pidfile /opt/MailScanner/var/

HOWTO: Fix: ERROR: Clamd::ERROR:: UNKNOWN CLAMD RETURN ./razor-agent.log/Access denied

sudo mkdir  /etc/mail/spamassassin/razor
sudo nano /etc/mail/spamassassin/razor.conf
     razorhome /etc/mail/spamassassin/razor
     logfile /var/log/razor-agent.log
sudo nano /etc/mail/spamassassin/
     razor_config /etc/mail/spamassassin/razor/razor-agents.conf
sudo pkill MailScanner 
sudo /opt/MailScanner/bin/check_mailscanner

Thanks -


Testing a file with Pyzor, Razor and DCC...

spamassassin -t -D -p /etc/mail/spamassassin/ </path/to/email/file

Fixing .docx Quarantine File Problems

If you get this error...

Report: MailScanner: Message contained archive nested too deeply

...then change the MailScanner.conf file setting

Maximum Archive Depth = 5

Release Quarantined Messages

If your MailScaner.conf setting says this...

Quarantine Whole Messages As Queue Files = no

...then do this...

cd /path/to/quarantine/dir
sendmail -i < message

Taken from