Kantoor. DnsRecords
(Kantoor v1.0.0)
The DNS records an operator publishes for one mail domain so that mail, calendar and contact clients find Kantoor from an email address.
This module is pure: it derives the exact record set from the live
configuration and touches no socket. Kantoor.DnsRecords.Checker resolves
the records, the admin page and the provisioning API show them. Every name and type is one
Salt DNS's mail-preset TSIG key may update (docs/integrations/mail.md there;
a test checks it).
Where the values come from
- mail hosts, ports and sockets:
Kantoor.Autoconfig.servers/1, the single source of the PUBLIC names (config :kantoor, :autoconfig,:imap,:smtp); - the DAV host, port and scheme:
Kantoor.Autoconfig.dav/0(the web endpoint; DAV lives under/dav/).
The set
| Name | Type | Notes |
|---|---|---|
_caldavs._tcp.<d> / _carddavs._tcp.<d> | SRV | DAV host and public port. Required. |
_caldavs._tcp.<d> / _carddavs._tcp.<d> | TXT | "path=/dav/". Required. |
_imaps._tcp.<d> (or _imap for STARTTLS) | SRV | Only while IMAP is advertised. Required. |
_submissions._tcp.<d> (or _submission) | SRV | Only while SMTP submission is advertised. Required. |
_pop3s._tcp.<d> | SRV | Only while POP3 over TLS is advertised. Optional. |
autoconfig.<d> | CNAME | To the Kantoor host. Required. |
autodiscover.<d> | CNAME | Optional (Outlook). |
_autodiscover._tcp.<d> | SRV | Optional (Outlook fallback). |
The _imap and _submission names are RFC 6186's STARTTLS
variants, used only when the advertised socket is :starttls; they never
mean an unencrypted service. POP3 with STARTTLS (_pop3) is not generated: Salt DNS's mail
preset does not grant that name. When DAV is served over plain HTTP (a
development endpoint) there is no TLS name to publish, so no DAV records.
Disabled protocols: "service not available"
RFC 6186 section 3.1 lets a domain say that a service does NOT exist with an
SRV record whose target is . (0 0 0 .). Decision: for IMAP, POP3 and
SMTP submission that Kantoor does not advertise, the set contains such a
marker (service: :unavailable, required: false) for the TLS name. It is
optional because a domain can legitimately be served elsewhere for that
protocol, and it is therefore never applied by a provider and is rendered as
a comment in the zone text. An operator who wants clients to stop probing
uncomments it. Nothing is invented for DAV or Autodiscover: those are always
on.
Summary
Functions
The records of services Kantoor offers (without the RFC 6186 "not available" markers).
Canonical comparison form of a record's content: names lower-cased without the trailing dot, runs of blanks collapsed, TXT as its unquoted strings joined.
Settings under config :kantoor, :dns_records.
The records for domain, in a stable order (required first by group).
Normalises a domain name (case, trailing dot); :error when it is not a host name.
A zone-file fragment (RFC 1035 master file syntax) for records. Markers for
services that are not available are written as comments.
Functions
@spec applicable([Kantoor.DnsRecords.Record.t()]) :: [Kantoor.DnsRecords.Record.t()]
The records of services Kantoor offers (without the RFC 6186 "not available" markers).
Canonical comparison form of a record's content: names lower-cased without the trailing dot, runs of blanks collapsed, TXT as its unquoted strings joined.
@spec config() :: keyword()
Settings under config :kantoor, :dns_records.
@spec for_domain(String.t(), keyword()) :: {:ok, [Kantoor.DnsRecords.Record.t()]} | {:error, :invalid_domain}
The records for domain, in a stable order (required first by group).
Options: :ttl (default 3600), :autoconfig (overrides passed to
Kantoor.Autoconfig.servers/1), :dav (a map like Kantoor.Autoconfig.dav/0).
Normalises a domain name (case, trailing dot); :error when it is not a host name.
@spec zone_text([Kantoor.DnsRecords.Record.t()]) :: String.t()
A zone-file fragment (RFC 1035 master file syntax) for records. Markers for
services that are not available are written as comments.