Messaging
cancel
Showing results for 
Search instead for 
Did you mean: 

Bypass Exchange Relay for specifc Domains?

SOLVED
Go to solution
Rcky Mntere
Regular Advisor

Bypass Exchange Relay for specifc Domains?

We have an HPUX IA 64 11.31 server configured to use the default relay in sendmail.cf:
DS

I am trying to bypass our internal relay (Exhange 2010 server) for only two specific domains: vtext.com and archwireless.net.
I have located these two domain relays:
69.78.128.213 or 69.78.67.53 for vtext.com
147.187.10.115 for archwireless.net

We wish to send mail (notification pages) directly to these domain relays:

all mail originating on the local server to @vtext.com to go directly to the vtext.com relays and all mail @archwireless.net to go directly to the archwireless relay and NOT to our internal relay

Is this possible? How does one set this up.
The local server DOES NOT relay mail for any other server on our network.

TIA

===========Example sendmail dump
note: 10.10.10.10 is our DNS server, 31.10.10.164 is the "local server" where the mail is originating from

sendmail -v -d8.99 -d38.99 5551234567@vtext.com
;; res_querydomain(mysys, myk12.org, 1, 1)
;; res_query(mysys.myk12.org, 1, 1)
;; Querying server (# 1) address = 10.10.10.10
seq_map_parse(aliases.files, )
;; res_query(1.0.0.0.in-addr.arpa, 1, 12)
;; Querying server (# 1) address = 10.10.10.10
;; rcode = 3, ancount=0
;; res_query(31.10.10.164.in-addr.arpa, 1, 12)
;; Querying server (# 1) address = 10.10.10.10
;; res_querydomain(mysys.myk12.org., , 1, 1)
;; res_query(mysys.myk12.org, 1, 1)
;; Querying server (# 1) address = 10.10.10.10
;; res_query(1.0.0.127.in-addr.arpa, 1, 12)
;; Querying server (# 1) address = 10.10.10.10
;; res_querydomain(localhost., , 1, 1)
;; res_query(localhost, 1, 1)
;; Querying server (# 1) address = 10.10.10.10
;; res_query(31.10.10.164.in-addr.arpa, 1, 12)
;; Querying server (# 1) address = 10.10.10.10
;; res_querydomain(mysys.myk12.org., , 1, 1)
;; res_query(mysys.myk12.org, 1, 1)
;; Querying server (# 1) address = 10.10.10.10
openmap() dequote:dequote NULL: valid
openmap() host:host NULL: valid
getcanonname(vtext.com), trying files
text_getcanonname(vtext.com)
getcanonname(vtext.com), trying dns
dns_getcanonname(vtext.com, trymx=1)
dns_getcanonname: trying vtext.com. (AAAA)
;; res_querydomain(vtext.com, , 1, 28)
;; res_query(vtext.com., 1, 28)
;; Querying server (# 1) address = 10.10.10.10
;; rcode = 0, ancount=0
NO: errno=0, h_errno=4
dns_getcanonname: trying vtext.com. (A)
;; res_querydomain(vtext.com, , 1, 1)
;; res_query(vtext.com., 1, 1)
;; Querying server (# 1) address = 10.10.10.10
YES
dns_getcanonname: vtext.com
getcanonname(vtext.com), found
test from mysys
.
getmxrr(vtext.com., droplocalhost=1)
;; res_querydomain(vtext.com., , 1, 15)
;; res_query(vtext.com, 1, 15)
;; Querying server (# 1) address = 10.10.10.10
5551234567@vtext.com... Connecting to smtp-bb.vtext.com. via esmtp...
;; res_querydomain(smtp-bb.vtext.com., , 1, 1)
;; res_query(smtp-bb.vtext.com, 1, 1)
;; Querying server (# 1) address = 10.10.10.10
;; res_query(31.10.10.164.in-addr.arpa, 1, 12)
;; Querying server (# 1) address = 10.10.10.10
;; res_querydomain(mysys.myk12.org., , 1, 1)
;; res_query(mysys.myk12.org, 1, 1)
;; Querying server (# 1) address = 10.10.10.10
220 **************************
>>> EHLO mysys.myk12.org
250-njbrspamp3.vtext.com
250-8BITMIME
250-SIZE 4194304
250 XXXXXXXA
>>> MAIL From: SIZE=16
250 sender ok
>>> RCPT To:<5551234567@vtext.com>
250 recipient <5551234567@vtext.com> ok
>>> DATA
354 go ahead
>>> .
250 ok: Message 202718147 accepted
5551234567@vtext.com... Sent (ok: Message 202718147 accepted)
Closing connection to smtp-bb.vtext.com.
>>> QUIT
221 njbrspamp3.vtext.com
closemaps: closing host (NULL)
closemaps: closing dequote (NULL)

and the results of doing an nslookup for mx record:
> set q=MX
> archwireless.net
Name Server: k12ad99.myk12.org
Address: 10.10.10.10

Trying DNS
Non-authoritative answer:
archwireless.net preference = 5, mail exchanger = mailmx.usamobility.net
> vtext.com
Name Server: k12ad99.myk12.org
Address: 10.10.10.10

Trying DNS
Non-authoritative answer:
vtext.com preference = 50, mail exchanger = smtp-bb.vtext.com
vtext.com preference = 50, mail exchanger = smtp-sl.vtext.com

Authoritative answers can be found from:
smtp-bb.vtext.com internet address = 69.78.128.213
smtp-sl.vtext.com internet address = 69.78.67.53
5 REPLIES
grahamswilson
Trusted Contributor
Solution

Re: Bypass Exchange Relay for specifc Domains?

"mailertable" functionality is what you want!

With it, you can specify domains and the specific mail server to use for those domains...

e.g.

domain1.com esmtp:smtprelay1.domain1.com:smtprelay2.domain2.com
domain2.com esmtp:smtprelay1.domain2.com:smtprelay2.domain2.com

All of this would get defined in a text file (something like /etc/mail/mailertable.txt) and then has to be "hashed" for use using something like :-

makemap dbm /etc/mail/mailertable < /etc/mail/mailertable.txt

Of course, sendmail itself must be set up to use mailertable (which isn't the default) and that can be achieved by running /usr/newconfig/etc/mail/cf/cf/gen_cf and following the menus looking for "mailertable".

This will generate the correct sendmail.cf - which of course needs sendmail to be restarted once the file is in place...

Hope that helps...
Mel Burslan
Honored Contributor

Re: Bypass Exchange Relay for specifc Domains?

I learn something new every day, just by coming here and reading the posts. Thanks to the author of your first answer.

Having said that, in large corporations, port 25 for mail relaying, is usually blocked by firewall administrators, to prevent some hacked PC spewing spam (you know every organization has at least one Einstein, who thinks opening one attachment of cute kittens playing makes no harm, especially the email is coming from auntie Marrie. Right ?)

To accomplish the bypassing mail relay, you do not only need to configure your system as described on the first post, but have a heart-to-heart with your network/firewall administrators, explaining them why you need this direct access.

Just FYI. Usually the paperwork red-tape is what gets you at the end.
________________________________
UNIX because I majored in cryptology...
Steven E. Protter
Exalted Contributor

Re: Bypass Exchange Relay for specifc Domains?

Shalom,

With the use of mailertable or genericstable you can create custom mail routing.

However there really is no purpose for this.

The Exchange Server is perfectly capable of correctly routing these two domains to their proper destination.

The Exchange server or its master mail exchanger has rights on port 25.

You are gaining very little except an administrative nightmare by trying to bypass the Exchange server.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Rcky Mntere
Regular Advisor

Re: Bypass Exchange Relay for specifc Domains?

Thank you Graham for the technical solution to this issue. I will look into implementing the details and see if that allows us to by pass the domain relay for all other mail.

Mel, thank you for raising the firewall issue as I'm sure that will be something that will also have to be dealt with.

Steven: I understand why you may have responded as you did but the point of the entire issue to BYPASS our relay so that we eliminate THAT as point of failure (which has occurred). IE, we wish to eliminate as many point of failure possible but ONLY for our paging email... Now it so happens that the monitoring system ONLY send email either to our internal domain users OR to two external paging targets (domains).
Rcky Mntere
Regular Advisor

Re: Bypass Exchange Relay for specifc Domains?

Per responses. Thanks to all who contributed!