Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a sendmail problem, and I'm anything but a sendmail guru -- I could use some help.

My problem is that I have a system intended to be more or less an "appliance" -- it's not intended to have an admin. Because of this, it needs to be able to "call home" by sending email. As we have configured it, this works fine -- using sendmail, it finds the appropriate relay by looking up an MX record and everything works fine.

Now, however, because of security concerns, we want to limit it to using exactly one relay, so for example relay.corp.example.com. Should the user configure it to use, say, fubar.example.com, the mail sending should fail or be deferred.

I thought that by configuring sendmail with a /etc/mail/server.switch file containing

hosts   files

without dns, I'd get that effect. This doesn't work -- instead, if it gets mail addressed to foo@example.com, it tries to talk directly to example.com, and ignores the configured server.

Any ideas?

Update

Okay, I tied both schemes experimentally, and they both seem to work. Wish I could mark them both correct.

share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

Are you using m4 to build your sendmail.cf? If so, you should add

define(`SMART_HOST',`relay.corp.example.com')

to your sendmail.mc and regenerate your sendmail.cf. It looks like adding

DSrelay.corp.example.com

right to the sendmail.cf will do the trick too.

share|improve this answer
    
He shoots, he scores. Thanks. Now to make the %^#$@#^$% application rewrite its sendmail.cf.... –  Charlie Martin Feb 4 '11 at 23:27
add comment

Here is an M4 file for a SuSE system for simply forwarding ALL email to the relay host.
(Its included in the SuSE distribution as well). You simply do m4 x.mc >x.cf where x.mc is the file below and x.cf would be the file to replace your sendmail.cf file (usually in either /etc/sendmail.cf or /etc/mail/sendmail.cf).

 divert(-1)
 #
 # Copyright (c) 1999 SuSE GmbH Nuernberg, Germany.
 # Copyright (c) 2006 SuSE LINUX Products GmbH, Germany.
 # Author: Werner Fink
 # Please send feedback to http://www.suse.de/feedback/
 #
 # This is a special case -- it creates a stripped down configuration
 # file containing nothing but support for forwarding all mail to a
 # central hub via a local SMTP-based network.  The argument is the
 # name of that hub.
 #

 include(`/usr/share/sendmail/m4/cf.m4')
 divert(0)dnl
 VERSIONID(`@(#)Setup for SuSE Linux     0.2 (SuSE Linux) 2002/01/14')
 dnl
 dnl  This is the default configuration for SuSE Linux.
 dnl  See /usr/share/sendmail/ostype/suse-linux.m4
 dnl  and /usr/share/sendmail/README for more information.
 dnl
 OSTYPE(`suse-linux')dnl
 dnl
 dnl  A stripped down configuration. Replace the mailhub.domain.notused
 dnl  with your real mailhub.
 dnl
 FEATURE(`nocanonify')dnl
 FEATURE(`nullclient', `relay.corp.example.com')dnl
 dnl
 dnl  This line is required for formating the /etc/sendmail.cf
 dnl
 LOCAL_CONFIG
share|improve this answer
    
Thanks, I'd just now read about the nullclient feature and was wondering how to configure it. –  Charlie Martin Feb 4 '11 at 23:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.