![]() |
Now serving 108 guides. |
|
Setting up a Postfix Mail Forwarder Introduction If you run a groupware email server on your LAN like Microsoft Exchange, Lotus Notes, or similar, setting up a secure mail forwarder is a good alternative to opening port 25 from the Internet directly to your LAN server. Typically with these servers, you don't want to put them on a DMZ segment for performance reasons, but you have to let in email from the Internet. Opening a port to these servers, and into your LAN, can be risky.The combination of Postfix and FreeBSD makes for a secure, low maintenance solution that just might help you sleep better at night. Example Infrastructure The following diagram depicts a typical setup of this type. The mail forwarder sits in the DMZ, with the groupware mail server on the LAN. The DNS MX records for your domain(s) point to the mail forwarder. You can set up two identical forwarders, one for a primary MX, and one for a secondary, for redundancy.
Firewall Configuration The firewall allows TCP 25 (SMTP) inbound to the mail forwarder. The mail forwarder is allowed to talk only to port 25 on the LAN mail server. This way even if the forwarder were to be compromised, its only access to the LAN is port 25 on your mail server. The chances of compromising the mail forwarder and then compromising the LAN through only TCP 25 on the mail server are slim to none. I would configure the firewall so it cannot talk out to anything but TCP 25 on the mail server, and possibly a NTP server (on the Internet or LAN) to synchronize time. Strictly limiting what outbound access the forwarder is allowed will make an attacker's job more difficult, as they will usually attempt to download tools, a root kit, or similar onto a compromised system. You'll need to permit outbound HTTP (TCP port 80), cvsup (TCP 5999), and DNS (UDP 53) during the initial setup and while performing updates, but should leave them closed during normal operation.Hardware Requirements In future articles, I plan to cover adding spam and virus filtering to this basic setup. If you want to simply forward mail without much processing like antivirus or spam protection, a very low power system will work fine. The lowest power system I have running a setup similar to this is a Pentium Pro 200 MHz with 128 MB RAM. It processes over 5,000 messages a day, and the load average stays around 0.05. It has a simple filtering setup, nothing nearly as taxing as any of the common spam filtering and virus scanning packages. The lowest powered setup of this nature I have is a Duron 800 MHz setup with FreeBSD, Postfix and SpamAssassin. It processes about 1500-2000 messages a day, with a typical load average of 0.02.In short, unless you're dealing with a huge mail volume, you don't need a huge machine for this purpose. For most environments, an old Pentium II or III desktop will be more than sufficient, even if you add spam or virus scanning at a later time. You can configure two forwarders for redundancy if you're worried about potential hardware failure on older equipment. Alternatively, you could use an embedded device like a Soekris 4801 with a small laptop hard drive. Suggested Minimum Requirements
Requirements
Installation First we'll install Postfix.
At the end of the installation, you'll be prompted for some configuration information.
Towards the end of the installation, you will be provided with some information on disabling Sendmail and setting Postfix to start at boot. We'll put a symbolic link in /usr/local/etc/rc.d and disable Sendmail in rc.conf. Edit /etc/rc.conf and change the sendmail_enable line to the following (if this line doesn't exist, add it anywhere in the file)
Configuration Postfix configuration files live in /usr/local/etc/postfix/.main.cf Configuration First we'll edit main.cf. You'll need to change four lines
If you want to accept mail for more than one domain, you'll need to go down further in the file where you see the example relay_domains entry and enter all the domains for which you wish to accept mail, including the primary domain.
Going down further in the file, find the local_recipient_maps section. Add a line as follows.
transport Configuration Next open the file called transport. This file contains only comments in the default installation. Go down to the bottom of the file. You'll need to enter something like the following, one line per domain.
Save and exit that file. Now we have to use postmap to create a lookup table from the transport file. Run the following command to accomplish this.
Testing the Configuration First we'll make sure there are no syntax errors in your configuration files.
To view the logs,
Conclusion After following this guide, you have a solid, secure, reliable mail forwarder in place to protect your more fragile groupware LAN mail server and help keep your network more secure. Look for future articles on adding spam filtering and antivirus scanning capabilities to this basic configuration.Author: Chris Buechler 2 Comments Posted by alex on May 02, 2005 at 5:59:27 am EEST
HI Chris
very good post but i'm waiting for continue post of antispam and antivirus Alex Posted by gkontos on December 30, 2006 at 1:20:30 pm EET
Hi Chris,
I think that instead of: postmap /usr/local/etc/postfix/transport you should: postmap hash:/usr/local/etc/postfix/transport and also add the following line to the main.cf transport_maps = hash:/usr/local/etc/postfix/transport |
Copyright 2003 - 2010 BSD Guides. All rights reserved. |
About | Terms of Use | Privacy | Contact |


