#483930 sendmailconfig asks for 'Mail name' but ignores it; errors when generating config

#483930#5
Date:
2008-06-01 10:12:17 UTC
From:
To:
I entered 'deodand.anjou.terraraq.org.uk' (the system's FQDN) as the
mail name and 'smtp' (unqualified name of my smarthost) as the forward
host.  However the mail comes out like this:

   Return-path: <richard@smtp>
   Envelope-to: richard@sfere.greenend.org.uk
   Delivery-date: Sun, 01 Jun 2008 11:04:57 +0100
   Received: from deodand.anjou.terraraq.org.uk [172.17.207.12]
	  by sfere.anjou.terraraq.org.uk with esmtp (Exim 4.63 #1 (Debian))
	  id 1K2kQr-0004uV-P8; Sun, 01 Jun 2008 11:04:57 +0100
   Received: from deodand.anjou.terraraq.org.uk (localhost [127.0.0.1])
	  by deodand.anjou.terraraq.org.uk (8.14.3/8.14.3/Debian-4) with ESMTP
id m51A4qO7009718
	  for <richard@sfere.greenend.org.uk>; Sun, 1 Jun 2008 11:04:52 +0100
   Received: (from richard@localhost)
	  by deodand.anjou.terraraq.org.uk (8.14.3/8.14.3/Submit) id m51A4qG2009717
	  for richard@sfere.greenend.org.uk; Sun, 1 Jun 2008 11:04:52 +0100
   Date: Sun, 1 Jun 2008 11:04:52 +0100
   From: Richard Kettlewell <richard@smtp>
   Message-Id: <200806011004.m51A4qG2009717@deodand.anjou.terraraq.org.uk>
   To: richard@sfere.greenend.org.uk
   Subject: test from deodand to richard@sfere.greenend.org.uk

As you can see it has used the name of the forwarding host as its mail
domain, which is not correct.

Here's a full transcript of what I did.  As well as not producing a
correct configuration, a number of errors are reported below "Creating
/etc/mail/sendmail.cf...".

   richard@deodand:/usr/share/doc/sendmail$ sudo sendmailconfig
   Configure sendmail with the existing /etc/mail/sendmail.conf? [Y] y
   Reading configuration from /etc/mail/sendmail.conf.
   Validating configuration.
   Writing configuration to /etc/mail/sendmail.conf.
   Writing /etc/cron.d/sendmail.
   Configure sendmail with the existing /etc/mail/sendmail.mc? [Y] n

   Sendmail Configuration
   ----------------------
   By answering the following questions, you can configure sendmail for your
   system. Default values are determined either by your existing
configuration
   or from common usage.

   Press [ENTER]

   Mail Name
   ---------
   Your `mail name' is the hostname portion of the address to be shown on
   outgoing news and mail messages (following the username and @ sign). This
   name will be used by other programs besides sendmail; it should be
the single,
   full domain name (FQDN) from which mail will appear to originate.

   Mail name? [deodand.anjou.terraraq.org.uk] deodand.anjou.terraraq.org.uk

   Null Client
   -----------
   A special configuration known as the "null client" can be created for
this
   host if all mail should be forwarded to a central hub via a local
SMTP-based
   network. This may be a suitable configuration if you want to forward
all of
   your mail to your local Internet service provider (ISP) for delivery.

   To enable this option, give the name of the host to which all mail
should be
   forwarded. Otherwise leave the option empty to disable it.
   To remove a prior name, use `NONE'.

   Null client forward host? [smtp] smtp

   Configuration Complete
   ----------------------
   Advanced configuration, such as alternate mailers, the use of
mailertables,
   Bitnet domains, and UUCP domains can be accomplished by manually
editing the
   /etc/mail/sendmail.mc configuration file and rerunning
   `/usr/sbin/sendmailconfig' to generate the appropriate
/etc/mail/sendmail.cf
   file. (Local changes made at the end of /etc/mail/sendmail.mc
   will be preserved by `/usr/sbin/sendmailconfig'.)

   The m4 library files for sendmail configuration are kept in the
   /usr/share/sendmail/cf directory. You may wish to review the
   documentation in /usr/share/doc/sendmail to assist in further
customization.

   You may wish to customize your alias database; see the aliases(5) man
page
   for information on the format and use of the /etc/aliases file.

   Saving old /etc/mail/sendmail.mc as /etc/mail/sendmail.mc.old ...
   Updating sendmail environment ...
   Reading configuration from /etc/mail/sendmail.conf.
   Validating configuration.
   Writing configuration to /etc/mail/sendmail.conf.
   Writing /etc/cron.d/sendmail.
   Reading configuration from /etc/mail/sendmail.conf.
   Validating configuration.
   Writing configuration to /etc/mail/sendmail.conf.
   Writing /etc/cron.d/sendmail.
   Turning off Host Status collection
   Could not open /etc/mail/databases(No such file or directory),
creating it.
   Reading configuration from /etc/mail/sendmail.conf.
   Validating configuration.
   Creating /etc/mail/databases...

   Checking filesystem, this may take some time - it will not hang!
     ...   Done.

   Checking for installed MDAs...
   sasl2-bin not installed, not configuring sendmail support.

   To enable sendmail SASL2 support at a later date, invoke
"/usr/share/sendmail/update_auth"


   Creating/Updating SSL(for TLS) information
   Creating /etc/mail/tls/starttls.m4...
   You already have sendmail certificates


   *** *** *** WARNING *** WARNING *** WARNING *** WARNING *** *** ***

   Everything you need to support STARTTLS (encrypted mail transmission
   and user authentication via certificates) is installed and configured
   but is *NOT* being used.

   To enable sendmail to use STARTTLS, you need to:
   1) Add this line to /etc/mail/sendmail.mc and optionally
      to /etc/mail/submit.mc:
     include(`/etc/mail/tls/starttls.m4')dnl
   2) Run sendmailconfig
   3) Restart sendmail

   Checking {sendmail,submit}.mc and related databases...
   Reading configuration from /etc/mail/sendmail.conf.
   Validating configuration.
   Creating /etc/mail/databases...
   Reading configuration from /etc/mail/sendmail.conf.
   Validating configuration.
   Creating /etc/mail/databases...
   Reading configuration from /etc/mail/sendmail.conf.
   Validating configuration.
   Creating /etc/mail/Makefile...
   Reading configuration from /etc/mail/sendmail.conf.
   Validating configuration.
   Writing configuration to /etc/mail/sendmail.conf.
   Writing /etc/cron.d/sendmail.
   Disabling HOST statistics file(/var/lib/sendmail/host_status).
   Creating /etc/mail/sendmail.cf...
   *** ERROR: FEATURE() should be before MAILER()
   *** MAILER(`local') must appear after FEATURE(`allmasquerade')***
ERROR: FEATURE() should be before MAILER()
   *** ERROR: FEATURE() should be before MAILER()
   *** ERROR: FEATURE() should be before MAILER()
   *** MAILER(`local') must appear after FEATURE(`allmasquerade')***
ERROR: FEATURE() should be before MAILER()
   *** ERROR: MAILER(local) already included
   *** ERROR: MAILER(smtp) already included

   Creating /etc/mail/submit.cf...
   Informational: confCR_FILE file empty: /etc/mail/relay-domains
   Informational: confCT_FILE file empty: /etc/mail/trusted-users
   Updating /etc/mail/access...
   Updating /etc/mail/aliases...

   Warning: These messages were issued while creating sendmail.cf
	  make sure they are benign before starting sendmail!

   Errors in generating sendmail.cf
   *** ERROR: FEATURE() should be before MAILER()
   *** MAILER(`local') must appear after FEATURE(`allmasquerade')***
ERROR: FEATURE() should be before MAILER()
   *** ERROR: FEATURE() should be before MAILER()
   *** ERROR: FEATURE() should be before MAILER()
   *** MAILER(`local') must appear after FEATURE(`allmasquerade')***
ERROR: FEATURE() should be before MAILER()
   *** ERROR: MAILER(local) already included
   *** ERROR: MAILER(smtp) already included

   Reload the running sendmail now with the new configuration? [Y] y
   Reloading sendmail ...
   richard@deodand:/usr/share/doc/sendmail$ mail
richard@sfere.greenend.org.uk
   Subject: test from deodand to richard@sfere.greenend.org.uk
   .
   Cc:
   Null message body; hope that's ok
   richard@deodand:/usr/share/doc/sendmail$

ttfn/rjk

#483930#10
Date:
2010-10-04 17:51:31 UTC
From:
To:
sendmailconfig(8) sets MASQUERADE_AS() on the mail name, but
FEATURE(nullclient) overrides the masquerade hostname by declaring
MASQUERADE_AS() itself.

It seems better to set MASQUERADE_AS() *after* FEATURE(nullclient), which
causes sendmail to masquerade as sendmailconfig(8) states.