correct usage for Pigeonhole sieve message *redirect* to external server?
i've installed
rpm -qa | grep dovecot
dovecot-2.3.10.1-1.fc32.x86_64
dovecot-pigeonhole-2.3.10.1-1.fc32.x86_64
i'm setting up imapsieve spam reporting; following,
https://doc.dovecot.org/configuration_manual/spam_reporting/
https://wiki.dovecot.org/HowTo/AntispamWithSieve
https://wiki.dovecot.org/Pigeonhole/Sieve/Examples
my config currrently includes
protocol imap {
mail_plugins = $mail_plugins acl imap_acl quota imap_quota imap_sieve mail_log notify
mail_max_userip_connections = 20
imap_client_workarounds = tb-extra-mailbox-sep
}
protocol sieve {
mail_plugins = $mail_plugins
mail_max_userip_connections = 10
}
plugin {
# From elsewhere to Spam folder
imapsieve_mailbox1_name = Spam
imapsieve_mailbox1_causes = COPY
imapsieve_mailbox1_before = file:/etc/dovecot/scripts/report-spam.sieve
# From Spam folder to elsewhere
imapsieve_mailbox2_name = *
imapsieve_mailbox2_from = Spam
imapsieve_mailbox2_causes = COPY
imapsieve_mailbox2_before = file:/etc/dovecot/scripts/report-ham.sieve
sieve_plugins = sieve_imapsieve
sieve_pipe_bin_dir = /etc/dovecot/scripts
}
service submission-login {
inet_listener submission {
address = 10.0.1.70, 127.0.0.1
port = 60465
ssl = yes
}
}
examples @ wiki include
report-spam.sieve
require "vnd.dovecot.report";
report "abuse" "User added this message to the Spam folder." "spam-report@example.com";
instead of a 'report', i want to *redirect* the _unmodified_ Spam message to an _external_ email that's a feed for a bayes spam learner.
to that end i modified
/etc/dovecot/scripts/report-spam.sieve
require ["vnd.dovecot.report", "vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"];
if environment "imap.mailbox" "Trash" {
stop;
}
if environment "imap.mailbox" "Spam" {
stop;
}
redirect "spam.learn@othermx.example.net";
with that^, when I drag a spam message into my user account's Spam folder, I see in logs only
2020-09-15 08:52:16 imap(myuser@example.com)<bCdiIOuhPImsDgsd>: Debug: Mailbox Junk: Mailbox opened because: UID move
2020-09-15 08:52:16 imap(myuser@example.com)<bCdiIOuhPImsDgsd>: Debug: acl vfile: file /home/vmail/conf.d/example.com/acls/Junk not found
2020-09-15 08:52:16 imap(myuser@example.com)<bCdiIOuhPImsDgsd>: Debug: acl vfile: file /data/vmail/example.com/myuser/Maildir/Junk/dovecot-acl not found
2020-09-15 08:52:16 imap(myuser@example.com)<bCdiIOuhPImsDgsd>: Debug: imapsieve: mailbox Junk: MOVE event
2020-09-15 08:52:16 imap(myuser@example.com)<bCdiIOuhPImsDgsd>: Debug: sieve: Pigeonhole version 0.5.10 (bf8ef1c2) initializing
2020-09-15 08:52:16 imap(myuser@example.com)<bCdiIOuhPImsDgsd>: Debug: sieve: include: sieve_global is not set; it is currently not possible to include `:global' scripts.
2020-09-15 08:52:16 imap(myuser@example.com)<bCdiIOuhPImsDgsd>: Debug: sieve: Sieve imapsieve plugin for Pigeonhole version 0.5.10 (bf8ef1c2) loaded
2020-09-15 08:52:16 imap(myuser@example.com)<bCdiIOuhPImsDgsd>: Debug: imapsieve: Static mailbox rule [1]: mailbox=`Spam' from=`*' causes=(COPY) => before=`file:/etc/dovecot/scripts/report-spam.sieve' after=(none)
2020-09-15 08:52:16 imap(myuser@example.com)<bCdiIOuhPImsDgsd>: Debug: imapsieve: Static mailbox rule [2]: mailbox=`*' from=`Spam' causes=(COPY) => before=`file:/etc/dovecot/scripts/report-ham.sieve' after=(none)
==> /var/log/dovecot/dovecot-info.log <==
2020-09-15 08:52:16 imap(myuser@example.com)<bCdiIOuhPImsDgsd>: Info: copy from INBOX: box=Junk, uid=4, msgid=<0e9fc21a-c046-46bd-a4ae-e7a1b6424ca7.maildroid@localhost>, size=5647
2020-09-15 08:52:16 imap(myuser@example.com)<bCdiIOuhPImsDgsd>: Info: expunge: box=INBOX, uid=50, msgid=<0e9fc21a-c046-46bd-a4ae-e7a1b6424ca7.maildroid@localhost>, size=5647
but no redirect occurs; nothing's sent.
what additional/different config is required to get the sieve processor to *send* that email?
in sieve redirect, _is_ the dovecot submission port implicitly used for sending/redirect? or does the report-spam script need additional capability to exec the send?
On 9/15/20 9:08 AM, PGNet Dev wrote:
what additional/different config is required to get the sieve processor to *send* that email?
'redirect' was the wrong action for this case.
as was 'pipe'.
an 'execute :pipe' action does the trick.
this
report-spam.sieve
require ["vnd.dovecot.pipe", "vnd.dovecot.execute", "environment", "variables"];
execute :pipe "msmtp_send.sh" ["dovecotsubmit", "sieve@mx.example.com", "spam.learn@othermx.example.net"];
stop;
with
msmtp_send.sh
#!/usr/bin/env bash
export ACCT="$1"
export FROM="$2"
export TO="$3"
export MSMTP="/usr/bin/msmtp"
export DEBUG="--debug"
${MSMTP} ${DEBUG} --account="${ACCT}" --from="${FROM}" "${TO}"
exit 0
and setting up /etc/msmtprc, accountid = 'dovecotsubmit' to use my dovecot server's submission service+port
works.
participants (1)
-
PGNet Dev