[svlug] Sendmail as relay to internal exchange server
Drew Bertola
drew at drewb.com
Wed Apr 30 15:14:22 PDT 2003
On Wed, 2003-04-30 at 10:49, Daniel Curry wrote:
> Can any one point me to a HOW-TO or other document that will permit me
> to use a linux box as an SMTP Queueing server? I have some work to do
> with our exchange server that will take a few hours, and management
> does not wish to loose or delay inbound messages any longer than is
> necessary. I would also like to secure the Exchange box to only
> accepts inbound messages from the sendmail server posted outside the
> firewall.
This works on any recent RH install, attached to the net w/ hostname set
for mail2.yourdomain.com and yourdomain.com's secondary MX pointing to
this box...
1. Install appropriate sendmail, sendmail-cf rpms. For example, on RH9,
install:
sendmail-8.12.8-5.90
sendmail-cf-8.12.8-5.90
2. Edit /etc/mail/sendmail.mc so that sendmail will listen to all
configured interfaces. Look for the following line and put "dnl " in
front of it. (dnl = "disregard to new line").
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
3. Activate the above change by recreating sendmail's config. From a
command prompt (as root) do:
$ cp /etc/mail/sendmail.cf /etc/mail/sendmail.cf.orig
$ m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
4. Restart sendmail to work with the new configuration:
$ /etc/init.d/sendmail restart
5. Add to /etc/mail/access file the domains you want this box to be
secondary MX for. For our example, add:
yourdomain.com relay
6. Activate the change above by creating the "access.db" hash file from
the "access" text file:
$ makemap hash /etc/mail/access.db < /etc/mail/access
That should do it. From a machine outside your domain, you should be
able to test by telnet'ing in to this machine to port 25 and sending a
mail from an external domain to an address in your domain. The mail
should be forwarded immediately, or if the primary MX is down, it will
be queued for up to 5 days and attempts to resend will be made every 1/2
hour.
(from somebox.foo.com outside your domain)
$ telnet mail2.yourdomain.com 25
Trying 166.129.67.2...
Connected to mail1.yourdomain.com
Escape character is '^]'.
220 mail1.yourdomain.com ESMTP Sendmail 8.12.8/8.12.8; Wed, 30 Apr 2003
14:56:38 -0700
[now you type]
helo blah[enter]
[you receive]
250 mail1.yourdomain.com Hello somebox.foo.com [26.218.245.199], pleased
to meet you
[now you type]
mail from: billg at microsoft.com[enter]
[you receive]
250 2.1.0 me at microsoft.com... Sender ok
[now you type]
rcpt to: dcurry at yourdomain.com[enter]
[you receive]
250 2.1.5 dcurry at yourdomain.com... Recipient ok
----------------------------
That should be enough to tell you everything is set and the machine will
accept and queue the mail. Make sure the new box is pointed to as the
secondary MX for your domain. You could finish your test by typing:
----------------------------------
[you type]
data[enter]
[you receive]
354 Enter mail, end with "." on a line by itself
[you type]
subject: test[enter]
this is a test to the secondary[enter]
.[enter]
[you receive]
250 2.0.0 h3ULucOI011421 Message accepted for delivery
[you type]
quit[enter]
[you receive]
221 2.0.0 mail2.yourdomain.com closing connection
Connection closed by foreign host.
More is here (including a section called "Most common mistakes"):
http://www.itma.lu/howto/sendmail/secondary.htm
--
+---------------------- T h e C o o p . n e t ----------------------+
| Drew Bertola Hosting - Colocation Tel: 408-738-8337 |
| TheCoop.net Programming - Administration Mob: 408-480-7654 |
| drew at thecoop.net Open Source Specialists http://thecoop.net |
+-------------------------------------------------------------------+
More information about the svlug
mailing list