Monday, November 9, 2015

How Install/Configure a Relay Host

How Install/Configure a Relay Host

Purpose

This document describes how to install/configure a Relay Host server.

Target Audience

This document is intended for use by Systems Administrators who wish to install and configure a Relay host server.

Prerequisites

Hardened Linux 6 system

Installing a new Relay Host server

Install the required packages


# yum install postfix

Configuring the Relay Host

# vi         /etc/postfix/main.cf

Uncomment:
inet_interfaces = all

Comment:
inet_interfaces = localhost

Edit the following:
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, yourdomain.com
local_recipient_maps =
mynetworks = 10.120.22.0/16, 10.110.22.0/16


Edit /etc/postfix/main.cf and add these lines at the bottom,

transport_maps = hash:/etc/postfix/transport
smtp_generic_maps = hash:/etc/postfix/generic

Create a file named transport in /etc/postfix and add the following text,
*  smtp:smtp.youremailserver.com

Remember to swap “smtp.youremailserver.com” for the address of your email server.

Now create a file named generic and add the following:
@hostFQDN    hostname@domain.com

Now we need to compile those files using the postmap command,
# postmap /etc/postfix/transport
# postmap /etc/postfix/generic

Restart postfix and you should find all mails will be redirected to your email server.

On the client side, add the following:
relayhost = [an.ip.add.ress]
#  service postfix restart

Notes:
To see all mails in the current queue:
# mailq

To flush the mail queue run:
# postfix flush

To get the maximum queue lifetime
#  postconf maximal_queue_lifetime
maximal_queue_lifetime = 5d

To get the message size limit
# postconf message_size_limit
message_size_limit = 10240000

Start the Postfix Daemon

# service postfix start
# chkconfig postfix on

Finishing up


You have now successfully configured a new Relay Host server. 

No comments:

Post a Comment