There are basically two main security profit to using an postfix mx-gateway. One of, it’s much easier to keep secure a single SMTP gateway from external threats than it’s keep secure multiple internal e-mail servers. Second one is, separating Internet mail from internal mail permits one to move Internet mail transactions off the internal network entirely.
This article will describe how to configure mx-gateway in Postfix, which will first scan (Spam, Contents, Virus/Trojans) all incoming mails and then deliver to destination server.
The motivation for this is to improve security, since the email gateway hypothetically only exposes its SMTP port, and will not store any emails,
So first of all install MTA to accomplish the task. In this article we are using postfix MTA.
Now we need to do some configuration in postfix MTA open the postfix configuration file main.cf and append or uncomment the following lines
mydomain = localhost
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, $mydomain
relay_domains = linuxpcfix.com yourdomain.com
local_transport = error:local mail delivery is disabled
mynetworks = 127.0.0.0/8,
smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination
transport_maps = hash:/etc/postfix/transport
Now create the mail route map. Edit /etc/postfix/transport using vi editor and include following line:
yourdomain.com smtp:backend.domain.com
Top update the postfix database please perform the following command.
Note:: you can also use relay_recipient_maps directive to point a file that lists all of the email addresses for which the email gateway will accept mail.
user2@linuxpcfix.com OK
user1@yourdomain.com OK
user2@yourdomain.com OK
Finally restart the postfix
That’s it, now it’s time to confirm that mxgateway working or not.
Aug 13 00:27:21 mxgateway postfix/cleanup[393]: 358891A48A7: message-id=<53EB1313.7070909@gmail.com>
Aug 13 00:27:21 mxgateway postfix/qmgr[363]: 358891A48A7: from=
Aug 13 00:27:21 mxgateway postfix/smtpd[389]: disconnect from unknown[193.168.1.1]
Aug 13 00:27:42 mxgateway postfix/smtp[394]: 358891A48A7: to=
Aug 13 00:27:42 mxgateway postfix/qmgr[363]: 358891A48A7: removed