DNS records for client discovery

Mail, calendar and contact clients find Kantoor from an email address by looking up DNS records for the address's domain. Kantoor publishes them itself when Salt DNS hosts the domain's zone (see Publishing to Salt DNS), and otherwise the operator (or the DNS control plane) does, once per mail domain. Replace example.com with the mail domain and kantoor.example.net with the public host name of Kantoor (PHX_HOST).

Kantoor shows them, per domain

You do not have to write the table below by hand. Admin, Domains, DNS records (one button per domain) lists the exact records for that domain, derived from the running configuration (KANTOOR_AUTOCONFIG_*, the IMAP/POP3/SMTP settings and the public web host), with a copy button per name and value, a zone-file snippet, and a status per record: published, missing, different (what DNS answered is shown) or could not check (the lookup timed out or failed; that is never reported as "missing"). Check again looks every record up again. The lookups run in the background with a timeout and use the server's resolver, so a record you just published may show as missing until the old answer expires (its TTL).

The same set is available read only for tools: GET /api/v1/provisioning/domains/{ref}/dns-records (see "Provisioning API"). The page also shows what Salt DNS holds; see below.

A protocol that is switched off is left out. For IMAP, POP3 and SMTP submission that are not offered, the set adds an optional RFC 6186 "service not available" marker (_imaps._tcp, _pop3s._tcp, _submissions._tcp with 0 0 0 .). Decision: they are optional, shown in the page and written as comments in the zone snippet, and listed apart (unavailable) in the API, so nothing writes them by accident. Publish them only when you want clients to stop looking for that service on this domain. POP3 with STARTTLS (_pop3._tcp) is not generated: Salt DNS's mail preset does not allow that name. The names and types are exactly those Salt DNS's mail-preset TSIG key may update (docs/integrations/mail.md in Salt DNS); a test checks every generated record against that table.

Publishing to Salt DNS

When Salt DNS hosts the domain's zone (the domain itself or an ancestor that Salt holds), the DNS page offers Publish to Salt. Publishing:

  • writes the records of this page in one batch through Salt's zone-import API (POST /zones/:zone/import/apply, mode: merge);
  • records in Kantoor which values it added, and removes only those when publishing is stopped. A value that was already in the zone stays, whoever put it there, and so does a value another writer adds beside ours;
  • never writes over a conflict: a CNAME that points elsewhere, another type at a name where a CNAME is needed, or another application's CalDAV/CardDAV path=. The record shows conflict with what is in the way, and an operator resolves it by hand;
  • keeps the rrset's existing TTL when it adds a value to a set that is already there, so other records are not retimed.

Each record shows one of: in sync (the value is there), missing (no record of that type), different (other values of the type are there, ours is not; safe to add), conflict (not safe to add), or not published (the optional RFC 6186 "service not available" marker, which is never written). Check Salt re-reads the zone without writing.

After Publish to Salt, automatic syncing is on:

  • a domain change that can alter the record set (attaching a domain, enabling a domain again) starts a repair in the background;
  • the nightly maintenance job :dns_sync checks and repairs every published domain, and records the result on the domain (detail page, Client discovery);
  • Sync now does the same immediately, and Stop publishing removes exactly the values Kantoor wrote (everything else at those names stays) and switches automatic syncing off.

Publishing is per domain: another domain's zone is never touched by a publish or a sync, and a domain not in Salt is left to the operator's own DNS.

Credentials

The instance needs a Salt DNS API token of the organisation that owns the mail domains' zones, and the API root (ending in /api/v1):

SALT_DNS_API_URL=https://salt.shilohbv.com/api/v1
SALT_DNS_API_TOKEN=<an API token, not a TSIG secret>

Without them the panel says Salt DNS is not configured and the page remains a manual reference. The token is never shown, logged, or written to the audit log; finding a zone uses GET /zones/:zone (Salt answers 404 for a zone of another organisation as well, so Kantoor cannot tell them apart), and every write needs the token to hold manage on the zone for the import batch and update at the names for the removals.

Records per mail domain

NameTypeValueUsed by
_caldavs._tcp.example.com.SRV0 1 443 kantoor.example.net.CalDAV over TLS (RFC 6764)
_caldavs._tcp.example.com.TXT"path=/dav/"CalDAV context path
_carddavs._tcp.example.com.SRV0 1 443 kantoor.example.net.CardDAV over TLS
_carddavs._tcp.example.com.TXT"path=/dav/"CardDAV context path
_imaps._tcp.example.com.SRV0 1 993 kantoor.example.net.IMAP over TLS (RFC 6186)
_submissions._tcp.example.com.SRV0 1 465 kantoor.example.net.SMTP submission over TLS (only once the submission server is published)
autoconfig.example.com.CNAMEkantoor.example.net.Thunderbird, Evolution, KMail mail autoconfig
autodiscover.example.com.CNAMEkantoor.example.net.Outlook Autodiscover (POX); needs a TLS certificate for this name on the proxy
_autodiscover._tcp.example.com.SRV0 0 443 kantoor.example.net.Outlook's SRV fallback (needs the same /autodiscover/autodiscover.xml path on that host)

