Greetings,
Environment:
Two openbsd 4.0 server environment -- main.mail.server in DMZ, another in firewalled LAN. firewall denies SMTP from LAN except to DMZ mail server.
Sendmail 8.13.8 on both servers. No issues sending mails from main DMZ mail server to any address.
I wish to blindly forward all emails sent from LAN server to the main DMZ server which will handle forwarding.
Server names and email addresses have been sanitized, but are correct in my environment.
Added
define(`SMART_HOST', `main.dmz.mailserver')dnl
to the LAN mailserver .mc file, generated cf and kill -HUP sendmail.
testing sending mail outside the network using
user@lan% echo "test" | mail -v -s test external@address.com
and receive the following output:
external@address.com... Connecting to [127.0.0.1] via relay...
220 mail.lan.com ESMTP Sendmail 8.13.8/8.13.8; Mon, 29 Jan 2007 11:10:03 -0500 (EST)
>>> EHLO dmz.server.com
250-mail.lan.com hello localhost.lan.com [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-EXPN
250-VERB
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
>>> VERB
250 2.0.0 Verbose mode
>>> MAIL From:<user@mail.lan.com> SIZE=60
250 2.1.0 <user@mail.lan.com>... Sender ok
>>> RCPT To:<external@address.com>
>>> DATA
250 2.1.5 <external@address.com>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
050 <external@address.com>... Connecting to
mail.externaladdress.com. via esmtp...
050 <external@address.com>... Deferred: Connection refused by mail.externaladdress.com.
250 2.0.0 l0TGA3vP013035 Message accepted for delivery
external@address.com... Sent (l0TGA3vP013035 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 mail.lan.com closing connection
Apparantly, the mail.lan.com server attempts to deliver the mail directly,
which is forbidden by the firewall. This places the mail in the sendmail
queue:
# sendmail -bp
/var/spool/mqueue (2 requests)
-----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipie
nt--------
---
l0TGA0IP016397 5 Mon Jan 29 11:10 <user@mail.lan.com>
(Deferred: Connection refused by mail.externaladdress.com.)
<external@address.com>
When root issues a "sendmail -q" command, the mail is properly forwarded to
the main.dmz.mailserver and is delivered. Where have I gone wrong?
Thanks,
Nick Pelfort
The following is my sendmail.mc file:
divert(0)dnl
OSTYPE(openbsd)dnl
FEATURE(`relay_local_from'
)
define(`SMART_HOST', `main.dmz.mailserver')dnl
MAILER(smtp)dnl