RHEL6 – Simple Postfix Configuration

063-39_zSo in RHEL 6 the default MTA (mail transfer agent) is postfix. Sendmail is still around, however its not the default. So lets get down to business and configure postfix.

First lets go over a few key configuration settings in /etc/postfix/main.cf. Make sure that you memorize these configuration items.

 

Key Configuration Items:

  • inet_interfaces: This setting controls which interfaces postfix will LISTEN on for inbound email.
  • myorigin: This setting will rewrite local email to appear to come from the domain specified.
  • relayhost: The smart host to which to send all outbound mail.
  • mydestination: A list of domains that are to be delivered locally, that should not pass to the local relay.
  • local_transport: The default mail delivery transport and next-hop destination for final delivery to domains listed with $mydestination
  • mynetworks: list of ips and networks that can relay through an MTA.

 

Installing Postfix:

To install, start, and configure postfix to start at boot run the following.

#yum -y install postfix && chkconfig postfix on && service postfix start

 

Configure an Inbound Only (MX) Mail Server:

An Inbound only email server is going to be an external (internet) facing email server that's purpose is to receive email for a specific domain. In this example, fatmin.com. This server will not forward inbound email anywhere as this server will be where users access their mail. Emails will be stored locally in /var/spool/mail.  Any emails created on this server, for example using Dovecot ( a POP and IMAP Server) will be forwarded to a relay host to be sent.

To configure, make a backup of /etc/postfix/main.cf and then run the following commands.

#postconf -e inet_interfaces=all

#postconf -e myorigin=fatmin.com

#postconf -e 'relayhost=[smtp.fatmin.com]'

#postconf -e mydestination=fatmin.com

 

Configure an SMTP Outbound Mail Server:

An SMTP Outbound Server is one that will forward all email out to the internet for a given domain, which as stated above is fatmin.com in this example. It will listen for email coming in, but will be limited to accept emails only from the local network (otherwise it would be considered an open relay). No email will be stored locally in /var/spool/mail, so local transport will be disabled.

To configure, make a backup of /etc/postfix/main.cf and then run the following commands.

#postconf -e inet_interfaces=all

#postconf -e myorigin=fatmin.com

#postconf -e local_transport="error:local delivery disabled"

#postconf -e mynetworks="127.0.0.0/8, 10.1.224.0/24"

Configure a Null Email Client

A Null email client is used to create email and forward that email to the relay server or in this case the outbound SMTP server. Email should not be delivered to a Null Client.

 To configure, make a backup of /etc/postfix/main.cf and then run the following commands.

#postconf -e myorigin=fatmin.com

#postconf -e 'relayhost=[smtp.fatmin.com]'

#postconf -e local_transport="error:local delivery disabled"

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s