Do not publish the plain (non-TLS) variants _caldav and _carddav. _imap and _submission are RFC 6186's STARTTLS names and are generated, instead of _imaps and _submissions, only when the advertised socket is starttls. The ports in the SRV records are the public ports, the same values as KANTOOR_AUTOCONFIG_* (see Client auto-configuration), not the container's listener ports. Publish _imaps and _submissions only when those listeners are reachable from the internet.

Known limit: DNS alone is not enough

The autoconfig.<domain> and autodiscover.<domain> names also need a reverse-proxy route to Kantoor and a TLS certificate for each of those host names, per mail domain. The CNAME only makes the name resolve; a client then connects to it over HTTPS and refuses a certificate that does not match. Kantoor cannot create the route or the certificate. A record that shows published can therefore still not work until the proxy serves that name.

What the clients then ask

  • CalDAV/CardDAV: https://kantoor.example.net/.well-known/caldav and /.well-known/carddav (answer: 301 to /dav/, before credentials), and PROPFIND / and OPTIONS / (answer: 401 with a Basic challenge, then current-user-principal once the client sends credentials).
  • Mail autoconfig: https://autoconfig.example.com/mail/config-v1.1.xml?emailaddress=... and https://example.com/.well-known/autoconfig/mail/config-v1.1.xml. The first needs the CNAME above AND a TLS certificate for autoconfig.example.com on the reverse proxy (route that host name to Kantoor; a certificate for kantoor.example.net alone makes the client refuse the connection). The second only works when the mail domain's own web host forwards that path to Kantoor, so it is optional.
  • Outlook Autodiscover: POST https://autodiscover.example.com/autodiscover/autodiscover.xml (then https://example.com/autodiscover/autodiscover.xml, then the SRV record). Outlook only follows this for a domain that has no Exchange answer, and which versions use IMAP/SMTP from it varies; it has not been tried against a real Outlook. Autodiscover v2 (autodiscover.json) cannot describe IMAP, so Kantoor only answers it with a pointer to the XML document.
  • Apple devices do not look anything up by DNS for mail. Give iPhone and Mac users the profile instead: https://kantoor.example.net/.well-known/apple/mail.mobileconfig?emailaddress=you@example.com, or Settings, App passwords, Download an Apple profile when signed in. iOS and macOS find CalDAV/CardDAV through the _caldavs/_carddavs records or the profile.

Log in with the full address

The user name in every protocol is the full sign-in email address (or the address of a mailbox the user may open), never the part before the @. The password is an app password that includes the scope of the protocol: dav for calendars and contacts, imap for reading mail, smtp for sending.

Checking

dig +short SRV _caldavs._tcp.example.com
dig +short TXT _caldavs._tcp.example.com
dig +short CNAME autoconfig.example.com
dig +short CNAME autodiscover.example.com
dig +short SRV _autodiscover._tcp.example.com
curl -si -X POST -H 'Content-Type: text/xml' --data '<Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006"><Request><EMailAddress>you@example.com</EMailAddress><AcceptableResponseSchema>http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a</AcceptableResponseSchema></Request></Autodiscover>' https://autodiscover.example.com/autodiscover/autodiscover.xml
curl -si https://autoconfig.example.com/mail/config-v1.1.xml | head
curl -si -X PROPFIND https://kantoor.example.net/.well-known/caldav

Mail transport records

Client discovery does not imply an MX or a sending policy. Set KANTOOR_DNS_TRANSPORT_RECORDS_JSON to an object keyed by mail domain, each value a list of name, type (MX or TXT) and content objects. Names are absolute and must lie within that mail domain. For example:

{"example.com":[{"name":"example.com.","type":"MX","content":"10 mx.example.net."}]}

Use Karta's actual public DKIM selector and public record, plus the owner's SPF and DMARC policies; never put a private signing key in this setting. Publish to Salt includes these records in the same merge and ownership inventory as discovery records. Automatic sync repairs them. Stop removes only values Kantoor added. Keep the setting in step with Karta DKIM rotation. Existing TXT values remain: review conflicting SPF/DMARC policies before enabling publication. The Salt token must have access to the mail domain's containing zone.

When mail domains belong to different Salt organisations, set SALT_DNS_ZONE_API_KEYS_JSON to a JSON object mapping the exact containing zone name (without a trailing dot) to its API token. All requests for that zone use that credential; other zones keep SALT_DNS_API_TOKEN. Store this secret setting only in the deployment environment. No token appears in reports.

The recursive DNS status column checks MX preference and exchange as well as TXT, SRV and CNAME records. Its cached answers can lag behind Salt’s authoritative state.