procmail
[Top] [All Lists]

Virtual domain with his own user list

1996-11-26 11:36:49
On Tue, 26 Nov 1996, Robert E. Gahl wrote:

Date: Tue, 26 Nov 1996 08:34:43 -0800
From: "Robert E. Gahl" <bgahl(_at_)thesphere(_dot_)com>
To: procmail(_at_)Informatik(_dot_)RWTH-Aachen(_dot_)DE
Cc: bgahl(_at_)thesphere(_dot_)com
Subject: Can't come up with the right recipe...
Resent-Date: Tue, 26 Nov 1996 18:38:51 +0100
Resent-From: procmail(_at_)Informatik(_dot_)RWTH-Aachen(_dot_)DE

I use procmail in combination with sendmail to direct our virtual user
account mail. That is, I direct all inbound mail for a given domain to a
single user account, and then use procmail within that account to redirect
the mail to individual user accounts. It looks something like this:

I am doing this to, on a rather large scale.

sendmail rule:

      R$*<@virtualdomain.com> $#local$:vdomain


I do it with a .db file of domain->username mappings.

The effect is the same as your rewriting rules, but
the database can be changed without restarting 
sendmail, and without editing the .cf

Then, in the vdomain account is a .forward with:

      "|exec /usr/local/bin/procmail USER=vdomain"

I use a procmail mailer for local.

whose .procmailrc has:

SHELL=/bin/bash
PATH=$HOME/bin:/usr/bin:/bin:/usr/local/bin
MAILDIR=$HOME/var/spool/mail
DEFAULT=/dev/null
SENDMAIL=/usr/lib/sendmail
LOCKEXT=.lock
#LOGFILE=$HOME/var/spool/mail/procmail.log
#LOGABSTRACT=no

# This line traps info for the log
#   TRAP='formail -XTo: -XSubject: -XCc: -XFrom: -XDate: -XReply-To: \
#   -XX-Mailing -XTag: -XX-Loop: -XApparently- -XX-Envelope- -IResent-Bcc: ; \
#   echo __________________________________________'

UMASK=0007

INCLUDERC=$HOME/etc/.specialfeatures
INCLUDERC=$HOME/etc/.delivery

#++++++++++++++++++++++++++++++++++++++++++++

and etc/.delivery has:

:0 f
* ^TO\<(user1|user2|user3|realuser)@
|formail -A"X-Delivered: Yes"

:0
{
        :0 Hhbc : user1.lock
        * ^TO\<user1@
        * !^X-Loop: user1(_at_)homeatlantic(_dot_)com
        $HOME/var/spool/mail/user1

        :0 Hhbc : user2.lock
        * ^TO\<user2@
        * !^X-Loop: user2(_at_)homeatlantic(_dot_)com
        $HOME/var/spool/mail/user2


        :0 Hhbc : user3.lock
        * ^TO\<user3@
        * !^X-Loop: user3(_at_)homeatlantic(_dot_)com
        $HOME/var/spool/mail/user3

                # realuser is the only one in /etc/passwd.
                # all mail from this domain has been rewritten to him, 
            # in S98            

        :0 Hhbc : realuser.lock
        * ^TO\<realuser@
        * !^X-Loop: realuser(_at_)homeatlantic(_dot_)com
        $HOME/var/spool/mail/realuser

        :0
        * !^X-Delivered: Yes
        {
                EXITCODE=67
        }
}

Here's the problem.

Our problem is that if the user is a Bcc: of the message,
there is nothing at this point to allow my procmailrc to 
switch delivery.  The effect is that if you cannot be
found by ^To, the message is bounced.

This is a real drag, and I want to know how to insert the
apparent recipient of a Bcc message into the header.
There is always the special case of forwarding via bcc:
to multiple recipients on the same domain, too.  (That is
why there is one check at the top for all the users, and 
then subsequent recipes for each users, and they all
have the "cc" flag set.

field is something other than their name. I can see the actual recipient
usually in the first 'Received: from . . . for 
<username(_at_)virtualdomain(_dot_)com>
id . . . .'

But not always...  That has been a real source of grief for me.
What is sendmail's $u parameter?  Why is it not always set? 
How to force sendmail to deliver a message bound for multiple users
on a domain, after the S98 rewrite, multiple times?  How to
always catch the original recipient into a consistent header?
Will another MTA be helpful?  

Has anyone else attempted this?

       but I can't derive a rule that will operate within the above
parameters. Anyone have a rule out there which can solve this?

What I have seems to work for anything except bcc recipients.
 
Secondly, the more I read the man page, the more I'm convinced that the
(^TO|^CC|^BCC) is redundant and should just be ^TO. Am I correct?

That's the way I read it too.  Not only that, but there really ISN'T
 a BCC to match by the time the message gets to us.  I really wish there
was a way to get the relevant users into an Apparently-To: header,
and then separately delivery each message to each person in the Bcc:
list on this domain.  

The effect is wonderful when it works:

Each virtual domain has his own namespace, except for the
one !(_at_)#$% user who must be in /etc/passwd.  I'd like to get 
rid of that one too.

------------------------+----------------------------------------------
   James L. McGill      |              NETCOM  Interactive
 Programmer / Analyst   |                 Dallas, Texas  
 <fishbowl(_at_)netcom(_dot_)com>  | -=[ http://www.conservatory.com/~fishbowl 
]=-
------------------------+----------------------------------------------

<Prev in Thread] Current Thread [Next in Thread>