Howto – Postfix

Using MailScanner with Postfix

Postfix can be handled slightly differently from the other supported mail systems, as one copy of Postfix can handle both the incoming mail via SMTP, and the outgoing mail by doing all the delivery.

How to Set Up Postfix for MailScanner Use
– Install Postfix and get the basics working

– Make sure you have the chroot jail set up in /var/spool/postfix. You should be able to see “etc”, “usr” and “lib” directories inside /var/spool/postfix. If you haven’t got the chroot jail setup already, then look in the “examples” directory of the Postfix documentation and you will find a script in there to set up it up for your operating system.

– In the Postfix configuration file /etc/postfix/main.cf add these lines:

# MailScanner milter
smtpd_milters = inet:127.0.0.1:33333
# MailScanner milter may use QMQP for delivery
qmqpd_authorized_clients = 127.0.0.1

How to Set up MailScanner for Use with Postfix

In your MailScanner.conf file (probably in /etc/MailScanner or /opt/MailScanner/etc), there are 5 settings you need to change. They are all really near the top of the file. The settings are:

Run As User = postfix
Run As Group = postfix
Incoming Queue Dir = /var/spool/MailScanner/milterin
Outgoing Queue Dir = /var/spool/MailScanner/milterout
MTA = msmail

Also, add the following lines.

MSMail Queue Type = short
Milter Scanner = yes
Milter Dispatcher = postfork
# For QMQP delivery
MSMail Delivery Method = QMQP
MSMail Socket Type = inet
MSMail Relay Port = 628
Milter Ignore Loopback = no

You will need to ensure that the user “postfix” can write to /var/spool/MailScanner/milterin and /var/spool/MailScanner/milterout:

chown postfix.postfix /var/spool/MailScanner/milterin
chown postfix.postfix /var/spool/MailScanner/milterout

Starting It All Running
Most systems MailScanner can be restarted with one of the following sets of commands:

SysV Init systems:

service mailscanner restart
service msmilter restart

Systemd systems:

systemctl restart mailscanner.service
systemctl restart msmilter.service

If you have made changes to the Postfix configuration, do one of the following:

SysV Init systems:

service postfix reload

Systemd systems:

systemctl reload postfix