[Ilugc] User Accounts

  • From: binand@xxxxxxxxx (Binand Sethumadhavan)
  • Date: Wed May 17 17:52:34 2006

On 17/05/06, Bharathi Subramanian <sbharathi@xxxxxxxxxxxxx> wrote:

In RDBMS or Binand's Hashing methods, How the standard login/mta prgs
will check for the user. Will use any specific PAM Modules?

MTAs don't usually care about delivery of mails to mailboxes. MTA's
job is to accept emails meant for domains it consider it ought to, and
then decide what to do with the email. It could do one of two basic
things:

a. It could hand over the mail to another MTA elsewhere (usually via
RFC2822 SMTP protocol), or
b. Pass the mail to a program called MDA (Mail Delivery Agent).

In the most usual configuration I have seen on Linux distros, the MTA
is Sendmail and the MDA is Procmail.

So, your question really is how the MDA will know where to deliver the
mail. Taking the example of Sendmail+Procmail further, Procmail has
the /var/spool/mail/<recipient> location hardcoded in it - this is the
default location where it will deliver the message. As with anything
else on Unix, you can configure Procmail to do what you want by giving
it instructions via /etc/procmailrc.

Sendmail invokes Procmail with the -d <recipient> option. Sendmail
derives <recipient> from the envelope recipient address (this is not
the To: address in the email), by stripping the @domain.tld part off.
Without any further instructions, Procmail will deliver the email to
/var/spool/mail/<recipient> location.

So, if you have a program that performs like this:

shell$ myprog binand
/var/mailspool/b/i/binand

Then you can have an /etc/procmailrc like:

DEFAULT=`myprog $LOGNAME`

and procmail will happily deliver to /var/mailspool/b/i/binand.

There is a lot of performance penalty for this approach. Each email
will cause a procmail process to be spawned - you don't want that on a
busy mail server. This is where Courier helps - its MDA, maildrop, has
an embedded mode that can be used if the MTA is Courier. It
understands virtual hosting out of the box, and is really painless to
setup.

Where is LDAP in all this? Procmail performs a setuid() to <recipient>
- your local NSS configuration comes into play when it does this. If
Procmail cannot look up a local user from your preferred NSS database,
then it will bounce the email.

Look at what local mailers are configured in your sendmail.cf - look
for lines that begin with M.

Binand

Other related posts: