2015-05-11 4 views
-2

Я устанавливаю Postfix с Spamassassin и Dovecot с ситом. Spamassassin пометит письмо как спам.Сито не фильтрует электронную почту

Я пытаюсь заставить Сито перемещать почту, помеченную как «Спам» от SpamAssassin, в папку Junk. Однако это не так. Я понятия не имею, что я делаю неправильно, и я очень расстроен.

Вот мой dovecot.conf свалка:

$ 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 = 
} 

Мой /etc/dovecot/sieve/sieve.default заключается в следующем:

$ cat /etc/dovecot/sieve/sieve.default 
require "fileinto"; 
if header :contains "X-Spam-Flag" "YES" { 
    fileinto "Junk"; 
} 

Папка "Нежелательная" существует. Вот дамп электронной почты:

From [email protected] Mon May 11 14:37:44 2015 
Return-Path: <[email protected]> 
X-Original-To: [email protected] 
Delivered-To: [email protected] 
Received: by Linux-Mint (Postfix, from userid 5001) 
    id A59ECE34D1; Mon, 11 May 2015 14:37:44 -0400 (EDT) 
Received: from localhost by Linux-Mint 
    with SpamAssassin (version 3.4.0); 
    Mon, 11 May 2015 14:37:44 -0400 
From: User <[email protected]> 
To: [email protected] 
Subject: *****SPAM***** This is Junk Mail 
Date: Mon, 11 May 2015 14:37:38 -0400 
Message-Id: <[email protected]> 
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 

This is a 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 the system "Linux-Mint", 
has identified this incoming email as possible spam. The original 
message has been attached to this so you can view it or label 
similar future email. If you have any questions, see 
@@[email protected]@ for 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 for 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: from domain.tld (my-hostname.domain.tld [IPv6:REMOVED]) 
    by Linux-Mint (Postfix) with ESMTPS id 0A6A2E34BF 
    for <[email protected]>; Mon, 11 May 2015 14:37:40 -0400 (EDT) 
Received: from user-pc (unknown [IPv6:2001:470:8:209::c0ff:ee]) 
    by domain.tld (Postfix) with ESMTPSA id 03FD41028E 
    for <[email protected]>; Mon, 11 May 2015 18:37:40 +0000 (UTC) 
Date: Mon, 11 May 2015 14:37:38 -0400 
From: User <[email protected]> 
To: [email protected] 
Subject: This is Junk Mail 
Message-ID: <[email protected]> 
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-- 

Я проверяю это письмо от одного сервера к другому, отправитель и получатель не та же машина. Получателем был [email protected], а отправителем был [email protected] Письмо ясно обозначено как спам.

Почему он не перемещает электронную почту в папку нежелательной почты?

+0

Также два порта сита 4190 и 2000 открыты. –

+0

Некоторые журналы действительно помогут здесь: установите 'debug_log_path =/var/log/dovecot-debug.log' и опубликуйте, что вы получаете в нем. Также опубликуйте, что отображается в '/ var/log/dovecot-info.log' и'/var/log/dovecot.log' –

ответ

3

Обдумал это. Поскольку я все еще ноб, мой ответ может быть не лучшим, но я надеюсь, что это поможет кому-то там.

У этого было несколько проблем, но в основном постфикс не отправлял почту довеста для доставки. Dovecot + сито были полностью обойдены.

Чтобы исправить это, мне пришлось установить Postfix и Dovecot через lmtp. Во-первых, я устанавливаю 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 
    } 
} 

Тогда я должен был сообщить postfix, чтобы поговорить с dovecot. Я сделал это, сделав это:

virtual_transport = lmtp:[::1]:10025 

Затем, вернувшись к dovecot, мне пришлось правильно настроить сито.

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 to load (none known to be useful so far). 
    # Do NOT try to 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 

} 

Отсюда я ставлю в стандартных правилах SpamAssassin фильтра в /etc/dovecot/sieve/sieve.default, что в моем случае было:

require "fileinto"; 
if header :contains "X-Spam-Flag" "YES" { 
    fileinto "Junk"; 
} 

После этого я побежал:

sievec /etc/dovecot/sieve/sieve.default 

Это «скомпилированное» правило сита. И, наконец, я перезапустил dovecot и postfix.

sudo service dovecot restart 
sudo service postfix restart 

После этого я отправил себе пробный спам и был перенаправлен в папку со спамом. Надеюсь, это поможет, и я прошу вас простить и исправить любые ошибки, которые я, возможно, сделал.