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:
- Unreasonable packet length issue
- 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:
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:
/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
I have read this article and found that it is for Debian, but may also be applied for Ubuntu. http://www.stefan-seelmann.de/wiki/mailserver-postfix-dovecot