Call procmail after sieve

George Asenov george.asenov at wpx.net
Wed Aug 31 09:40:30 UTC 2022


Hello,

I'm trying to achieve the following scenario with dovecot + sieve + 
procmail.

Dovecot is set as LDA in postfix (if this makes any difference)
I need to set sieve that after it has executed all it's scripts 
(including before, ~/.sieve etc) and if keep is in still in effect to 
call procmail to also execute the custom user filters and then return 
(if it is not forwarded elsewhere or some) to dovecot for normal delivery.

If you ask this I need this for backward compatibility. I now use 
procmail for local delivery,spam/virus filtering,  and users have set a 
lot of custom filters/redirects.

mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME

  I want to migrate to dovecot as lda and sieve for filtering but to 
keep procmail working for a while.

I have tried to follow (partially) this guide 
https://www.enricozini.org/blog/2022/debian/migrating-from-procmail-to-sieve/ 
but procmail fails to execute

##########################
Aug 30 15:22:26 uk7 dovecot[112151]: 
lda(test-uk7.teststring567.tk)<112151><BlNhECIdDmMXtgEAsVjU+A>: Debug: 
program exec:/var/lib/dovecot/sieve-pipe/procmail: Establishing connection
Aug 30 15:22:26 uk7 dovecot[112151]: 
lda(test-uk7.teststring567.tk)<112151><BlNhECIdDmMXtgEAsVjU+A>: Debug: 
program exec:/var/lib/dovecot/sieve-pipe/procmail: Forked child process
Aug 30 15:22:26 uk7 dovecot[112151]: 
lda(test-uk7.teststring567.tk)<112151><BlNhECIdDmMXtgEAsVjU+A>: Debug: 
program exec:/var/lib/dovecot/sieve-pipe/procmail (112153): Connected to 
program
Aug 30 15:22:26 uk7 dovecot[112151]: 
lda(test-uk7.teststring567.tk)<112151><BlNhECIdDmMXtgEAsVjU+A>: Debug: 
program exec:/var/lib/dovecot/sieve-pipe/procmail (112153): Finished 
streaming payload to program
Aug 30 15:22:26 uk7 dovecot[112151]: 
lda(test-uk7.teststring567.tk)<112151><BlNhECIdDmMXtgEAsVjU+A>: Debug: 
program exec:/var/lib/dovecot/sieve-pipe/procmail (112153): Finished 
input to program
Aug 30 15:22:26 uk7 dovecot[112151]: 
lda(test-uk7.teststring567.tk)<112151><BlNhECIdDmMXtgEAsVjU+A>: Debug: 
program exec:/var/lib/dovecot/sieve-pipe/procmail (112153): Disconnected
Aug 30 15:22:26 uk7 dovecot[112151]: 
lda(test-uk7.teststring567.tk)<112151><BlNhECIdDmMXtgEAsVjU+A>: Debug: 
program exec:/var/lib/dovecot/sieve-pipe/procmail (112153): Waiting for 
program to finish after 0 msecs (timeout = 10000 msecs)
Aug 30 15:22:26 uk7 dovecot[112153]: 
lda(test-uk7.teststring567.tk)<112151><BlNhECIdDmMXtgEAsVjU+A>: Fatal: 
execvp(/var/lib/dovecot/sieve-pipe/procmail) failed: Permission denied
Aug 30 15:22:26 uk7 dovecot[112151]: 
lda(test-uk7.teststring567.tk)<112151><BlNhECIdDmMXtgEAsVjU+A>: Debug: 
program exec:/var/lib/dovecot/sieve-pipe/procmail (112153): Child 
process ended
Aug 30 15:22:26 uk7 dovecot[112151]: 
lda(test-uk7.teststring567.tk)<112151><BlNhECIdDmMXtgEAsVjU+A>: program 
exec:/var/lib/dovecot/sieve-pipe/procmail (112153): Terminated with 
non-zero exit code 75
Aug 30 15:22:26 uk7 dovecot[112151]: 
lda(test-uk7.teststring567.tk)<112151><BlNhECIdDmMXtgEAsVjU+A>: Debug: 
program exec:/var/lib/dovecot/sieve-pipe/procmail (112153): Destroy
Aug 30 15:22:26 uk7 dovecot[112151]: 
lda(test-uk7.teststring567.tk)<112151><BlNhECIdDmMXtgEAsVjU+A>: Error: 
sieve: failed to execute to program `procmail': refer to server log for 
more information. [2022-08-30 15:22:26]
###############################
i couldn't find the logs referred

here some relative (on my opinion) configs:
################################
#/etc/dovecot/conf.d/90-sieve.conf
plugin {
   sieve = file:~/sieve;active=~/.dovecot.sieve
   sieve_plugins = sieve_extprograms
   sieve_extensions = +vnd.dovecot.pipe
   sieve_pipe_bin_dir = /var/lib/dovecot/sieve-pipe
   sieve_after = /var/lib/dovecot/sieve_after
   sieve_trace_dir = ~/.sieve-trace
   sieve_trace_level = matching
   sieve_trace_debug = yes
}
####################################
#/var/lib/dovecot/sieve-pipe/procmail

#!/bin/sh
exec /usr/bin/procmail
#####################################
#/var/lib/dovecot/sieve_after/procmail.sieve
require "vnd.dovecot.pipe";

pipe "procmail";
#####################################

#cat /etc/procmailrc

SHELL="/bin/bash"
SENDMAIL="/usr/sbin/sendmail"
SENDMAILFLAGS="-oi -t""
LOGFILE="/var/log/procmail.log"
# fully define here so user .procmailrc can use it too
DELIVER="/usr/libexec/dovecot/deliver -d $LOGNAME"
# fallback:
DEFAULT="$HOME/Maildir/"
MAILDIR="$HOME/Maildir/"

# deliver spam to spam folder
:0 w
* ^X-Spam-Status: Yes
| $DELIVER -m spam

# uncomment next line to support user .procmailrc files
INCLUDERC=$HOME/.procmailrc

# deliver to INBOX and stop
:0 w
| $DELIVER
#########################################

Thank you in advance


More information about the dovecot mailing list