Dovecot Sieve configuration

November 21, 2015 1.9k views
Email Ubuntu

Hi, I'm trying to configure email filters on my Ubuntu 12.04 server using dovecot, postfix and sieve. My emails are getting sent and received, spamassassin sets correct headers, but I can't make sieve work. Spam still comes to Inbox.

Here's what I got:

dovecot -n

# 2.0.19: /etc/dovecot/dovecot.conf
# OS: Linux 3.8.0-29-generic x86_64 Ubuntu 12.04.4 LTS 
disable_plaintext_auth = no
lda_mailbox_autocreate = yes
lda_mailbox_autosubscribe = yes
mail_debug = yes
mail_location = maildir:~/Mailbox
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 ihave
passdb {
  driver = pam
}
plugin {
  sieve = ~/.dovecot.sieve
  sieve_dir = ~/sieve
  sieve_global_dir = /var/lib/dovecot/sieve/
  sieve_global_path = /var/lib/dovecot/sieve/default.sieve
}
postmaster_address = info@example.com
protocols = imap pop3 sieve
service auth {
  unix_listener /var/spool/postfix/private/dovecot-auth {
    group = postfix
    mode = 0660
    user = postfix
  }
}
ssl_cert = </etc/ssl/certs/dovecot.pem
ssl_cipher_list = ALL:!LOW:!SSLv2:ALL:!aNULL:!ADH:!eNULL:!EXP:RC4+RSA:+HIGH:+MEDIUM
ssl_key = </etc/ssl/private/dovecot.pem
userdb {
  driver = passwd
}
protocol imap {
  imap_client_workarounds = delay-newmail
  mail_max_userip_connections = 10
}
protocol pop3 {
  mail_max_userip_connections = 10
  pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
}
protocol lda {
  deliver_log_format = msgid=%m: %$
  mail_plugins = sieve sieve
  postmaster_address = postmaster
  quota_full_tempfail = yes
  rejection_reason = Your message to <%t> was automatically rejected:%n%r
}
protocol lmtp {
  mail_plugins = " sieve"
}

telnet example.com 4190

Trying 96.75.24.113…
Connected to example.com.
Escape character is '^]'.
"IMPLEMENTATION" "Dovecot Pigeonhole"
"SIEVE" "fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date ihave"
"NOTIFY" "mailto"
"SASL" "PLAIN"
"STARTTLS"
"VERSION" "1.0"
OK "Dovecot ready."

/var/log/mail.log

Nov 21 12:04:10 example postfix/smtpd[13816]: warning: database /etc/aliases.db is older than source file /etc/aliases
Nov 21 12:04:10 example postfix/smtpd[13816]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
Nov 21 12:04:10 example postfix/smtpd[13816]: connect from 60-249-253-146.HINET-IP.hinet.net[60.249.253.146]
Nov 21 12:04:11 example postfix/smtpd[13816]: disconnect from 60-249-253-146.HINET-IP.hinet.net[60.249.253.146]
Nov 21 12:04:13 example postfix/smtpd[13816]: connect from shark3.inbox.lv[194.152.32.83]
Nov 21 12:04:14 example postfix/smtpd[13816]: 1B1DD205E8: client=shark3.inbox.lv[194.152.32.83]
Nov 21 12:04:14 example postfix/cleanup[13824]: 1B1DD205E8: message-id=<1448100253.5650419d7ee43@mail.inbox.lv>
Nov 21 12:04:14 example postfix/qmgr[13791]: 1B1DD205E8: from=<spam-sender@inbox.lv>, size=1585, nrcpt=1 (queue active)
Nov 21 12:04:14 example postfix/smtpd[13816]: disconnect from shark3.inbox.lv[194.152.32.83]
Nov 21 12:04:14 example postfix/pickup[13790]: 664F820BD0: uid=5005 from=<spam-sender@inbox.lv>
Nov 21 12:04:14 example postfix/pipe[13825]: 1B1DD205E8: to=<info-example-com@mail.example.com>, orig_to=<info@example.com>, relay=spamassassin, delay=0.33, delays=0.06/0.01/0/0.26, dsn=2.0.0, status=sent (delivered via spamassassin service)
Nov 21 12:04:14 example postfix/qmgr[13791]: 1B1DD205E8: removed
Nov 21 12:04:14 example postfix/cleanup[13824]: 664F820BD0: message-id=<1448100253.5650419d7ee43@mail.inbox.lv>
Nov 21 12:04:14 example postfix/qmgr[13791]: 664F820BD0: from=<spam-sender@inbox.lv>, size=4557, nrcpt=1 (queue active)
Nov 21 12:04:14 example postfix/local[13829]: warning: database /etc/aliases.db is older than source file /etc/aliases
Nov 21 12:04:14 example postfix/local[13829]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
Nov 21 12:04:14 example dovecot: lda(info-example-com): msgid=<1448100253.5650419d7ee43@mail.inbox.lv>: saved mail to INBOX
Nov 21 12:04:14 example postfix/local[13829]: 664F820BD0: to=<info-example-com@mail.example.com>, relay=local, delay=0.05, delays=0.01/0.01/0/0.03, dsn=2.0.0, status=sent (delivered to command: /usr/lib/dovecot/deliver -c /etc/dovecot/conf.d/01-mail-stack-delivery.conf -m "${EXTENSION}")
Nov 21 12:04:14 example postfix/qmgr[13791]: 664F820BD0: removed

I also have configured sieve for a single user info-example-com:

sievec /home/info-example-com/sieve/dovecot.sieve

sievec(info-example-com): Debug: Effective uid=5002, gid=5002, home=/home/info-example-com

But still no luck. Spam is still in my inbox.

Thanks.

Be the first one to answer this question.