postfix mta - Sieve not filtering email -


i setup postfix spamassassin , dovecot sieve. spamassassin tag email spam.

i trying sieve move mail tagged "spam" spamassassin junk folder. however, not doing so. have no idea doing wrong , quite frustrated.

here's dovecot.conf dump:

$ dovecot -n # 2.2.9: /etc/dovecot/dovecot.conf # os: linux 3.13.0-37-generic x86_64 linux mint 17.1 rebecca ext4 info_log_path = /var/log/dovecot-info.log log_path = /var/log/dovecot.log mail_location = maildir:/var/mail/vmail/%u 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 namespace {   inbox = yes   location =    mailbox drafts {     auto = subscribe     special_use = \drafts   }   mailbox junk {     auto = subscribe     special_use = \junk   }   mailbox sent {     auto = subscribe     special_use = \sent   }   mailbox trash {     auto = subscribe     special_use = \trash   }   prefix =    separator = /   type = private } passdb {   args = scheme=plain /etc/dovecot/passwd   driver = passwd-file } plugin {   sieve = ~/.dovecot.sieve   sieve_before = /etc/dovecot/sieve/sieve.default   sieve_default = /etc/dovecot/sieve/sieve.default   sieve_dir = ~/sieve   sieve_global_dir = /var/lib/dovecot/sieve/ } protocols = imap lmtp sieve service auth {   unix_listener /var/spool/postfix/private/auth {     group = postfix     user = postfix   } } service managesieve-login {   inet_listener sieve {     port = 4190   }   inet_listener sieve_deprecated {     port = 2000   }   process_min_avail = 0   service_count = 1   vsz_limit = 64 m } service managesieve {   process_limit = 1024 } ssl_cert = </etc/ssl/certs/ssl-cert-snakeoil.pem ssl_key = </etc/ssl/private/ssl-cert-snakeoil.key userdb {   args = uid=vmail gid=vmail home=/home/vmail/%u   driver = static } protocol lda {   mail_plugins = " sieve" } protocol lmtp {   mail_plugins = " sieve" } protocol sieve {   mail_max_userip_connections = 10   mail_plugins =    managesieve_implementation_string = dovecot pigeonhole   managesieve_logout_format = bytes=%i/%o   managesieve_max_compile_errors = 5   managesieve_max_line_length = 65536   managesieve_notify_capability =    managesieve_sieve_capability =  } 

my /etc/dovecot/sieve/sieve.default following:

$ cat /etc/dovecot/sieve/sieve.default require "fileinto"; if header :contains "x-spam-flag" "yes" {     fileinto "junk"; } 

the "junk" folder exists. here dump of email:

