Handling mail aliases

Spike Ilacqua spike@indra.com
Tue Jun 17 00:33:52 UTC 2003


One issue with using DCCM, or any milter for that matter, is that it
doesn't know about sendmail aliases.  This is really a shortcoming of
the milter library; sendmail only processes aliases on local delivery so
that information is never available to a milter.  This is potential
problem for individual whitelists and logs.

For example if you have a user "robert" who has a mail alias "bob".
DCCM will see two different local address, so two different whitelists
and two different logdirs i.e. "userdirs/bob" and "userdirs/robert".

On a small scale this is easy to solve (Thanks Vernon!) by symlinking
"bob" to "robert":

# ln -s robert bob

thus when DCCM opens "bob/whiteclnt" it's really opening
"robert/whiteclnt".

This works, but the management of it doesn't scale well.  I'm wondering
what other options might be.  I can think of two.

One would be to create a sort of whitelist that mapped aliases to
addresses.  Something simple like:

bob	    robert

The DCCM could check for a mapping before opening the whitelist and log.
DCCM does have super fast hash lookup routines.

Another option is to make sendmail do the work, not unlike the mail_host
trick:

# used to create macros to send to milter interface
Kstorage macro

# get access to the aliases file
Kaliases implicit /etc/mail/aliases

SLocal_check_rcpt
# Clear the alias user storage and parse the recipient
R$*			$: $(storage {alias_user} $) $1
R$*			$: <?> $>ParseRecipient $1

# Look for local users
R<?> $* < @ $=w >	$: <!> $1 @ $2
R<?> $* < @ $* >	$: $1 < @ $2 >
R<?> $*			$: <!> $1
R<!> $*			$: $>Local_exp_alias $1
R$*			$: $1

SLocal_exp_alias
# Look up in aliases table
R$*			$: <?> $1
R<?> $+ + $* @ $+	$: <!> < $(aliases $1 $: @ $) > $1 + $2 @ $3
R<?> $+ @ $+		$: <!> < $(aliases $1 $: @ $) > $1 @ $2
R<?> $+ + $*		$: <!> < $(aliases $1 $: @ $) > $1 + $2
R<?> $*			$: <!> < $(aliases $1 $: @ $) > $1
R<!> < @ > $+	$: $1

# Got a match, store it
R<!> < $+ > $+	$: $(storage {alias_user} $@ $1 $) $2
# Recurse if need be.  Might want to limit the depth like sendmail does.
R<!> < $+ >	$: $>Local_exp_alias $1
R$* 		$: $1

Then pass {alias_user} to the milter.  This has the advantage of letting
sendmail do what sendmail does, but man it's ugly.  In addition you can
get aliases that expand out to non-local addresses or lists of local
users, which DCCM would then need to handle.

(BTW, you can have as many "Local_check_rcpt" rules as you want, and
they don't actually change the recipient address so you don't have to
preserve it.)

Those are my to thoughts, do people have other, brilliant ideas?  In a
perfect world the milter library would be able to provide a notion of
"local user", but I'm not holding my breath.

->Spike
<



More information about the DCC mailing list

Contact vjs@rhyolite.com by mail or use the form.