MailScanner Installation Guide - Postfix How mailscanner works with Postfix As with the other mail systems, MailScanner sits in between 2 copies of Postfix running on the same machine. The incoming one provides SMTP service and doesn't do any delivery, the outgoing one does all the delivery. MailScanner sits in between them and moves/copies messages as necessary from the delivery queue of the incoming Postfix to the incoming queue of the outgoing Postfix. How to Set Up Postfix for MailScanner Use 1. Install Postfix (version 1 or 2) and get it all working. 2. Stop Postfix using a command postfix stop 3. 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. 4. Copy the postfix configuration files for the incoming Postfix: cp -rp /etc/postfix /etc/postfix.in 5. Tell the incoming Postfix not to deliver mail: Edit /etc/postfix.in/main.cf and add a line at the top that says this: defer_transports = smtp local virtual relay 6. In the same file, look for the definition queue_directory = /var/spool/postfix and change it to queue_directory = /var/spool/postfix.in 7. If you have a chroot jail setup in /var/spool/postfix, copy the postfix spool are to the incoming setup using a command cp -rp /var/spool/postfix /var/spool/postfix.in Otherwise, just create the new spool directory for the incoming Postfix using a command mkdir /var/spool/postfix.in When the incoming Postfix starts up, it will create any missing files and directories it needs in there. 8. Tell the outgoing Postfix not to provide an SMTP service: Edit /etc/postfix/master.cf and comment out the following line by inserting a "#" at the start of the line: smtp inet n - y - - smtpd 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.in/deferred Outgoing Queue Dir = /var/spool/postfix/incoming MTA = postfix If you are using the RedHat RPM distribution, one change will enable all the Postfix support in the init.d script. Edit /etc/sysconfig/MailScanner and set 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, please edit /etc/sysconfig/MailScanner and set it up for your mail system. Then just use the init.d script to do it all for you: /etc/rc.d/init.d/MailScanner start (or on RedHat systems just service MailScanner start) If not using the RedHat RPM distribution, then 1. Start the incoming Postfix postfix -c /etc/postfix.in start 2. Start the outgoing Postfix postfix -c /etc/postfix start 3. Start MailScanner check_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 redhat-switchmail-nox and then pick the mail system you want to use. You should then edit /etc/sysconfig/MailScanner to match that setting. 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. Julian Field