Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Feb 2002 08:35:09 +0100
From:      Cliff Sarginson <cliff@raggedclown.net>
To:        FreeBSD List <freebsd-questions@freebsd.org>
Subject:   Re: Sendmail startup, oddness in /etc/rc
Message-ID:  <20020216073509.GA4963@raggedclown.net>
In-Reply-To: <E16bt9V-0007BD-00@falcon.prod.itd.earthlink.net>
References:  <20020215225227.GA275@raggedclown.net> <E16bruA-0007jF-00@falcon.prod.itd.earthlink.net> <20020216000629.GA261@raggedclown.net> <E16bt9V-0007BD-00@falcon.prod.itd.earthlink.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Feb 15, 2002 at 06:56:29PM -0600, Bob Giesen wrote:
> On Friday 15 February 2002 06:06 pm, Cliff Sarginson wrote:
> > On Fri, Feb 15, 2002 at 05:36:34PM -0600, Bob Giesen wrote:
> > > On Friday 15 February 2002 04:52 pm, Cliff Sarginson wrote:
> > > > Hello,
> > > > While investigating how to delay the startup of my mail system
> > > > until later in the boot process I discovered something a bit
> > > > odd. I use postfix, and it is all setup as it is supposed to
> > > > with the mail wrapper etc. I thought I would check how it is
> > > > started in /etc/rc.
> > > >
> > > > However "sendmail_enable" set to "YES" in /etc/rc.conf does not
> > > > work unless it finds /etc/mail/sendmail.cf ! This surely cannot
> > > > be correct except for users of (the real) sendmail.
> > > >
> > > > I suppose it is harmless, but if you use another MTA what do
> > > > you need sendmail.cf for ?
> > >
> > >    JOOC, if you use another MTA, why would sendmail_enable be
> > > needed in rc.conf?  Doesn't that line (when set to "YES")
> > > actually start the sendmail daemon?
> > >    I may be wrong, but I think that, by virtue of having that
> > > line in rc.conf (or defaults/rc.conf), you unwittingly tried to
> > > make yourself a user of the real sendmail.  If so, the missing
> > > config (.cf) file just prevented it from acutally happening. :-)
> >
> > No that is not how it works ..
> > FreeBSD uses a mailwrapper program.
> 
>    ... learn something new every day.
> 
> > So when you install postfix for example, it configures the wrapper
> > to call the postfix sendmail rather than the real sendmail. So
> > enabling sendmail in rc.conf starts whatever MTA you have
> > installed.
> 
>    I presume you checked mailer.conf to make sure it got updated 
> properly...  If it did, I wonder if postfix needs sendmail.cf.  

Yes it is all configured fine, but /etc/rc appears to have never
been changed to reflect the multi-mta support the wrapper gives

Well, it works, and Postfix does not need sendmail.cf. You can
start/stop Postfix with the "postfix" command quite happily. This
discussion gets a little complicated because postfix provides a
drop in replacement for sendmail called sendmail :). However the
postfix sendmail just allows you to use the command "sendmail" and
understands most of the real sendmail commands and acts on them
a la postfix. However postfix "sendmail", and nothing in postfix
needs "sendmail.cf" -- since one of it's design aims is to be a drop
in replacement it would be odd if it had to decipher the version of
Klingon that sendmail.cf uses as well.

For example I just renamed sendmail.cf to something else and
issued the default sendmail command that /etc/rc does, viz.

# sendmail -bd -q30m

And postfix announces it has started.

> not, I'd be tempted to take a look at the mailwrapper code.

I did, there is nothing to it, fandangles the arguments, opens the
mailer configuration file and executes what it finds there...does
some sanity checking. If it can't open it then the default MTA 
is opened (the real sendmail path is wired into the header file).

>    I agree, it does seem odd, now that I understand it a little 
> better -- albeit not well enough.  A little knowledge, of course, can 
> be dangerous. :-)
> 
> > man 8 mailwrapper
> >
> > explains it all :)
> 
>    ... almost.
> 
Well, my conclusion is that this is not the right way to do this, but I
guess the continued pervasiveness of sendmail may well be used as a
justification. To truly generalise it maybe the mailer.conf needs to
have not only an indication of what 'sendmail' to start but what the
name/location is of it's master configuration file, and that goes also
for the default mailer (which should not be wired into an include file
but also obtained externally as well). Or perhaps it does not need that
at all, since postfix will not start without a "master.cf" and
presumably real sendmail will not without a "sendmail.cf". I don't know
whether this would cause difficulties with an MTA like qmail (which I
know nothing about) which I believe does not try to impersonate sendmail
in the same way postfix does.

Mmm, hard to disagree with the comment at the bottom of the manpage for
mailwrapper:


BUGS
     The entire reason this program exists is a crock.  
     Instead, a command for how to submit mail should be 
     standardized, and all the "behave differ- ently if 
     invoked with a different name" behavior of things like mailq(1)
     should go away.

Sadly I have a feeling that implementing the level of abstraction suggested by
the above comment would be a non-trivial task.

Whatever, the test for the existance of a sendmail.cf before honouring
a "sendmail_enable" command, when sendmail means "whatever mailer you
have installed" is clearly wrong. But then the name of the command
should change to something like "mailer_enable" .. and I feel a whole
discussion could ensue on *that* in the same vein as the recent one
about firewall related commands in rc.conf (eeeek).

I would offer to re-work this myself, but I would not be very hopeful it
would get committed, the sendmail nightmare still has a few years to run
yet I think :)

-- 
Regards
Cliff



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020216073509.GA4963>