Postfix Clamsmtp smtp_bind_address
Apologies for the many posts, I am sincerely trying to share settings that worked for me and may help others.
Looking through another installation, it seems the clam /var/run directories are not symlinks to /run and I must have previously updated my configuration to use /run/ directories. As long as the paths match accordingly with correct ownership and permissions, they will work. However, I have updated the comment below to use only the default settings. Moderators, kindly remove the previous Postfix Clamsmtp smtp_bind_address posts and use the comment below, again I apologize.
In order to send emails through Postfix outside of localhost, my configuration required setting the Postfix smtp_bind_address to the server's private IP. The setting was required for both Ubuntu 17.04 and Centos7 servers.
Clamsmtp Postfix settings likewise had to be set to the smtp_bind_address, as 127.0.0.1 created 'transport unavailable' errors.
The comments by Jeff Roberson were applicable as well.
Ubuntu settings as follows:
clamsmtp.conf was set with clamav as the user; and owner permissions were changed from clamsmtp to clamav for the following directories/files:
ClamAddress: /var/run/clamav/clamd.ctl
TempDirectory: /var/spool/clamsmtp
PidFile: /var/run/clamsmtp/clamsmtpd.pid
(I read elsewhere that ownership permissions could also be resolved by adding user clamsmtp to the clamav group.)
Local Socket files had to match:
clamsmtp.conf - ClamAddress: /var/run/clamav/clamd.ctl
clamd.conf - LocalSocket /var/run/clamav/clamd.ctl
/etc/clamsmtp.conf
OutAddress: 10026
Listen: 0.0.0.0:10025
ClamAddress: /var/run/clamav/clamd.ctl
TempDirectory: /var/spool/clamsmtp
PidFile: /var/run/clamsmtp/clamsmtpd.pid
User: clamav
/etc/clamav/clamd.conf:
LocalSocket /var/run/clamav/clamd.ctl
FixStaleSocket true
LocalSocketGroup clamav
User clamav
Postfix
main.cf:
(Network Setting with server's private IP)
smtp_bind_address=xxx.xxx.x.xx
(clamsmtp Settings with server's private IP)
content_filter = scan:xxx.xxx.x.xx:10025
receive_override_options = no_address_mappings
master.cf:
(clamsmtp Settings with server's private IP)
scan unix - - n - 16 smtp
-o smtp_send_xforward_command=yes
# For injecting mail back into postfix from the filter
xxx.xxx.x.xx:10026 inet n - n - 16 smtpd
-o content_filter=
-o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
-o smtpd_helo_restrictions=
-o smtpd_client_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o mynetworks_style=host
-o smtpd_authorized_xforward_hosts=127.0.0.0/8
Start or Restart postfix, clamav-daemon (clamd), clamsmtp as root:
systemctl restart postfix clamav-daemon clamsmtp
Check status, all should be Active:
systemctl status postfix clamav-daemon clamsmtp