$forward_method and DNS RR

Mark Martinec Mark.Martinec+amavis at ijs.si
Fri Aug 26 19:24:12 CEST 2011


Xavier,

> I have a couple of mail servers using DNS RR (ipv6).
> 
> When forwarding using dns rr with :
>   $forward_method = 'smtp:rrmail:10025';
> I have some issues like this :
> 
> 451 4.5.0 id=07816-01 - Temporary MTA failure on relaying, From MTA()
> during fwd-connect (All attempts (1) failed connecting to
> smtp:rrmail:10025): id=07816-01
> 
> Does this means that $forward_method doesn't use DNS to find the way to
> forward ?

It should obey the DNS RR  (A or AAAA, not MX).
Amavisd doesn't do resolving by itself, but leaves the task to the
underlying IO::Socket::INET or IO::Socket::INET6, which is supposed
to use host's native resolver to map a name to an IP address.

> Is there a nice way to make a RR with $forward_method (other than
> use a proxy / load balancer) ?

Yes. Since 2.7.0 the $forward_method can take a reference to an
array of destinations (each of the same syntax as before).
Amavisd would pick a random entry from a list, and fall back
to another if connect attempt failed.

Release notes:

- SMTP and LMTP client code now accepts a listref of peer socket
  specifications, or a single scalar specification as before. This allows
  for a failover in case some server is down or refuses connections.
  It also provides a simpleminded load balancing between next-hop
  (re-entry) MTA servers, as the selection from a list is random.
  Session caching still works, so if a recently used SMTP/LMTP session
  is still open, it will be reused, in which case no server randomization
  takes place as long as the established session remains open.

  Typical configuration variables where this feature is available are:
  $forward_method, $notify_method, $resend_method, $release_method, and
  $requeue_method, but only when the specified protocol is smtp: or lmtp:,
  (not pipe:, local:, sql:, bsmtp:).

  Example:
    $forward_method =
      [ 'smtp:[::1]:10025', 'smtp:[127.0.0.1]:10025', 'smtp:*:10025' ];

    $notify_method =
      [ 'smtp:*:*', 'smtp:192.0.2.10:10025' ];

  It is assumed that the protocol specification scheme (e.g. 'smtp:')
  of all entries in a list is the same. Mixing different protocols
  in the same list of alternatives is not allowed;


Mark


More information about the amavis-users mailing list