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[]
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 -m -I -- --socket=/var/spool/postfix/spamassassin/spamd.sock"

/etc/default/spamassassin contains

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"

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:

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

  • /etc/postfix/main.cf


  • /etc/conf.d/spamass-milter

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

  • /etc/conf.d/spamd


P.S. Thanks goes to Debugging spamassassin with postfix

  • I am having the somewhat similar problem. This is what I get warning: connect to Milter service unix:/spamass/spamass.sock: No such file or directory – Gacci Mar 10 '19 at 11:04

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

  • Welcome to ServerFault. meta.stackexchange.com/questions/8231/… Can you expand this so your answer can stand on its own? – chicks Apr 26 '17 at 18:57
  • 1
    Keep the link, but summarize the part of the page that applies to the question. In 5 years this q&a may still exist, but the link may be dead. Use this to guide you in how much to include in your answer. – Xalorous May 11 '17 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.