大网数据广告活动
服务器运维问答

How to get spamassassin working with postfix as a milter

· 52CE 我爱测

I'm trying to get spamassassin working on Ubuntu 16.04 with postfix. When receiving mail, I get messages similar to the following in my logs: Jun 11 14:29:47 myhost postfix/smtpd[2387]: connect from mail-oi0-f54.google.com[209.85…

问题原文

原帖链接 · Anonymouslemming · CC BY-SA 3.0

I'm trying to get spamassassin working on Ubuntu 16.04 with postfix.

When receiving mail, I get messages similar to the following in my logs:

Jun 11 14:29:47 myhost postfix/smtpd[2387]: connect from mail-oi0-f54.google.com[209.85.218.54]
Jun 11 14:29:47 myhost spamd[2349]: spamd: got connection over /var/spool/postfix/spamassassin/spamd.sock
Jun  11 14:30:17 myhost postfix/smtpd[2387]: warning: milter unix:/spamassassin/spamd.sock: unreasonable packet length: 1397768525 > 1073741823
Jun 11 14:30:17 myhost postfix/smtpd[2387]: warning: milter unix:/spamassassin/spamd.sock: read error in initial handshake
Jun 11 14:30:17 myhost spamd[2349]: spamd: timeout: (30 second socket timeout reading input from client)

I'm seeing that as two issues:

  1. Unreasonable packet length issue
  2. Timeout reading form socket when reading input

I have the following relevant packages installed:

  • postfix 3.1.0-3
  • spamassassin 3.4.1-3
  • spamass-milter 0.3.2-1

My /etc/default/spamass-milter just contains

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

/etc/default/spamassassin contains

SAHOME="/var/lib/spamassassin"
SAGLOBALCFGPATH="/etc/spamassassin"
ENABLED=1
OPTIONS="-x --max-children 5 --helper-home-dir /var/lib/spamassassin -u  debian-spamd -g debian-spamd --siteconfigpath /etc/spamassassin --socketpath=/var/spool/postfix/spamassassin/spamd.sock --socketowner=debian-spamd --socketgroup=debian-spamd --socketmode=0660"
PIDFILE="/var/run/spamd.pid"
CRON=1

In /etc/postfix/main.cf, I have the following milter related lines:

milter_default_action = accept
milter_connect_macros = j {daemon_name} v {if_name} _
non_smtpd_milters = $smtpd_milters
smtpd_milters = unix:/spamassassin/spamd.sock unix:/opendkim/opendkim.sock

Permissions on the sockets are good and they're where they need to be for postfix in chroot, and the postfix user is in the debian-spamd group.

$ ls -l /var/spool/postfix/spamassassin/spamd.sock
srw-rw----  1 debian-spamd debian-spamd    0 Jun 11 14:21 spamd.sock

Any help would be much appreciated:

社区高分解答

原帖链接 · Aleksejs Spiridonovs · CC BY-SA 4.0

TLDR: Your postfix is connecting to socket of spamd, but should connect to socket of spamass-milter, which stands in between. Look for definition of second socket in your spamass-milter configuration/startup (/etc/init.d/spamass-milter) scripts.

Explanation (based on my Gentoo config, /etc/conf.d/ is similar to /etc/default/): Chain looks like this:

POSTFIX >spamass-milter.sock> MILTER >spamd.sock> SPAMD

  • /etc/postfix/main.cf

    unix:/var/run/milter/spamass-milter.sock

  • /etc/conf.d/spamass-milter

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

  • /etc/conf.d/spamd

    --socketpath=/var/spool/postfix/spamassassin/spamd.sock

P.S. Thanks goes to Debugging spamassassin with postfix

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-06-11)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。