Domain Name System configuration

vSMTP can handle complex DNS situations. A default configuration can be provided on the root configuration of vSMTP and specific dns configurations can be setup on specific domains.

Root DNS parameters are stored in the config.server.dns map.

Please refer to vSMTP configuration reference and Trust-DNS repository for detailed information.

Resolver

The default behavior of the root resolver is defined by the operating system /etc/resolv.conf file. Alternative configurations such as Google or CloudFlare Public DNS may be applied using the type field in the server.dns table.

fn on_config(config) {
  config.server.dns.type = "system" | "google" | "cloudflare";

  config
}

Selecting a DNS type

Please see Google and CloudFlare privacy statement for important information about what they track.

Options

DNS Options can be set using the config.server.dns.options object.

ParametervalueDescriptionDefault value
timeoutintegerSpecify the timeout for a request.5 seconds.
attemptsintegerusize Number of retries after lookup failure before giving up.2 attempts.
rotatetrue/falseRotate through the resource records in the response.No rotation.
validatetrue/falseUse DNSSec to validate the request.False.
ip_strategyenum1The ip_strategy for the Resolver to use when lookup Ipv4 or Ipv6 addresses.IPv4 then IPv6.
cache_sizeintegerCache size is in number of records.32 records.
num_concurrent_reqsintegerNumber of concurrent requests per query.2 concurrent requests.
preserve_intermediatestrue/falsePreserve all intermediate records in the lookup response, such as CNAME records.True.

DNS parameters

1

Ipv4Only, Ipv6Only, Ipv4AndIpv6, Ipv6thenIpv4, Ipv4thenIpv6

fn on_config(config) {
  config.server.dns.type = "cloudflare";
  config.server.dns.options = #{
    timeout: "5s",
    cache_size: 500,
    ip_strategy: "Ipv6thenIpv4",
    validate: true,
  };

  config
}

A Resolver configuration example

Domain specific resolver

It is possible to configure a DNS per domain. Under the desired domain folder in config.vsl, add a on_domain_config callback and configure the dns here.

fn on_domain_config(config) {
  config.dns.type = "cloudflare";
  config.dns.options = #{
    timeout: "5s",
    cache_size: 500,
    ip_strategy: "Ipv6thenIpv4",
    validate: true,
  };

  config
}

A configuration for a specific domain, i.e. `/etc/vsmtp/domain-enabled/example.com/config.vsl`