MailScanner Installation (en)
Revision as of 08:25, 4 January 2025 by Onnowpurbo (talk | contribs) (Created page with "Setting up MailScanner on Ubuntu seems not to work. If you have already installed it, it is advisable to delete it first: /etc/init.d/mailscanner stop apt-get remove mailsc...")
Setting up MailScanner on Ubuntu seems not to work. If you have already installed it, it is advisable to delete it first:
/etc/init.d/mailscanner stop apt-get remove mailscanner
Postfix Installation
Install postfix:
sudo apt-get install postfix
Add to the end of /etc/postfix/main.cf:
vi /etc/postfix/main.cf header_checks = regexp:/etc/postfix/header_checks
Create the file /etc/postfix/header_checks:
vi /etc/postfix/header_checks /^Received:/ HOLD
MailScanner Installation
Install MailScanner and its companions:
sudo apt-get install mailscanner tnef unrar unzip pyzor razor
Update the ClamAV database:
freshclam
Make directories for SpamAssassin and set permissions:
mkdir /var/spool/MailScanner/incoming mkdir /var/spool/MailScanner/spamassassin chown -Rf postfix /var/spool/MailScanner
Backup and edit MailScanner.conf:
cp /etc/MailScanner/MailScanner.conf /etc/MailScanner/MailScanner.conf.bak vi /etc/MailScanner/MailScanner.conf
Set the following in MailScanner.conf:
%org-name% = ORGNAME %org-long-name% = ORGFULLNAME %web-site% = ORGWEBSITE Run As User = postfix ATTENTION! Run As Group = postfix ATTENTION! Incoming Queue Dir = /var/spool/postfix/hold ATTENTION! Outgoing Queue Dir = /var/spool/postfix/incoming ATTENTION! MTA = postfix ATTENTION! Virus Scanners = clamav Spam List = SBL+XBL SpamAssassin User State Dir = /var/spool/MailScanner/spamassassin Spam Actions = deliver header "X-Spam-Status: Yes" High Scoring Spam Actions = delete Syslog Facility = local0 Log Spam = yes SpamAssassin User State Dir = /var/spool/MailScanner/spamassassin
Disable permission check by MailScanner on /var:
vi /etc/rc2.d/S20mailscanner
Edit to:
# check_dir /var/spool/MailScanner ${user:-mail} ${group:-mail} # check_dir /var/lib/MailScanner ${user:-mail} ${group:-mail} # check_dir /var/run/MailScanner ${user:-mail} ${group:-mail} # check_dir /var/lock/subsys/MailScanner ${user:-mail} ${group:-mail}
Set the default MailScanner:
vi /etc/default/mailscanner
Make sure:
run_mailscanner=1
Create Directories & Change Permissions:
sudo cp /etc/MailScanner/MailScanner.conf /etc/MailScanner/conf.d/ sudo mkdir /var/spool/MailScanner/spamassassin sudo mkdir /var/run/MailScanner sudo mkdir /var/lock sudo mkdir /var/lock/subsys sudo mkdir /var/lock/subsys/MailScanner sudo chown -R postfix:postfix /var/spool/MailScanner sudo chown -R postfix:postfix /var/lib/MailScanner sudo chown -R postfix:postfix /var/run/MailScanner sudo chown -R postfix:postfix /var/lock/subsys/MailScanner
Edit /etc/syslog.conf:
vi /etc/syslog.conf local0.* -/var/log/mailscanner.log
Start the system:
sudo /etc/init.d/syslogd restart sudo /etc/init.d/mailscanner restart sudo /etc/init.d/postfix restart
Fix for Ubuntu 8.04
If MailScanner deletes its directories, add the following to /etc/rc.local:
mkdir /var/run/MailScanner mkdir /var/lock/subsys mkdir /var/lock/subsys/MailScanner chown -R postfix:postfix /var/run/MailScanner chown -R postfix:postfix /var/lock/subsys/MailScanner /etc/init.d/postfix restart /etc/init.d/mailscanner restart
References
- http://www.mailscanner.info/
- http://www.mailscanner.info/documentation.html
- http://www.mailscanner.info/install_guides.html
- http://www.mailscanner.info/ubuntu.html
- http://www.howforge.com/how-install-mailscanner-ubuntu-dapper
- http://xmodulo.com/clam-antivirus-spamassassin-mailscanner-ubuntu-mail-server.html