procmail
[Top] [All Lists]

Re: Trying to run procmail with Cyrus imapd and sendmail

2001-06-15 17:30:19
Louis LeBlanc <leblanc+procmail(_at_)acadia(_dot_)ne(_dot_)mediaone(_dot_)net> 
writes:
...
I have a sendmail.cf that calls procmail to deliver mail, which in
turn will call the Cyrus deliver program.

Sendmail calls procmail as follows:
procmail -Y -m /etc/procmailrc $u $h

I dug through some Cyrus archives and found a starting point for a
/etc/procmailrc file:
...
TRAP="/usr/cyrus/bin/deliver -e -m $2 -- $1"

# Procmail voodoo.  The TRAP handles the mail delivery.  We have to 
# prevent procmail from attempting a second delivery.
#
# in one line, kill procmail:
HOST=acadia
----------------------------------------------------------------------
...
Anyway, when I try to send mail to be delivered to a mailbox, I get
errors in the log file and the message disappears.  Here is the log
info:

----------------------------------------------------------------------
procmail: [4133] Fri Jun 15 09:36:19 2001
procmail: Assigning "EXITCODE="
procmail: Assigning "TRAP=/usr/cyrus/bin/deliver -e -m  -- leblanc"
procmail: Assigning "HOST=acadia"
procmail: Locking "/var/spool/mail/leblanc.lock"
procmail: Error while writing to "/var/spool/mail/_lAB.T9gK7.acadia"
procmail: Lock failure on "/var/spool/mail/leblanc.lock"
procmail: Assigning "LASTFOLDER=/var/spool/mail/leblanc"
procmail: Opening "/var/spool/mail/leblanc"
procmail: Error while writing to "/var/spool/mail/leblanc"
Subject: test
 Folder: **Bounced**                                               0
procmail: Executing "/usr/cyrus/bin/deliver,-e,-m,--,leblanc"
----------------------------------------------------------------------

So what is the problem with the lockfile?  /var/spool/mail has
permissions 775/root:mail.  Shouldn't that be ok?

Actually, you don't want procmail to be delivering to /var/spool/mail.
Cyrus doesn't look there; that's way you invoke 'deliver'.  The problem
there is that you changed the HOST assignment to use your actual hostname.
The point of the assignment is to tell procmail to give up on the
message, but it only does that if the value assigned to HOST *doesn't*
match your actual hostname.  So, change the "HOST=acadia" to just "HOST",
which will unset the variable and thereby not match.


It looks like procmail is not passing the $h ($2) parameterm on to
deliver.  I wonder if this is related to the locfile issue?

Nope.  It's because you didn't quote everything properly.  This following
would work:

        TRAP = '/usr/cyrus/bin/deliver -e -m "$2" -- "$1"'
        HOST

Not quoting things properly also creates security holes.

However, it's not clear why you would use TRAP here instead of just
putting in real recipes.  When this came up on bugtraq last July,
Dylan Griffiths <Dylan_G(_at_)bigfoot(_dot_)com> and I worked up the following:

    LOGNAME = $1
    EXTENSION = $2

    :0 w
    * EXTENSION ?? .
    | /usr/cyrus/bin/deliver -a "$LOGNAME" -e -q -m "$EXTENSION" -- "$LOGNAME"

    # Only if there was no extension do we try this
    :0 wE
    | /usr/cyrus/bin/deliver -a "$LOGNAME" -e -q -- "$LOGNAME"

    # Whichever one we tried, failed
    EXITCODE = $?
    HOST


I no longer remember what the -a option does which deliver.


Philip Guenther
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail