Linux Articles

Tuesday, August 05, 2008

SmartRelay DS Sendmail Relayhost Postfix smtproutes Qmail

Smart Relay Config relayhost in PostFix Like DS in Sendmail

SmartRelay Configuration and Relayhost in PostFix Like DS in Sendmail or Smtprouter in Qmail


Subject: 'Smartrelay Configuration' by 'relayhost on 'Postfix, DS on Sendmail and smtprouter in Qmail.

Problem: In Sendmail MTA, there is a configuration option, which called "Smart Relay" or “DS” on ‘sendmail.cf’ configuration file. Using this "Smart Relay" configuration option, you can forward all email to another email server without any DNS query for MX. Regardless of MX entry, any outgoing email will be forward to any pre-define host who handle /filter /control /exchange any outgoing email traffic to open Internet

An example of Smart Relay or DS or relayhost or smtprouter usages:

My internal network has a server, running Sendmail as MTA, who acts as an SMTP server for my organization. This server handles both internal and external outgoing email traffic. When this Sendmail SMTP server receive an email from my network user, having recipient to 'user@external-domain.name' which is an 'valid external Internet Email address' (Not Really valid, just to give example) it forward the email to other server. This internal server has no permission to directly communicate to any Internet host for our firewall. If someone run MX query for domain 'external-domain.name', he or she will get a result that host 'mx-01.external-domain.name' is MX for that said domain and responsible to receive deliver incoming email for domain ‘external-domain.name’ to its destination user mailbox. Now I want my internal SMTP server which having 'Smart Relay" option enable using ‘DS’ will not delivery this email directly to 'mx-01.external-domain.name' but to my other email gateway which host name is 'smtp.internal.name' having IP address ‘10.10.4.3’. Host 'smtp.internal.name' is my only host/server, who run ESMTP and deliver email to open Internet depends on the value of MX record of destination domain. My query to you is "what will be the configuration parameter of same system in Postfix"? In my Sendmail, currently I use option called ‘DS’ value is ‘DS [10.10.4.3]’. I am sure that you understand what I want to do. I am going to remove ‘Sendmail’ from my internal SMTP server and replace Postfix on it.

In any standard 'sendmail.cf' contains:

===== sendmail.cf file sniff ==========
(Just the DS part, Removed other info for easy understand.)

# "Smart" relay host (may be null)
DS[10.10.4.3]

(Just the DS part, Removed other info for easy understand.)
===== Sendmail.cf file sniff ============

This configuration indicates that mail will be relay in host with IP address 10.10.4.3 regardless of any MX or DNS settings. IP: 10.10.4.3 may be my 'Mail Scanner', 'Content Filter' or ‘any kind of ESMTP Server’ who work as per RFC rules and control outgoing emails.

Question is how can I setup ‘Smart Relay’ in Postfix or Qmail like the ‘DS’ option of Sendmail?


Solutions with Postfix relayhost:

Postfix is the best MTA,, Which I have seen in my life of Internet World.

To solve your problem, you just need to do maximum 3 steps! See bellow:

1. open 'main.cf' (Configuration file of Postfix) of a running Postfix and add following line to activate the DS option:

relayhost = [10.10.4.3]

2. Save the main.cf

3. Reload Postfix by command 'postfix reload'

WoW, you problem has been solved!! Remember to use the '[' and ']' as same as I wrote when your destination is an IP address. Bellow is a details about relayhost:

As per your requirment, best to use 'relayhost' option for your the problem.
Some Example are:

relayhost = [10.10.4.3]
relayhost = smtp.internal.name
relayhost = uucphost

First Line is used a lot as the outgoing email server IP normally as same as before.
If you write down the hostname (FQDN), no need to add '[' and ']' and the 3rd is for offline mailing. Now a days this 'UUCP' option is rarely used.

Note on Syntax: In the case of SMTP, specify a domain name, hostname, hostname:port, [hostname]:port, [hostaddress] or [hostaddress]:port.

Solutions with Qmail with smtprouter:

Qmail is other popular MTA for high load server, though I found Postfix is best;)

In your default installation, create a file on '/var/qmail/control/smtproutes'

This file ('/var/qmail/control/smtproutes' ) should contain only one line:

: smtp.internal.name

Save the file, and reload your qmail. That's it.

At this moment, I am not sure about the IP or other Syntax of this option of Qmail, Do some play with

:[10.10.4.3]
:smtp.internal.name
:uucphost
:10.10.4.3

etc etc.

Don't forget to inform me the result! Have a nice day ....

Main Article: http://www.bauani.org/thinkings/2008/02/smart-relay-config-relayhost-in-postfix.html

0 Comments:

Post a Comment



<< Home