Nullclient with alias processing

From Brandonhutchinson.com

(Difference between revisions)
Jump to: navigation, search
(Enabling .forward files)
Current revision (23:09, 17 November 2008) (edit) (undo)
(Other mailer flags)
 
(2 intermediate revisions not shown.)
Line 114: Line 114:
MAILER(`local')
MAILER(`local')
MAILER(`smtp')
MAILER(`smtp')
 +
 +
=== Other mailer flags ===
 +
 +
If you enable the alias database, there are other LOCAL_MAILER_FLAGS that may be of interest. From '''op.pdf''':
 +
 +
* '''|''' Check addresses to see if they begin with a ‘|’; if they do, convert them to the “prog” mailer.
 +
* '''/''' Check addresses to see if they begin with a ‘/’; if they do, convert them to the “*file*” mailer.
 +
 +
As an alternative to specifying LOCAL_MAILER_FLAGS, you may want to exclude the '''define(`_DEF_LOCAL_MAILER_FLAGS'''' line from your '''sendmail.mc''' file and use the default local mailer flags.
=== Links ===
=== Links ===
* [http://groups.google.com/group/comp.mail.sendmail/browse_thread/thread/9437d91a9975c6b3?hl=en&ie=UTF-8&q=nullclient+local+aliases Howto - nullclient read aliases]
* [http://groups.google.com/group/comp.mail.sendmail/browse_thread/thread/9437d91a9975c6b3?hl=en&ie=UTF-8&q=nullclient+local+aliases Howto - nullclient read aliases]

Current revision

Situation: You want to use the sendmail nullclient FEATURE, but you want to use the alias database and/or .forward files.

In this example, I'm running sendmail 8.11.7p3+Sun on a Solaris 8 SPARC system.

Contents

Enabling the alias database

Given my existing sendmail.mc file:

VERSIONID(`$Header: /var/cfengine/masterfiles/solaris/etc/mail/RCS/sendmail.mc.mm,v 1.6 2008/11/07 19:44:56 hutchib Exp $') 
OSTYPE(`solaris8')
define(`confFALLBACK_MX',`host.example.com')
FEATURE(`nullclient',`host.example.com')

And given /usr/lib/sendmail/feature/nullclient.m4:

divert(-1)
#
# Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
#       All rights reserved.
# Copyright (c) 1983 Eric P. Allman.  All rights reserved.
# Copyright (c) 1988, 1993
#       The Regents of the University of California.  All rights reserved.
#
# By using this file, you agree to the terms and conditions set
# forth in the LICENSE file which can be found at the top level of
# the sendmail distribution.
#
#
ifelse(defn(`_ARG_'), `', `errprint(`Feature "nullclient" requires argument')',
        `define(`_NULL_CLIENT_', _ARG_)')

#
#  This is used only for relaying mail from a client to a hub when
#  that client does absolutely nothing else -- i.e., it is a "null
#  mailer".  In this sense, it acts like the "R" option in Sun
#  sendmail.
#

divert(0)
VERSIONID(`$Id: nullclient.m4,v 8.21.16.3 2000/09/17 17:04:22 gshapiro Exp $')
divert(-1)

undefine(`ALIAS_FILE')
define(`MAIL_HUB', _NULL_CLIENT_)
define(`SMART_HOST', _NULL_CLIENT_)
define(`confFORWARD_PATH', `')
ifdef(`confFROM_HEADER',, `define(`confFROM_HEADER', `<$g>')')
define(`_DEF_LOCAL_MAILER_FLAGS', `lsDFM5q')
MASQUERADE_AS(_NULL_CLIENT_)
FEATURE(`allmasquerade')
FEATURE(`masquerade_envelope')
MAILER(`local')
MAILER(`smtp')

I replace FEATURE(`nullclient',`host.example.com') with the above lines in bold from nullclient.m4.

My sendmail.mc now looks like:

VERSIONID(`$Header: /var/cfengine/masterfiles/solaris/etc/mail/RCS/sendmail.mc.mm,v 1.6 2008/11/07 19:44:56 hutchib Exp $') 
OSTYPE(`solaris8')
define(`confFALLBACK_MX',`host.example.com')
FEATURE(`nullclient',`host.example.com')
define(`SMART_HOST', _NULL_CLIENT_)
define(`confFORWARD_PATH', `')
ifdef(`confFROM_HEADER',, `define(`confFROM_HEADER', `<$g>')')
define(`_DEF_LOCAL_MAILER_FLAGS', `lsDFM5q')
MASQUERADE_AS(_NULL_CLIENT_)
FEATURE(`allmasquerade')
FEATURE(`masquerade_envelope')
MAILER(`local')
MAILER(`smtp')

Next, I substitute `host.example.com' for _NULL_CLIENT_.

I also have to add the A flag to LOCAL_MAILER_FLAGS above to enable the alias database. From op.pdf:

A Look up the user (address) part of the resolved mailer triple, in the alias database. Normally this is only set for local mailers.

My sendmail.mc now looks like:

VERSIONID(`$Header: /var/cfengine/masterfiles/solaris/etc/mail/RCS/sendmail.mc.mm,v 1.6 2008/11/07 19:44:56 hutchib Exp $') 
OSTYPE(`solaris8')
define(`confFALLBACK_MX',`host.example.com')
define(`SMART_HOST',`host.example.com')
define(`confFORWARD_PATH', `')
ifdef(`confFROM_HEADER',, `define(`confFROM_HEADER', `<$g>')')
define(`_DEF_LOCAL_MAILER_FLAGS', `lsADFM5q')
MASQUERADE_AS(`host.example.com)
FEATURE(`allmasquerade')
FEATURE(`masquerade_envelope')
MAILER(`local')
MAILER(`smtp')

We now essentially have a "nullclient" configuration that uses the alias database.

Enabling .forward files

To enable .forward files, the following changes need to be made to the above sendmail.mc file:

  • define(`confFORWARD_PATH', `') needs to be removed.
  • The w flag needs to be added to LOCAL_MAILER_FLAGS. From op.pdf:
w The user must have a valid account on this machine, i.e., getpwnam must succeed. If not, the mail is bounced. See also the MailBoxDatabase option. This is required to get “.forward” capability.

sendmail.mc now looks like:

VERSIONID(`$Header: /var/cfengine/masterfiles/solaris/etc/mail/RCS/sendmail.mc.mm,v 1.6 2008/11/07 19:44:56 hutchib Exp $') 
OSTYPE(`solaris8')
define(`confFALLBACK_MX',`host.example.com')
define(`SMART_HOST',`host.example.com')
ifdef(`confFROM_HEADER',, `define(`confFROM_HEADER', `<$g>')')
define(`_DEF_LOCAL_MAILER_FLAGS', `lsADFMw5q')
MASQUERADE_AS(`host.example.com)
FEATURE(`allmasquerade')
FEATURE(`masquerade_envelope')
MAILER(`local')
MAILER(`smtp')

Other mailer flags

If you enable the alias database, there are other LOCAL_MAILER_FLAGS that may be of interest. From op.pdf:

  • | Check addresses to see if they begin with a ‘|’; if they do, convert them to the “prog” mailer.
  • / Check addresses to see if they begin with a ‘/’; if they do, convert them to the “*file*” mailer.

As an alternative to specifying LOCAL_MAILER_FLAGS, you may want to exclude the define(`_DEF_LOCAL_MAILER_FLAGS' line from your sendmail.mc file and use the default local mailer flags.

Links

Personal tools