用postfixdebuggingspamassassin

我正在尝试在我的postfix邮件服务器上安装spamassassin milter。

SpamAssassin Server version 3.4.1 running on Perl 5.20.2 with SSL support (IO::Socket::SSL 2.019) with zlib support (Compress::Zlib 2.064) Postfix mail_version = 2.11.3 

当我通过将它添加到这条线来激活milter:

 smtpd_milters = unix:/spamassassin/spamd.sock unix:/clamav/clamav-milter.ctl unix:/opendkim/opendkim.sock 

奇怪的是,发送邮件需要更长的时间才能完成(我认为spamassassin只适用于收到的电子邮件),我得到以下日志:

 Jan 28 15:39:38 mymailserver spamd[22388]: spamd: got connection over /var/spool/postfix/spamassassin/spamd.sock Jan 28 15:40:08 mymailserver spamd[22388]: spamd: timeout: (30 second socket timeout reading input from client) Jan 28 15:40:08 mymailserver postfix/smtpd[29865]: warning: milter unix:/spamassassin/spamd.sock: unreasonable packet length: 1397768525 > 1073741823 Jan 28 15:40:08 mymailserver postfix/smtpd[29865]: warning: milter unix:/spamassassin/spamd.sock: read error in initial handshake 

最后一个错误是随机变化的,有时它会抱怨期望的东西,但接受别的东西,这听起来是合理的,因为它从套接字读取有问题。

我想学习如何debugging,但我甚至不知道从哪里开始。 至less我确定套接字存在并且拥有合适的所有者,至less从所got connection over ...来判断got connection over ...我们可以排除套接字的存在和权限。

还有一些其他的警告,我不知道他们是否有关系,但我正在考虑处理后

 Jan 28 15:40:09 mymailserver dovecot: lda([email protected]): Debug: sieve: Pigeonhole version 0.4.8 (0c4ae064f307+) initializing Jan 28 15:40:09 mymailserver dovecot: lda([email protected]): Debug: sieve: include: sieve_global is not set; it is currently not possible to include `:global' scripts. Jan 28 15:40:09 mymailserver dovecot: lda([email protected]): Debug: sieve: file storage: Storage path `/var/mail/vmail/dkhalife.com/dany/sieve' not found Jan 28 15:40:09 mymailserver dovecot: lda([email protected]): Debug: sieve: file storage: Using Sieve script path: /var/mail/vmail/mydomain.com/me/.dovecot.sieve Jan 28 15:40:09 mymailserver dovecot: lda([email protected]): Debug: sieve: file storage: Storage path `/var/mail/vmail/mydomain.com/me/.dovecot.sieve' not found Jan 28 15:40:09 mymailserver dovecot: lda([email protected]): Debug: sieve: storage: No default script location configured Jan 28 15:40:09 mymailserver dovecot: lda([email protected]): Debug: sieve: User has no personal script Jan 28 15:40:09 mymailserver dovecot: lda([email protected]): Debug: sieve: file storage: Storage path `/var/mail/vmail/sieve-before' not found Jan 28 15:40:09 mymailserver dovecot: lda([email protected]): Debug: sieve: Location for sieve_before not found: /var/mail/vmail/sieve-before Jan 28 15:40:09 mymailserver dovecot: lda([email protected]): Debug: sieve: file storage: Storage path `/var/mail/vmail/sieve-after' not found Jan 28 15:40:09 mymailserver dovecot: lda([email protected]): Debug: sieve: Location for sieve_after not found: /var/mail/vmail/sieve-after Jan 28 15:40:09 mymailserver dovecot: lda([email protected]): Debug: sieve: No scripts to execute: reverting to default delivery. 

**更新1 **

