Keywords: ldapuses2_foils

Next: Changes In Sendmail-8.10.0 Up: Extending Internet Services Via Previous: Sample SENDMAIL #2 LDAP

# Sample Sendmail Coding

Five basic additions are made to the `sendmail.cf` configuration file:

1. DLluser ($L (LUSER_RELAY) macro)
2. Sendmail LDAP ``map'' declaration. The LDAP search key and attribute to return are specified with the -k and -v parms:

       Kluser ldap
       -h""
       -k"cn=%s" -vmail
       -b"o=,c=US"

3. in Ruleset 5, the ``send unrecognized local users to a relay host'' rule is activated and the following rule is added following it, which tells Sendmail to make an LDAP connection and search if the ``local'' user is not found in the server password file/user database (luser is the LDAP ``map'').

       R< $L > 	$+ $: < $L > $(luser $1 $)

4. in Rulest 98, two rules are added: one for the ``local'' mailing lists, the other for the dotted ``local'' userids:

       # look for any (rfc822mailgroup)
       # .mlist, via Mail500
       R$- . mlist <@ $=w .>	 $* $#mail500 $@$2 $: <$1>

       # anything like .
       # at  send to MAIL500
       R$- . $- <@ $=w .>	 $* $#mail500 $@$3 $: <$1.$2>

5. lastly, the MAIL500 definition which specifies the location of the executable

       Mmail500, 	P=/usr/local/libexec/mail500, F=DFMSmnXuh,
       		A=mail500 -f $f -h $h -m $n@$w $u

Some of the benefits and caveats:

- virtually unlimited
  - ``local'' users/mailboxes
  - ``local'' mailing lists
- no need to constantly change Sendmail or Sendmail ``databases'' as users/lists change
- easy to add/change simple Sendmail rules to expand groups of mailboxes handed off to LDAP/MAIL500
- needs reliable/backup LDAP server(s)
- LDAP server scalability could be an issue for large volumes of mail handling