How mailscanner works 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 version 2 and get it all working.
- Stop Postfix using a command
- 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. If you can't find that, then see the "Problems or Errors" section further down this page.
- At this point, things change from the setup for other MTAs as we can make it run with just one copy of Postfix, and let Postfix do the "split MTA" setup for us.
- In the Postfix configuration file /etc/postfix/main.cf add this line:
header_checks = regexp:/etc/postfix/header_checks
- In the file /etc/postfix/header_checks add this line:
The effect of this is to tell Postfix to move all messages to the HOLD queue.
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/postfix/hold Outgoing Queue Dir = /var/spool/postfix/incoming MTA = postfix
You will need to ensure that the user "postfix" can write to /var/spool/MailScanner/incoming and /var/spool/MailScanner/quarantine:
chown postfix.postfix /var/spool/MailScanner/incoming chown postfix.postfix /var/spool/MailScanner/quarantine
If you upgrade your copy of MailScanner, unfortunately these directories will be changed back to being owned by root, so you will have to do those 2 commands again.
Starting It All Running
If on a system installed using the RedHat RPM distribution, just use the init.d script to do it all for you:
(or on RedHat systems just service MailScanner start) If not using the RedHat RPM distribution, then
- Start Postfix
- Start MailScanner
Problems or Errors
If you are using RedHat Linux and Postfix or sendmail, please make sure that your system is switched to the correct mail system. You can set this by running the command
and then pick the mail system you want to use.
If you are using SuSE Linux, you will need to check you only have one of sendmail, Postfix or exim installed. The yast2 installation program can be used to do this.
- sendmail: invalid option -- O
- See the paragraph above. You have your RedHat system set to use Postfix while you are telling MailScanner to use sendmail. Both settings must be the same.
- Unknown service
- If you get lots of "smtp/tcp" "unknown service" errors in your maillog when you send a test message through it, then either your chroot jail is set up wrong or you haven't got one at all. Take a look in /etc/postfix/master.cf and find the "chroot" column in the table of settings. Set all "y" to "n" in this column so that it doesn't try to chroot.
- If you want to use chroot but can't get it right, then download a copy of Postfix version 2 from www.postfix.org. In the distribution documentation directories, you will find a script that will set up the chroot jail for your operating system. Run that script and then try using the chroot jail again.