How to scan mails with amavis from other mailserver

amavisemail-servernetworkingpostfixsmtpd

I have two postfix mail servers

  • mailserver1 is running amavis to scan spam and virus mails
  • mailserver2 is running without amavis.

My question is how is the smartest way to use mailserver1 respectively amavis from mailserver1 to scan the mails form mailserver2.
I already configurated postfix on mailserver1 to forward the mails to amavis and this works fine, but if it is possible I want to forward the mails from mailserver2 directly to amavis. Does someone know how I can specify amavis to listen to external ports too. My configuration of amavis already looks like this:

#where can i specify the ip address and the networks for which amavis is listening??
$inet_socket_port = [10024,10028];   # default listening socket

#incoming mail from server1
$interface_policy{'10024'} = 'S1';

#incoming mail from server2 forewarded by server1
$interface_policy{'10028'} = 'S2';

$policy_bank{'S1'} = {
#send back to postfix on local server1
   notify_method => 'smtp:[127.0.0.1]:10026',
   forward_method => 'smtp:[127.0.0.1]:10026',
};

$policy_bank{'S2'} = {
#send to postfix on other server2
  notify_method => 'smtp:[192.168.1.2]:10029',
  forward_method => 'smtp:[192.168.1.2]:10029',
};

So what do I have to add to this configuration that I can receive direct mails with amavis from mailserver2 and send them back to it.

Best Answer

Amavisd uses parameter $inet_socket_bind to specify which binding IP address. The possible value is undef or an IP Address. So, it isn't possible to specify some IP address but not all. The default value is 127.0.0.1, that means amavis only listen on localhost.

If you expose amavisd by bind it to public IP address, don't forget to set ACL so you don't allow free access to the amavisd SMTP port. To do this, use parameter @inet_acl. For example:

@inet_acl = qw(127.0.0.1 [::1] 192.168.1.2); # this will allow connection only from 127.0.0.1 or [::1] or 192.168.1.2)
Related Topic