I currently using a complex mailserver setup using Postfix, Dovecot, Amavis and Spamassassin.
Everything works fine but I want to improve the Postfix-Amavis-Communication. At the moment, postfix will send all mails to localhost:10024
which is the amavis service. After all checks a modified version is sent back to localhost:10025
which is a postfix service for recieving amavis mails.
My idea: UNIX SOCKETS (Because of security reasons; not important why)
So I configured amavis to spawn an unix socket in /run/amavis/amavis.socket
.
And I changed this:
amavis-forward:[127.0.0.1]:10024` to `amavis-forward:unix:/run/amavis/amavis.sock
But then I get this error:
Jan 5 13:55:23 server postfix/smtp[1447]: fatal: unknown service: /run/amavis/amavis.sock/tcp
Jan 5 13:55:24 server postfix/qmgr[1254]: warning: private/amavis-forward socket: malformed response
Jan 5 13:55:24 server postfix/qmgr[1254]: warning: transport amavis-forward failure -- see a previous warning/fatal/panic logfile record for the problem description
So the mail status is set to status=deferred (unknown mail transport error)
.
master.cf:
...
# Amavis
amavis-forward unix - - - - 2 smtp
-o smtp_tls_security_level=none
-o smtp_data_done_timeout=1200
-o smtp_send_xforward_command=yes
-o disable_dns_lookups=yes
-o max_use=20
...
Over :10024 anything works fine. How can I solve it?
Best Answer
Disclaimer: this is half answer because I can use socket when postfix -> amavis but I can't use it when amavis -> postfix. See the explanation in end of this answer.
To use socket, you should use LMTP instead of SMTP to deliver email from postfix to amavis.
As NickW said above, you need to put the amavis socket inside the Postfix queue directory. In this answer I assume that postfix queue directory is
/var/spool/postfix/
.Create directory to hold amavis socket
Add postfix user in amavis group
Configuration in
amavisd.conf
Postfix main.cf
Postfix master.cf
The result
For amavis -> postfix transport, it controlled by parameter
forward_method
. I don't familiar with this configuration except with smtp. In the example in this page, apparently protocol supported by this parameter is pipe, smtp, and bsmtp. Also, based on postfix architecture, postfix only accept email either from smtpd, qmqmd, or sendmail.