Andrew, what version of Cyrus are you using procmail with using the
procdures you describe below?  Is it versin 2.x or 1.x?

--Moby

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Andrew K
Bressen
Sent: Thursday, March 15, 2001 17:08 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: sendmail -> procmail -> cyrus deliver -> lmtpd [was: Re:
Manually using deliver to test cyrus imapd]




>cat /etc/printcap | /usr/cyrus/bin/deliver giel

deliver expects that the file you hand it will be
rfc-822 compliant; ie, it has to look like
a mail message, not just any old file.

Make sure it doesn't have a berkeley mailbox seperator
in the header, either. This is the line that begins
with "From " (as opposed to the one that starts "From:",
which is ok).

Make sure whoever is running deliver is in the mail group,
can get access to the lmtp socket file (usually same thing
as being in the mail group),
and that they have "post" (p) permission on the mailbox
(do that via cyradm).


I've taken the following steps, and though I have not yet finished
testing, things seem to work.


(1)
Add the X flag to the Mlocal mailer definition in sendmail.cf.
My local definition is now:
Mlocal,         P=/usr/bin/procmail, F=lsDFMAw5:/|@qSPfhn9X,
                S=EnvFromL/HdrFromL, R=EnvToL/HdrToL,
                T=DNS/RFC822/X-Unix,
                A=procmail -Y -a $h -d $u

I may have to remove the "9" flag; I'm unsure if lmtp would
choke on the "limited" 7 to 8 bit conversion.

(2)
I want procmail to run as root so it can chuid to the
enduser (and run their ~/.procmailrc) after invoking cyrus deliver.

cyrus deliver can only be invoked by users in group mail,
so make sure root is in that group.

(3)
using cyradm, make sure the acl's on user
mailboxes allow p (posting) by "anyone" (or at least
by the user sendmail/procmail/deliver is running as).

(4)
create an appropriate /etc/procmailrc

#
# procmail code to file all messages in both spool and cyrus imap store
#    AK Bressen, "[EMAIL PROTECTED]"
#    this is my first procmailrc, and it probably shows.
#    it does seem to work, though I haven't torture-tested it.
#

LOGFILE=/var/log/procmail.log
AFTERPLUS=$1

# theoretically, if there's stuff you want done to the mail
# before it gets to cyrus, this is a good place for an
# INCLUDERC hook. Just be warned it will run as root.


# first, match everything and fork (in case deliver hangs)
# part one of the fork will give the message to cyrus
:0 c
{
  # filter out berkeley from line.
  # also, rename return-path header just in case.
  :0 f
  | formail -R 'From ' 'X-Envelope-From:' -i 'Return-Path'

  # give to cyrus, if there's something after a plus
  :0
  * AFTERPLUS ?? .
  | /usr/local/cyrus/bin/deliver -m $AFTERPLUS $LOGNAME

  # give to cyrus if there is no plus
  :0
  * AFTERPLUS ?? !.
  | /usr/local/cyrus/bin/deliver $LOGNAME
}

# down here in part two, we give the message to the regular mailspool
:0
{
  # drop privs, can be the user from here down
  DROPPRIVS=yes

  # strip rfc821 dot protection
  #     well, ok, I won't bother with that for now.
  #     an extra dot if the last line of the message is just a dot
  #     just isn't such a hassle. do make sure to set the X flag
  #     in the sendmail local def, though. elsewise a line anywhere in
  #     a message containing just a period will probably end the mail
message
  #     as far as cyrus is concerned, since deliver most likely does not
  #     apply dot protection (deliver expects the message to already be
  #     rfc821/rfc822 compliant)

  # either deliver or grab user .procmailrc...
  :0
  INCLUDERC = /home/$LOGNAME/.procmailrc

  # if there's no user procmailrc, then
  # into /var/spool/mail/username with the message
  # this of course results in two copies of every message, one to
  # conventional spool and one to cyrus.
  :0 e
  $ORGMAIL
}
# end of procmail file




Reply via email to