Nagy Tibor
2019-Aug-06 13:04 UTC
Dovecot Sieve doesn't move spam to Junk folder in maildir
I have an *Ubuntu 16.04* mail server with postfix/spamassassin/*dovecot-2.2.2**2* with virtual mailboxes in maildir format. The whole process is working excellently since a year. Spams are marked with "*****SPAM*****" in subject and with "X-Spam-Flag: YES" in email header. I tried now to add sieve to dovecot to move the SPAM messages into the Junk folder without any success, I don't see any sign that sieve does something at all. The output of "dovecot -n": # 2.2.22 (fe789d2): /etc/dovecot/dovecot.conf # Pigeonhole version 0.4.13 (7b14904) # OS: Linux 4.4.0-72-generic x86_64 Ubuntu 16.04.2 LTS ext4 auth_mechanisms = cram-md5 auth_verbose = yes base_dir = /var/run/dovecot/ info_log_path = /var/log/dovecot.info log_path = /var/log/dovecot log_timestamp = "%Y-%m-%d %H:%M:%S " mail_location = maildir:/home/vmail/%d/%n managesieve_notify_capability = mailto managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext namespace { ? inbox = yes ? location ? prefix ? separator = / } passdb { ? args = /etc/dovecot/passwd ? driver = passwd-file } plugin { ? sieve = /etc/dovecot/sieve/default.sieve } protocols = imap pop3 service auth { ? executable = /usr/lib/dovecot/auth ? unix_listener /var/spool/postfix/private/auth { ??? group = postfix ??? mode = 0666 ??? user = postfix ? } ? user = root } service imap-login { ? chroot = login ? executable = /usr/lib/dovecot/imap-login ? inet_listener imap { ??? port = 0 ? } ? user = dovecot } service imap { ? executable = /usr/lib/dovecot/imap } service pop3-login { ? chroot = login ? executable = /usr/lib/dovecot/pop3-login ? inet_listener pop3 { ??? port = 0 ? } ? inet_listener pop3s { ??? port = 0 ? } ? user = dovecot } service pop3 { ? executable = /usr/lib/dovecot/pop3 } ssl_cert = </etc/ssl/certs/dovecot.pem ssl_key = </etc/ssl/private/dovecot.pem userdb { ? args = /etc/dovecot/users ? driver = passwd-file } valid_chroot_dirs = /var/spool/vmail protocol pop3 { ? pop3_uidl_format = %08Xu%08Xv } protocol lda { ? mail_plugins = " sieve" } I've added only plugin and protocol lda now. The content of the file default.sieve: require "fileinto"; if header :contains "X-Spam-Flag" "YES" { ??? fileinto "Junk"; } The test SPAM message is marked as SPAM, but not moved to the folder Junk. I don't see anything in mail.log that is associated to sieve.: ul 30 20:05:12 zg-3 postfix/smtpd[4446]: connect from smtp4.enternet.hu[62.112.192.37] Jul 30 20:05:13 zg-3 postfix/smtpd[4446]: 3C4CC9F570: client=smtp4.enternet.hu[62.112.192.37] Jul 30 20:05:13 zg-3 postfix/cleanup[4450]: 3C4CC9F570: message-id=<c6b3bca5-ece3-9e69-8e30-28173abc2ec6 at hu.inter.net> Jul 30 20:05:13 zg-3 postfix/qmgr[1557]: 3C4CC9F570: from=<nagyt at hu.inter.net>, size=918, nrcpt=1 (queue active) Jul 30 20:05:13 zg-3 postfix/smtpd[4446]: disconnect from smtp4.enternet.hu[62.112.192.37] ehlo=2 starttls=1 mail=1 rcpt=1 data=1 quit=1 commands=7 Jul 30 20:05:13 zg-3 postfix/pickup[3949]: 5F7FEA3CBC: uid=1003 from=<nagyt at hu.inter.net> Jul 30 20:05:13 zg-3 postfix/pipe[4451]: 3C4CC9F570: to=<tibor at softxs.ch>, relay=spamassassin, delay=0.15, delays=0.05/0.01/0/0.1, dsn=2.0.0, status=sent (delivered via spamassassin service) Jul 30 20:05:13 zg-3 postfix/qmgr[1557]: 3C4CC9F570: removed Jul 30 20:05:13 zg-3 postfix/cleanup[4450]: 5F7FEA3CBC: message-id=<c6b3bca5-ece3-9e69-8e30-28173abc2ec6 at hu.inter.net> Jul 30 20:05:13 zg-3 postfix/qmgr[1557]: 5F7FEA3CBC: from=<nagyt at hu.inter.net>, size=3304, nrcpt=1 (queue active) Jul 30 20:05:13 zg-3 postfix/virtual[4455]: 5F7FEA3CBC: to=<tibor at softxs.ch>, relay=virtual, delay=0.02, delays=0.01/0.01/0/0, dsn=2.0.0, status=sent (delivered to maildir) Jul 30 20:05:13 zg-3 postfix/qmgr[1557]: 5F7FEA3CBC: removed What can be wrong? -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://dovecot.org/pipermail/dovecot/attachments/20190806/b4d0e68f/attachment.html>
Alexander Dalloz
2019-Aug-06 13:21 UTC
Dovecot Sieve doesn't move spam to Junk folder in maildir
Am 2019-08-06 15:04, schrieb Nagy Tibor via dovecot:> I have an *Ubuntu 16.04* mail server with > postfix/spamassassin/*dovecot-2.2.2**2* with virtual mailboxes in > maildir format. The whole process is working excellently since a year. > Spams are marked with "*****SPAM*****" in subject and with > "X-Spam-Flag: YES" in email header. > > I tried now to add sieve to dovecot to move the SPAM messages into the > Junk folder without any success, I don't see any sign that sieve does > something at all. The output of "dovecot -n":[ ... ]> Jul 30 20:05:13 zg-3 postfix/cleanup[4450]: 5F7FEA3CBC: > message-id=<c6b3bca5-ece3-9e69-8e30-28173abc2ec6 at hu.inter.net> > Jul 30 20:05:13 zg-3 postfix/qmgr[1557]: 5F7FEA3CBC: > from=<nagyt at hu.inter.net>, size=3304, nrcpt=1 (queue active) > Jul 30 20:05:13 zg-3 postfix/virtual[4455]: 5F7FEA3CBC: > to=<tibor at softxs.ch>, relay=virtual, delay=0.02, delays=0.01/0.01/0/0, > dsn=2.0.0, status=sent (delivered to maildir)Your Postfix does not deliver via dovecot's LDA, thus sieve never gets called.> Jul 30 20:05:13 zg-3 postfix/qmgr[1557]: 5F7FEA3CBC: removed > > What can be wrong?Alexander
Nagy Tibor
2019-Aug-13 14:21 UTC
Dovecot Sieve doesn't move spam to Junk folder in maildir
You're right, dovecot was not configured as LDA, I did it, and really I see the following line in log/dovecot.info: 2019-08-13 15:49:39 lda(tibor.nagy at softxs.ch): Info: sieve: msgid=<5b78f784-9bc4-aa94-219d-25ccb0d11430 at hu.inter.net>: stored mail into mailbox 'INBOX' I've tried also with a test spam mail and I see the following line in log/dovecot.info: 2019-08-13 15:52:15 lda(tibor.nagy at softxs.ch): Info: sieve: msgid=<904f3c82-6db1-8b5c-d465-ef140c2f5948 at hu.inter.net>: stored mail into mailbox 'Junk' Thanks. -------------------------- Only for information? if somebody is interested for the solution --------------------------------- The appropriate configuration lines in postfix/main.cf: ### Configuration for virtual mailboxes home_mailbox = Maildir/ virtual_mailbox_domains = /etc/postfix/vhosts virtual_mailbox_base = /home/vmail virtual_mailbox_maps = hash:/etc/postfix/vmaps virtual_minimum_uid = 1000 virtual_uid_maps = static:1002 virtual_gid_maps = static:1002 ### Configuration for dovecot as LDA (New 2019-08-13) virtual_transport = dovecot spamassassin_destination_recipient_limit = 1 dovecot_destination_recipient_limit = 1 The appropriate configuration lines in postfix/master.cf smtp????? inet? n?????? -?????? -?????? -?????? -?????? smtpd ? -o content_filter=spamassassin [...] ### Configuration for dovecot as LDA (New 2019-08-13) # spamassassin unix -???? n?????? n?????? -?????? -?????? pipe #? user=spamd argv=/usr/bin/spamc -f -e /usr/sbin/sendmail -oi -f ${sender} ${original_recipient} spamassassin unix -???? n?????? n?????? -?????? -?????? pipe ? flags=DROhu user=vmail:vmail argv=/usr/bin/spamc -f -e ? /usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop} The appropriate configuration lines in dovecot/dovecot.conf: plugin { ? sieve = /etc/dovecot/sieve/default.sieve } protocol lda { ? mail_plugins = $mail_plugins sieve } The appropriate mail.log lines: Aug 13 15:49:37 zg-3 postfix/smtpd[16296]: connect from smarthost06.digicable.hu[94.21.128.16] Aug 13 15:49:37 zg-3 postfix/smtpd[16296]: C1835A3C9F: client=smarthost06.digicable.hu[94.21.128.16] Aug 13 15:49:37 zg-3 postfix/cleanup[16304]: C1835A3C9F: message-id=<5b78f784-9bc4-aa94-219d-25ccb0d11430 at hu.inter.net> Aug 13 15:49:37 zg-3 postfix/qmgr[16267]: C1835A3C9F: from=<nagyt at hu.inter.net>, size=1139, nrcpt=1 (queue active) Aug 13 15:49:37 zg-3 postfix/smtpd[16296]: disconnect from smarthost06.digicable.hu[94.21.128.16] ehlo=2 starttls=1 mail=1 rcpt=1 data=1 quit=1 commands=7 Aug 13 15:49:39 zg-3 postfix/pipe[16305]: C1835A3C9F: to=<tibor.nagy at softxs.ch>, relay=spamassassin, delay=1.9, delays=0.1/0.01/0/1.8, dsn=2.0.0, status=sent (delivered via spamassassin service) Aug 13 15:49:39 zg-3 postfix/qmgr[16267]: C1835A3C9F: removed [...] Aug 13 15:52:15 zg-3 postfix/smtpd[16296]: connect from smtp4.enternet.hu[62.112.192.37] Aug 13 15:52:15 zg-3 postfix/smtpd[16296]: 6C04CA3C9F: client=smtp4.enternet.hu[62.112.192.37] Aug 13 15:52:15 zg-3 postfix/cleanup[16304]: 6C04CA3C9F: message-id=<904f3c82-6db1-8b5c-d465-ef140c2f5948 at hu.inter.net> Aug 13 15:52:15 zg-3 postfix/qmgr[16267]: 6C04CA3C9F: from=<nagyt at hu.inter.net>, size=917, nrcpt=1 (queue active) Aug 13 15:52:15 zg-3 postfix/smtpd[16296]: disconnect from smtp4.enternet.hu[62.112.192.37] ehlo=2 starttls=1 mail=1 rcpt=1 data=1 quit=1 commands=7 Aug 13 15:52:15 zg-3 postfix/pipe[16305]: 6C04CA3C9F: to=<tibor.nagy at softxs.ch>, relay=spamassassin, delay=0.23, delays=0.04/0/0/0.19, dsn=2.0.0, status=sent (delivered via spamassassin service) Aug 13 15:52:15 zg-3 postfix/qmgr[16267]: 6C04CA3C9F: removed 2019. 08. 06. 15:21 keltez?ssel, Alexander Dalloz via dovecot ?rta:> Am 2019-08-06 15:04, schrieb Nagy Tibor via dovecot: >> I have an *Ubuntu 16.04* mail server with >> postfix/spamassassin/*dovecot-2.2.2**2* with virtual mailboxes in >> maildir format. The whole process is working excellently since a year. >> Spams are marked with "*****SPAM*****" in subject and with >> "X-Spam-Flag: YES" in email header. >> >> I tried now to add sieve to dovecot to move the SPAM messages into the >> Junk folder without any success, I don't see any sign that sieve does >> something at all. The output of "dovecot -n": > > [ ... ] > >> Jul 30 20:05:13 zg-3 postfix/cleanup[4450]: 5F7FEA3CBC: >> message-id=<c6b3bca5-ece3-9e69-8e30-28173abc2ec6 at hu.inter.net> >> Jul 30 20:05:13 zg-3 postfix/qmgr[1557]: 5F7FEA3CBC: >> from=<nagyt at hu.inter.net>, size=3304, nrcpt=1 (queue active) >> Jul 30 20:05:13 zg-3 postfix/virtual[4455]: 5F7FEA3CBC: >> to=<tibor at softxs.ch>, relay=virtual, delay=0.02, delays=0.01/0.01/0/0, >> dsn=2.0.0, status=sent (delivered to maildir) > > Your Postfix does not deliver via dovecot's LDA, thus sieve never gets called. > >> Jul 30 20:05:13 zg-3 postfix/qmgr[1557]: 5F7FEA3CBC: removed >> >> What can be wrong? > > > Alexander > >