这是我的main.cf的内容

 alias_maps = hash:/etc/aliases append_dot_mydomain = no biff = no broken_sasl_auth_clients = yes command_directory = /usr/sbin config_directory = /etc/postfix daemon_directory = /usr/lib/postfix data_directory = /var/lib/postfix debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5 default_destination_concurrency_limit = 5 disable_vrfy_command = yes inet_interfaces = all inet_protocols = all local_recipient_maps = unix:passwd.byname $alias_maps mailbox_size_limit = 0 message_size_limit = 104857600 milter_connect_macros = j {daemon_name} v {if_name} _ milter_default_action = accept mydestination = localhost.$mydomain, localhost, $mydomain mydomain = example.com myhostname = mail.example.com mynetworks = 127.0.0.0/8 10.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 myorigin = /etc/mailname non_smtpd_milters = $smtpd_milters readme_directory = no recipient_delimiter = + relay_destination_concurrency_limit = 1 smtp_tls_note_starttls_offer = yes smtp_tls_security_level = may smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache smtpd_banner = $myhostname ESMTP smtpd_helo_required = yes smtpd_helo_restrictions = permit_mynetworks, reject_invalid_helo_hostname, permit smtpd_milters = unix:/clamav/clamav-milter.ctl unix:/opendkim/opendkim.sock smtpd_recipient_restrictions = reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_unauth_pipelining, permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, reject_invalid_hostname, reject_non_fqdn_sender smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination smtpd_sasl_auth_enable = yes smtpd_sasl_authenticated_header = yes smtpd_sasl_local_domain = $myhostname smtpd_sasl_path = private/auth smtpd_sasl_security_options = noanonymous smtpd_sasl_type = dovecot smtpd_sender_login_maps = $virtual_mailbox_maps smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/sender_checks, reject_unknown_sender_domain, reject_sender_login_mismatch smtpd_tls_CAfile = /etc/ssl/certs/ca-certificates.crt smtpd_tls_ask_ccert = yes smtpd_tls_auth_only = yes smtpd_tls_cert_file = /etc/ssl/private/mail_example_com.pem smtpd_tls_ciphers = high smtpd_tls_key_file = /etc/ssl/private/mail_example_com.key smtpd_tls_loglevel = 0 smtpd_tls_mandatory_ciphers = medium smtpd_tls_mandatory_protocols = SSLv3, TLSv1 smtpd_tls_received_header = yes smtpd_tls_security_level = may smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtpd_tls_session_cache_timeout = 3600s smtpd_use_tls = yes tls_random_source = dev:/dev/urandom unknown_address_reject_code = 550 unknown_client_reject_code = 550 unknown_hostname_reject_code = 550 unknown_local_recipient_reject_code = 550 virtual_alias_maps = hash:/etc/postfix/virtual virtual_mailbox_base = /var/mail/vmail virtual_mailbox_domains = hash:/etc/postfix/virtual-mailbox-domains virtual_mailbox_maps = hash:/etc/postfix/virtual-mailbox-users virtual_transport = dovecot 

如果我正确地理解了东西,那么spamassassin(或垃圾邮件,正如你在这里所使用的)不能直接作为一个更好的东西。

除了spamassassin之外,你还需要spamass-milter。

看到这里: http : //www.stefan-seelmann.de/wiki/mailserver-postfix-dovecot或在这里: https : //www.nesono.com/node/220作为参考。

正如已被接受的答案所指出的那样,有一些对手可以使这个工作成为可能。 我已经安装了spamassassin和spamass-milter。

然而,在安装过程中,我误解了如何设置套接字,所以这里是相关的文件/行

首先/ etc / default / spamassassin:

 OPTIONS="-x --max-children 5 --nouser-config --helper-home-dir /var/lib/spamassassin -u debian-spamd -g debian-spamd --siteconfigpath /etc/spamassassin --socketpath=/var/run/spamassassin/spamd.sock --socketowner=debian-spamd --socketgro$ 

第二个/ etc / default / spamass-milter:

 OPTIONS="-u spamass-milter -i 127.0.0.1 -m -I -- --socket=/var/run/spamassassin/spamd.sock" 

最后是/etc/postfix/main.cf

 smtpd_milters = unix:/spamass/spamass.sock 

所以最后,从我的理解,有一些sockets使用。 一个是在milter和spamassassin(spamd.sock)之间进行通信,在Postfix和milter(spamass.sock)之间进行通信。 以前我强迫他们都使用相同的套接字,这解释了为什么有时它会工作(偶然),有时错误会指出一些意想不到的事情…

所以正确设置这些之后,关于spamassassin的错误就消失了,性能也恢复了。 我也没有看到更多的与筛有关的消息,但我不完全确定它们是否相关。 除了上面的configuration之外,我还没有做过任何其他configuration更改。