from user@domain.tld mon may 11 14:37:44 2015 return-path: <user@domain.tld> x-original-to: user@testmail.domain.tld delivered-to: user@testmail.domain.tld received: linux-mint (postfix, userid 5001)     id a59ece34d1; mon, 11 may 2015 14:37:44 -0400 (edt) received: localhost linux-mint     spamassassin (version 3.4.0);     mon, 11 may 2015 14:37:44 -0400 from: user <user@domain.tld> to: user@testmail.domain.tld subject: *****spam***** junk mail date: mon, 11 may 2015 14:37:38 -0400 message-id: <20150511183738.gd7930@user-pc> x-spam-checker-version: spamassassin 3.4.0 (2014-02-07) on linux-mint x-spam-flag: yes x-spam-level: ************************************************** x-spam-status: yes, score=1000.0 required=5.0 tests=gtube autolearn=no     autolearn_force=no version=3.4.0 mime-version: 1.0 content-type: multipart/mixed; boundary="----------=_5550f6f8.2df3e67d" status: ro content-length: 1867 lines: 52  multi-part message in mime format.  ------------=_5550f6f8.2df3e67d content-type: text/plain; charset=iso-8859-1 content-disposition: inline content-transfer-encoding: 8bit  spam detection software, running on system "linux-mint", has identified incoming email possible spam.  original message has been attached can view or label similar future email.  if have questions, see @@contact_address@@ details.  content preview:  gtube string: xjs*c4jdbqadn1.nsbn3*2idnen*gtube-standard-anti-ube-test-email*c.34x    [...]   content analysis details:   (1000.0 points, 5.0 required)   pts rule name              description ---- ---------------------- -------------------------------------------------- 1000 gtube                  body: generic test unsolicited bulk email    ------------=_5550f6f8.2df3e67d content-type: message/rfc822; x-spam-type=original content-description: original message before spamassassin content-disposition: inline content-transfer-encoding: 8bit  received: domain.tld (my-hostname.domain.tld [ipv6:removed])     linux-mint (postfix) esmtps id 0a6a2e34bf     <user@testmail.domain.tld>; mon, 11 may 2015 14:37:40 -0400 (edt) received: user-pc (unknown [ipv6:2001:470:8:209::c0ff:ee])     domain.tld (postfix) esmtpsa id 03fd41028e     <user@testmail.domain.tld>; mon, 11 may 2015 18:37:40 +0000 (utc) date: mon, 11 may 2015 14:37:38 -0400 from: user <user@domain.tld> to: user@testmail.domain.tld subject: junk mail message-id: <20150511183738.gd7930@user-pc> mime-version: 1.0 content-type: text/plain; charset=us-ascii content-disposition: inline user-agent: mutt/1.5.21 (2010-09-15)  gtube string: xjs*c4jdbqadn1.nsbn3*2idnen*gtube-standard-anti-ube-test-email*c.34x   ------------=_5550f6f8.2df3e67d-- 

i testing email 1 server another, sender , receiver not same machine. recipient user@testmail.domain.tld , sender user@domain.tld. email marked spam.

why isn't moving email junk folder?

figured out. still noob, answer may not best, hope helps out there.

this had few problems, postfix not routing mail dovecot delivery. dovecot+sieve totally bypassed.

to fix this, had have postfix , dovecot communicate on lmtp. first, setup dovecot:

  protocol lda {             mail_plugins = $mail_plugins sieve     }    protocol lmtp {         mail_plugins = $mail_plugins sieve   }  service lmtp {    inet_listener lmtp {     address = 127.0.0.1 ::1     port = 10025    } } 

then had tell postfix talk dovecot. did doing:

virtual_transport = lmtp:[::1]:10025 

then dovecot, had configure sieve.

plugin {         sieve = ~/.dovecot.sieve         sieve_dir = ~/sieve         sieve_before = /etc/dovecot/sieve/sieve.default         sieve_default = /etc/dovecot/sieve/sieve.default         sieve_global_dir = /var/lib/dovecot/sieve/ } service managesieve-login {   inet_listener sieve {     port = 4190   }    service_count = 1    process_min_avail = 0    vsz_limit = 64m }  service managesieve {    process_limit = 1024 }  protocol sieve {   managesieve_max_line_length = 65536    mail_max_userip_connections = 10    # space separated list of plugins load (none known useful far).   # not try load imap plugins here.   mail_plugins =    managesieve_logout_format = bytes=%i/%o    managesieve_implementation_string = dovecot pigeonhole    managesieve_sieve_capability =   managesieve_notify_capability =    managesieve_max_compile_errors = 5  } 

from here put in standard spamassassin filter rules in /etc/dovecot/sieve/sieve.default, in case was:

require "fileinto"; if header :contains "x-spam-flag" "yes" {   fileinto "junk"; } 

after that, ran:

sievec /etc/dovecot/sieve/sieve.default 

this "compiled" sieve rules. , finally, restarted dovecot , postfix.

sudo service dovecot restart sudo service postfix restart 

upon that, sent myself test spam , redirected spam folder. hope helps , ask pardon , correct mistakes may have made.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -