Source: amavisd-milter Version: 1.5.0-5 Severity: normal Tags: patch Dear Maintainer,
I configured Postfix to submit incoming messages to Amavis. In /etc/postfix/main.cf I added this line : smtpd_milters = unix:amavis/amavis.sock This assumes the unix socket /var/spool/postfix/amavis/amavis.sock exists and is usable to user "postfix", as I specified in /etc/default/amavisd-milter : MILTERSOCKET=/var/spool/postfix/amavis/amavis.sock MILTERSOCKETOWNER="postfix:postfix" MILTERSOCKETMODE="0660" However I got this postfix/smtpd error in /var/log/mail.log : warning: connect to Milter service unix:amavis/amavis.sock: Permission denied The owner of socket amavis/amavis.sock is wrong : srw-rw---- 1 amavis amavis 0 Feb 4 17:51 /var/spool/postfix/amavis/amavis.sock An error occured in the initscript, chown did not work : # service amavisd-milter status (...) systemd[1]: Starting LSB: Starts the amavisd-milter daemon... amavisd-milter[7407]: Starting amavisd-milter Daemon:: amavisd-milter. amavisd-milter[7407]: chown: cannot access ‘/var/spool/postfix/amavis/amavis.sock’: No such file or directory amavisd-milter[7415]: starting amavisd-milter 1.5.0 on socket /var/spool/postfix/amavis/amavis.sock systemd[1]: Started LSB: Starts the amavisd-milter daemon. This error occurs at line 85 of /etc/init.d/amavisd-milter : chown "$MILTERSOCKETOWNER" "$MILTERSOCKET" When this command is executed, the socket does not yet exist on the filesystem. Here is a first patch : --- debian/amavisd-milter.init.orig 2017-02-04 18:16:44.575564619 +0100 +++ debian/amavisd-milter.init 2017-02-04 18:17:04.266431849 +0100 @@ -81,6 +81,7 @@ 0) log_end_msg 0 if [ "$MILTERSOCKETTYPE" = "pipe" ]; then + sleep 1 if [ "$MILTERSOCKETOWNER" ]; then chown "$MILTERSOCKETOWNER" "$MILTERSOCKET" fi However one second might not be enough on a too busy and slow server. A better fix would be to wait for the socket to exist before proceeding and timeout if it is not created after a few seconds.