procmail, cyrdeliver, mailbox names

brian cyrus-imap at logi.ca
Thu Mar 11 00:10:56 EST 2010


cyrus-imapd 2.2.13-14ubuntu3

This doesn't only concern Cyrus but please bear with me. I believe my 
final hurdle does specifically involve cyrus.

I'm trying to get procmail to send SPAM to Junk folders for virtual 
users. I have it set up to use cyrdeliver for that. I feel like I'm 
almost there but I haven't been able to figure out precisely how to pass 
the mailbox name.

These are all virtual users, so I can't use $HOME in procmailrc. For the 
example below, the mailbox is at:

/var/spool/cyrus/mail/domain/f/foo.org/b/user/bally

This was giving me headaches with procmail until i realised that I could 
have it pass the job to cyrdeliver, which I expected would know to do 
the right thing. However, it looks like I'm not passing it the correct 
info to do so. I keep getting "Mailbox does not exist" errors because of 
the way that cyrdeliver expects the mailbox name.

Additionally, the account login names are the complete email address.

I should mention that everything--including Spamassassin--is otherwise 
working properly.


/etc/postfix/master.cf:

spamassassin unix -     n       n       -       -       pipe
         user=spamd argv=/usr/bin/spamc -f -e
         /usr/sbin/sendmail -oi -f ${sender} ${recipient}
procmail    unix    -    n    n    -    -    pipe
     flags=R user=cyrus argv=/usr/bin/procmail -t
     -m USER=${user}@${domain}
     EXTENSION=${extension} /etc/procmailrc



bally at artemis:/etc$ sudo cat procmailrc
PATH=/usr/local/bin:/usr/bin:/bin
SHELL = /bin/sh
LOGFILE     = /var/log/procmail.log
LOGABSTRACT = "all"
VERBOSE     = "on"

:0
* ^X-Spam-Flag: YES
| /usr/sbin/cyrdeliver -a $USER -m $USER.junk

:0
| /usr/sbin/cyrdeliver -a $USER -m $USER



/var/log/mail.log:
Mar 10 23:23:09 artemis postfix/pipe[44136]: 4C327A5041D: 
to=<bally at foo.org>, relay=spamassassin, delay=0.65, 
delays=0.35/0.01/0/0.3, dsn=2.0.0, status=sent (delivered via 
spamassassin service)
Mar 10 23:23:09 artemis postfix/qmgr[40037]: 4C327A5041D: removed
Mar 10 23:23:09 artemis postfix/pickup[38654]: C42CEA5041D: uid=5001 
from=<bally at other_domain>
Mar 10 23:23:09 artemis postfix/cleanup[44126]: C42CEA5041D: 
message-id=<4B98702C.1040804 at other_domain>
Mar 10 23:23:09 artemis postfix/qmgr[40037]: C42CEA5041D: 
from=<bally at other_domain>, size=1657, nrcpt=1 (queue active)
Mar 10 23:23:09 artemis postfix/pipe[44160]: C42CEA5041D: 
to=<bally at foo.org>, relay=procmail, delay=0.04, delays=0.02/0.01/0/0.01, 
dsn=2.0.0, status=sent (delivered via procmail service)
Mar 10 23:23:09 artemis cyrus/master[44163]: about to exec 
/usr/lib/cyrus/bin/lmtpd
Mar 10 23:23:09 artemis postfix/qmgr[40037]: C42CEA5041D: removed
Mar 10 23:23:09 artemis cyrus/lmtpunix[44163]: executed
Mar 10 23:23:09 artemis cyrus/lmtpunix[44163]: accepted connection
Mar 10 23:23:09 artemis cyrus/lmtpunix[44163]: lmtp connection preauth'd 
as postman
Mar 10 23:23:09 artemis cyrus/lmtpunix[44163]: 
verify_user(foo.org.junk!bally) failed: Mailbox does not exist
Mar 10 23:23:14 artemis postfix/smtpd[44108]: auto_clnt_close: 
disconnect private/tlsmgr stream
Mar 10 23:23:14 artemis postfix/smtpd[44108]: rewrite stream disconnect


bally at artemis:/etc$ sudo cat /var/log/procmail.log
procmail: [44161] Wed Mar 10 23:23:09 2010
procmail: Match on "^X-Spam-Flag: YES"
procmail: Executing 
"/usr/sbin/cyrdeliver,-a,bally at foo.org,-m,bally at foo.org.Junk"
procmail: Assigning "LASTFOLDER=/usr/sbin/cyrdeliver -a bally at foo.org -m 
bally at foo.org.Junk"
  Subject: [***** SPAM 2.9 *****] test
   Folder: /usr/sbin/cyrdeliver -a bally at foo.org -m bally at dom       1652



Some other things I've tried (in master.cf):

-m USER=${original_recipient}

verify_user(foo.org.junk!bally) failed: Mailbox does not exist

.. and, in procmailrc:

:0
* ^X-Spam-Flag: YES
| /usr/sbin/cyrdeliver -a $USER -m user.$USER.junk

:0
| /usr/sbin/cyrdeliver -a $USER -m user.$USER

verify_user(foo.org.junk!user.bally) failed: Mailbox does not exist


What's the format that cyrdeliver expects, given my mailbox setup?


Finally, the actual users' junk box is named, "Junk". I renamed my test 
user's because I noticed that cyrdeliver seemed to be folding the 
mailbox name to lowercase (though I'm not passing -u). Renaming didn't 
seem to help but I'm a bit confused. In imapd.conf, I have 
lmtp_downcase_rcpt: yes, but this is the mailbox name, not the 
recipient, so I'm not sure if this is the reason. What I can do about 
this, short of having all the users rename their Junk folders?

I also have unixhierarchysep: no, in case that's relevant to the above.


More information about the Info-cyrus mailing list