Hello!
I've tried to use extprograms pipe feature but stuck with "Broken pipe" errors in mail log:
May 17 15:18:57 backend1 dovecot: lmtp(20338, user@domain.tld): Debug: 3VMVFWFKllFyTwAArRg8UA: sieve: action pipe: running program: learn May 17 15:18:57 backend1 dovecot: script: Error: write(response) failed: Broken pipe May 17 15:18:57 backend1 dovecot: lmtp(20338, user@domain.tld): 3VMVFWFKllFyTwAArRg8UA: sieve: execution of script /data/mail/storage/domain/user@domain.tld/.dovecot.sieve;name=main script failed, but implicit keep was successful (user logfile /data/mail/storage/domain/buser@domain.tld/.dovecot.sieve.log should reveal additional details)
/data/mail/storage/domain/buser@domain.tld/.dovecot.sieve.log: error: msgid=c7cd36f19be8164addf091a646b8b284@domain.tld: pipe action: failed to pipe message to program `learn': refer to server log for more information. [2013-05-17 15:18:57] ham user@domain.tld 50796.
Sieve script contents: require ["fileinto","copy","mailbox","vnd.dovecot.pipe"];
if anyof (header :is "Subject" "ham") { pipe :try "learn" ["ham"]; fileinto "INBOX/ham"; stop; }
Sieve plugin config uncommented conents: sieve_plugins = sieve_extprograms *sieve_pipe_socket_dir = sieve-pipe*
# Define the executed script as parameter to the sieve service executable = script /etc/dovecot/scripts/spam.sh
# Use some unprivileged user for executing the program user = nobody
# The unix socket located in the sieve_pipe_socket_dir (as defined in the # plugin {} section above) unix_listener sieve-pipe/learn { # LDA/LMTP must have access user = nobody mode = 0777 } }
spam.sh is message processing script which interacts with spamassassin. I've tested pipe with spam.sh that redirects stdin to /dev/null and returns 0 but errors were logged anyway. Note that spam.sh runs, getting the message from sieve and processing it to spamassassin without a problem, but "broken pipe" is being logged.