Configuration

Salt is configured with environment variables, read when the release starts. In production (MIX_ENV=prod, the container image) the application checks the whole environment first and refuses to start if something is missing, malformed or unsafe. It prints every problem at once and never prints a secret value. A start that fails looks like this:

Salt cannot start with this configuration:
  - SALT_DNS_VAULT_KEY is missing (generate one with `openssl rand -base64 32`).
  - PHX_HOST must be the real public host name, not localhost.
  - SALT_DNS_RESOLVERS is missing: comma separated IP addresses of recursive resolvers (without one no zone can be verified).
See docs/configuration.md.

.env.example in deploy/examples/ lists the variables the example stack uses. A test (test/salt_dns/docs_test.exs) keeps this page complete: every variable the code reads must appear here.

Required

VariableMeaning
DATABASE_URLPostgres connection, ecto://USER:PASSWORD@HOST/DATABASE. Postgres is the system of record.
SECRET_KEY_BASESigns and encrypts cookies and sessions. At least 64 characters; openssl rand -base64 64 | tr -d '\n='.
SALT_DNS_VAULT_KEYEncrypts stored secrets (TSIG secrets): base64 of exactly 32 bytes, openssl rand -base64 32. Losing it loses the secrets. See key rotation.
PHX_HOSTThe public host name of the web console and API, for example dns.salt-dns.example. Not localhost or example.com. Links, redirects and OpenID Connect use it. TLS is terminated by your reverse proxy; the application assumes https://PHX_HOST.
SALT_DNS_NAMESERVERSThe public nameservers of this installation, comma separated. A zone delegated to two of them is verified as owned (see ownership in the API reference).
SALT_DNS_RESOLVERSRecursive resolvers used for ownership checks, IP addresses comma separated (port 53). Required: without one no zone can be verified. Use resolvers you trust.
SALT_DNS_TRANSFER_HOSTThe address or name of the primary as your customers' secondaries reach it for zone transfers. Shown in the console and the API with each secondary's configuration. There is no placeholder: without it the application does not start.
SALT_DNS_SOA_RNAMEThe zone administrator's mailbox as a name for new zones' SOA, for example hostmaster.salt-dns.example (the address hostmaster@salt-dns.example). There is no safe default.

Optional

Web and database

VariableDefaultMeaning
PHX_SERVERset by bin/serverStarts the HTTP server. bin/server sets it; with bin/salt_dns start set it yourself.
PORT4000HTTP port of the web console, API, /up and /ready.
POOL_SIZE10Database connection pool size.
ECTO_IPV6offtrue or 1 connects to Postgres over IPv6.
DNS_CLUSTER_QUERYnoneDNS query for clustering several Erlang nodes. Leave unset for a single instance.
SALT_DNS_DATABASE_POOLERofftrue when DATABASE_URL points at PgBouncer in transaction pooling mode: prepared statements become unnamed and Oban uses Oban.Notifiers.PG instead of LISTEN/NOTIFY. Leave it off for a direct connection. See PgBouncer.
SALT_DNS_MIGRATION_DATABASE_URLnoneOptional direct Postgres URL used by bin/migrate only, for a migration that needs a real session. Without it the migrations run over DATABASE_URL, which is safe through PgBouncer.

Names in new zones and the update service

VariableDefaultMeaning
SALT_DNS_NSSALT_DNS_NAMESERVERSNS names of the apex of new zones, comma separated.
SALT_DNS_SOA_MNAMEfirst of SALT_DNS_NAMESERVERSThe SOA primary name server.
SALT_DNS_UPDATE_HOSTPHX_HOSTThe host name shown in client snippets for the RFC 2136 update service.
SALT_DNS_UPDATE_LISTENERtruefalse turns the RFC 2136 listener off.
SALT_DNS_UPDATE_ADDRESS0.0.0.0IP address the listener binds.
SALT_DNS_UPDATE_PORT53UDP and TCP port of the listener. The image runs as an unprivileged user; the example stack lowers net.ipv4.ip_unprivileged_port_start so that it can bind 53.

Secondaries

VariableDefaultMeaning
SALT_DNS_TRANSFER_PORT53Its port.

Knot DNS

VariableDefaultMeaning
KNOT_SOCKET/run/knot/knot.sockThe primary's control socket (a shared volume). /ready checks it.
KEYMGR_BINARYkeymgrThe keymgr executable, used to read DNSSEC key material.
SALT_DNS_KNOT_CONFDB/storage/confdbThe primary's configuration database, mounted for keymgr (read-write in a cluster).
SALT_DNS_RECONCILE_CRON*/10 * * * *How often every zone is compared with Knot and repaired (cron syntax).

Several replicas

Optional; without SALT_DNS_CLUSTER=true there is one node that always drives its Knot, exactly as before (Several replicas).

VariableDefaultMeaning
SALT_DNS_CLUSTERfalsetrue turns the lease on: of several identical replicas, the one holding the database lease drives its Knot as the primary and the others follow it. Replicas need no names; their identity is made at start and is labelled with HOSTNAME (the pod name in Kubernetes) in logs and metrics.
SALT_DNS_CLUSTER_DATABASE_URLDATABASE_URLThe direct postgres:// (or ecto://) URL replicas use to find each other (LISTEN does not work through a transaction-mode pooler). Required when SALT_DNS_DATABASE_POOLER is on; without it the replicas do not find each other (they stay correct through the database) and the log says so.
SALT_DNS_CLUSTER_HEARTBEAT_MS5000How often a replica announces itself to the others.
SALT_DNS_NODE_HOSTthe host's first address (hostname -i)The address the other replicas reach this one on for Erlang distribution; the node is named salt@<address>. Also bound for epmd and the distribution port.
SALT_DNS_DIST_PORT9100The one port Erlang distribution listens on. Never publish it, nor port 4369.
RELEASE_COOKIEnoneThe shared secret of Erlang distribution; required with SALT_DNS_CLUSTER=true, the same on every replica.
SALT_DNS_KNOT_ADDRESSthis host's first non-loopback IPv4 address @5300How the other replicas reach this replica's Knot (an IP address and a port, 10.0.0.7@5300); the holder of the lease advertises it in the lease and the followers point their Knot at it. Anything else is refused.
SALT_DNS_LEASE_TTL15Seconds the lease lasts. A takeover after a crash takes at most this plus one renew interval. The holder stops writing and demotes its Knot at least one renew interval before the lease can expire for anybody else.
SALT_DNS_LEASE_RENEWa third of the TTLSeconds between renewals; must be shorter than half the TTL (the application refuses to start otherwise).
SALT_DNS_KNOT_KEY_DIR/storage/keys/keysWhere the Knot key store keeps its private keys (<id>.pem). Read-write for the application.
SALT_DNS_HEARTBEAT_FILE/storage/.salt-dns-heartbeatThe file the leader touches with every confirmed lease renewal; the Knot container's knot-watchdog.sh demotes its Knot when it goes stale (WATCHDOG_STALE_SECONDS, default 45, set on the Knot container). On the Knot volume.
SALT_DNS_KNOT_BASE_ACLSedge; with SALT_DNS_CLUSTER=true edge,peer-xfrKnot ACLs every organisation template gets besides its secondaries'.
SALT_DNS_KNOT_BASE_NOTIFYknot-edge; with SALT_DNS_CLUSTER=true knot-edge,peerKnot remotes notified of every change.

Ownership

VariableDefaultMeaning
SALT_DNS_REFUSE_PRIVATE_RESOLVERSfalsetrue drops resolver addresses that are not public.
SALT_DNS_VERIFICATION_DAYS7How long a pending zone is checked before verification gives up.
SALT_DNS_OWNERSHIP_GRACE_DAYS30How long an active zone may fail re-verification before it is disabled.

Domain presets (optional)

The "Connect this domain" presets write a service's records into a zone. Each one is offered only when its target is configured here; a target that is set but malformed stops the start. See Presets.

VariableDefaultMeaning
SALT_DNS_PRESET_BALIE_IPV4noneThe IPv4 addresses of the Balie load balancers, comma separated. With _IPV6 it enables the Balie site preset (apex A/AAAA and a www CNAME).
SALT_DNS_PRESET_BALIE_IPV6noneTheir IPv6 addresses, comma separated.
SALT_DNS_PRESET_TIENDA_IPV4noneThe IPv4 addresses a Tienda shop answers on, comma separated. Enables the Tienda shop preset when set (with _IPV6 for AAAA).
SALT_DNS_PRESET_TIENDA_IPV6noneTheir IPv6 addresses, comma separated.
SALT_DNS_PRESET_MAIL_MXnoneThe MX host of the Kantoor mail platform (for example mx.karta.example). With _MAIL_KANTOOR it enables the Kantoor mail preset; one without the other stops the start.
SALT_DNS_PRESET_MAIL_KANTOORnoneThe host mail and calendar apps reach for automatic setup (for example kantoor.example).
SALT_DNS_PRESET_MAIL_SPFnoneThe SPF mechanisms the platform sends from, comma separated (include:spf.example). Merged into an existing SPF record.
SALT_DNS_PRESET_MAIL_DMARC_RUApostmaster@shilohbv.comThe address new DMARC records ask reports to.

Vault key rotation

VariableDefaultMeaning
SALT_DNS_VAULT_KEY_IDv1The label stored with values encrypted by SALT_DNS_VAULT_KEY. Change it when you change the key.
SALT_DNS_VAULT_RETIRED_KEYSnoneOld keys still needed to read stored values, id:base64,id:base64. Ids must be unique and differ from the active id.

Registrar (optional module)

Off unless SALT_DNS_REGISTRAR=on; an installation without it is unchanged and nothing of the module starts. It needs no other setting. What it does is in registrar.md.

VariableDefaultMeaning
SALT_DNS_REGISTRARoffon switches the module on: the registrar functions keep their login tokens and a short price cache in memory. Anything but on or off stops the start.

Certificates (optional module)

Off unless SALT_DNS_CERTIFICATES=on; an installation without it is unchanged and none of the other variables here are read. What the module does, and how to set it up, is in certificates.md.

VariableDefaultMeaning
SALT_DNS_CERTIFICATESoffon switches the module on: the pages and API for certificates, the watcher and the renewal jobs.
SALT_DNS_CERT_STORE_KEYnoneRequired with the module. The key that encrypts every certificate and private key before it is stored, base64 of 32 bytes (openssl rand -base64 32). Not the vault key; the application refuses to start if they are equal. Back it up away from the store: without it the stored keys cannot be read.
SALT_DNS_CERT_STORE_KEY_IDs1The label stored with objects encrypted by SALT_DNS_CERT_STORE_KEY. Change it when you change the key.
SALT_DNS_CERT_STORE_RETIRED_KEYSnoneOld store keys still needed to read stored versions, id:base64,id:base64.
SALT_DNS_CERT_STOREs3s3 (any S3-compatible service; Garage is the target) or local (a directory, for development and a single node).
SALT_DNS_CERT_STORE_ENDPOINTnoneWith s3: the address of the service, for example https://garage.example.org:3900. Path-style addressing is used.
SALT_DNS_CERT_STORE_REGIONgarageWith s3: the region name the signature uses.
SALT_DNS_CERT_STORE_BUCKETnoneWith s3: the bucket. Give it to Salt alone.
SALT_DNS_CERT_STORE_ACCESS_KEY_IDnoneWith s3: the access key id.
SALT_DNS_CERT_STORE_SECRET_ACCESS_KEYnoneWith s3: the secret access key. Never logged.
SALT_DNS_CERT_STORE_PATHnoneWith local: the directory. Every replica must see the same one, so use s3 with replicas.
SALT_DNS_CERT_MAX_ORDERS_PER_DAY5The most new orders one certificate may start in 24 hours, so a bug cannot burn a provider's rate limits.
SALT_DNS_CERT_MAX_NEW_PER_DOMAIN_PER_WEEK30The most new certificates (custom ones included; renewals not) requested per registered domain in 7 days, because providers limit certificates per registered domain. There is no public suffix list: the domain is the least specific zone of the organisation that contains the certificate's zone.
SALT_DNS_CERT_HTTP01_SHARED_PROVIDERSoffon lets a proxy group answer HTTP-01 challenges for a provider that belongs to no organisation (one shared by the installation). Leave it off unless one operator organisation owns every group: a shared provider has one account and so one thumbprint for everybody, and then any organisation whose group serves a host that points at another organisation's load balancer could obtain a certificate for it. By default the provider of a group must be one of the group's own organisation (certificates).
SALT_DNS_CERT_PROPAGATION_TIMEOUT180Seconds to wait until every authoritative server of the zone has the challenge records (and, after Salt changed them, the CAA records), before the provider is told to look.

Metrics

VariableDefaultMeaning
SALT_DNS_METRICS_TOKENnoneTurns on GET /metrics (Prometheus text format) and is the bearer token that protects it, at least 32 characters (openssl rand -hex 32). Without it the endpoint answers 404. Never logged. See edge.md.

Shaker (load-balancer agents)

The agent contract is off unless it is switched on; see shaker.md for enrolment, bootstrap, the keys and the wire conversation.

VariableDefaultMeaning
SALT_DNS_SHAKERoffon switches delivery on: proxy groups, backends, routes and nodes (the Routing pages and /api/v1/proxy), POST /shaker/v1/enrol, GET /shaker/v1/socket, the connection registry, the watcher that raises a group's generation when a certificate renews, and the delivery metrics. Requires SALT_DNS_CERTIFICATES=on: with the certificate module off Salt refuses to start, naming both variables. Anything other than on leaves the routes answering 404 and starts no Shaker process.
SALT_DNS_SHAKER_URLthe endpoint URLSalt's public base URL as Shaker nodes reach it, without a trailing slash (https://salt.example). Written into a bootstrap file; without it the endpoint URL is used.

The two switches together: SALT_DNS_CERTIFICATES=on alone gives certificates that nothing delivers; SALT_DNS_SHAKER=on adds routing and delivery on top. Alert rules for both are in deploy/examples/prometheus/alerts.yml. The guide from nothing to a serving load balancer is shaker.md.

Address records and health checks (publishing the nodes' addresses, the probe, the thresholds) are per-group settings in the console and the API (manage_addresses, address_ttl, probe_interval, fail_threshold, recover_threshold, status_max_age), not environment variables; they are off until switched on per group. See shaker.md. A node's connecting address is read with the same trusted-proxy handling as every other client address (SALT_DNS_TRUSTED_PROXIES below).

Behind a reverse proxy

VariableDefaultMeaning
SALT_DNS_TRUSTED_PROXIESnoneAddresses or CIDR ranges of the reverse proxies whose forwarding header is believed, comma separated (172.31.53.1/32, fd00::/8). Without it the address of the TCP peer is the client, and behind a proxy every client shares the proxy's rate limit.
SALT_DNS_CLIENT_IP_HEADERx-forwarded-forThe header the proxy sets with the client address. Only used when the request comes from a trusted proxy; the header is read from the right, skipping trusted hops.

Sign-in

VariableDefaultMeaning
SALT_DNS_PASSWORD_LOGINtruefalse turns off email and password login, magic links and registration. Needs SALT_DNS_OIDC_ISSUER, otherwise nobody could sign in and the application refuses to start.
SALT_DNS_REGISTRATIONfalsetrue lets anyone create an account on /users/register. Leave it off on a public installation: every account may create an organisation, zones, credentials and secondaries, and uses your resolvers and outbound connections. Create the first user with SaltDns.Release.create_user_from_env, and let others in through single sign-on or by adding them to an organisation.
SALT_DNS_OIDC_ISSUERnoneIssuer URL (https) of an OpenID Connect provider. Setting it turns single sign-on on. The redirect URI to register is https://PHX_HOST/auth/oidc/callback.
SALT_DNS_OIDC_CLIENT_IDnoneRequired with the issuer.
SALT_DNS_OIDC_CLIENT_SECRETnoneRequired with the issuer. Never logged.
SALT_DNS_OIDC_NAMEsingle sign-onThe name on the sign-in button.
SALT_DNS_OIDC_AUTO_CREATEtrueWho gets an account at a first sign-in through the provider. true: anyone the provider lets through, if it says their address is verified. false: only existing users sign in. invited: a new account is made only for an address that an owner or admin invited (see Members and invitations). Any other value stops the boot. Use invited on a public installation: with true, every person your provider lets in gets an account and may create an organisation.
SALT_DNS_OIDC_CACERTFILEsystem storeCA bundle for a provider with a private CA.
SALT_DNS_OIDC_SESSION_HOURS12How long a session that began with single sign-on lasts, in whole hours from 1 to 336. After that the person signs in again through the provider, which refuses them if they are disabled there. Password sessions last 14 days.

Mail delivery

Without a relay, nothing is sent: sign-in links, address-change mail and the registrar's expiry reminders are hidden or closed (SaltDns.Accounts.mail_delivery?/0). Set the relay to turn them on. Karta's SMTP submission is one such relay.

VariableDefaultMeaning
SALT_DNS_MAIL_URLnoneSMTP relay: smtp://user:password@host:587 starts TLS when the server offers it; smtps://user:password@host:465 uses implicit TLS. The credentials are URL-encoded. Setting it turns mail delivery on. Never logged.
SALT_DNS_MAIL_FROMnoreply@salt-dns.invalidThe envelope and From address of every message Salt sends. Use a name your relay accepts for the account (Karta checks that the sender belongs to the account).

Members and invitations

With SALT_DNS_OIDC_AUTO_CREATE=invited, a person who has no account can only get one if an owner or admin of an organisation invited their e-mail address first. On the members page, enter the address and a role in the same form that adds an existing user. If the address already has an account, the person is added as before. If not, Salt records an invitation. It lasts 14 days, and the members page lists it with a Revoke button.

Salt sends no e-mail for an invitation (this release has no mailer for member notices). The inviter tells the person to sign in at the Salt address with that e-mail address. At the first sign-in Salt makes the account, adds the person to every organisation that invited that address, and marks the invitations accepted, all in one step. This needs the provider to say the address is verified.

Rules that stay as they are:

  • An account is recognised by the provider's sub only. An invitation never gives a provider account to a person who already has an account with the same address. That sign-in is refused, as before.

  • A person with no invitation sees a short page saying there is no account for them and that they should ask an owner for an invitation. The page is the same for an address that was never invited, one whose invitation ran out, and one that was revoked, so it tells nobody whether an address was invited.

  • With invited, only a person who is an owner of an organisation may create a new organisation. Someone invited as admin, editor or viewer, or someone with no membership, may not. Without this rule, anyone you invite could start their own organisation. Everyone who already has an account keeps it, and owners keep this right.

  • Only an owner can give the owner role: to invite someone as owner, to add an existing user as owner, to change a role to owner, or to revoke an invitation that carries the owner role. An admin cannot, so an admin cannot make themselves an owner and so gain the right to create organisations.

  • Invitation addresses are ASCII only, stored in lower case, and compared that way. A look-alike address (a Kelvin sign for k, a full-width letter) never matches. An internationalised domain is written in punycode (xn--...) and matches only the identical punycode. At sign-in the address and the claim that it is verified are both read from the signed ID token, never from the provider's userinfo; a token that lacks either is treated as unverified.

  • A provisioning token (made by an owner or admin) creates child organisations for customers through the API. This is how a provider creates customers, and it is outside the rule above. Give the owner or admin role only to people who may do that.

On a fresh installation nobody is an owner yet. The operator makes the first organisation and invites its first owner from the command line (see Operations).

Back-channel logout

When a person signs out at the identity provider, or is disabled there, the provider can tell Salt at once. Give the provider this URL:

https://<your Salt>/auth/oidc/backchannel-logout

Salt then ends sessions and disconnects the open pages of exactly those sessions (see Ending a person's sessions). The person is found by the sub claim. What ends depends on the sid claim (the provider's session id):

  • With a sid, only the sessions that began with that provider session end. Salt keeps the sid of the ID token with each single sign-on session. Also ending are that person's single sign-on sessions made before Salt kept the sid (they cannot be told apart, and nothing may survive that should not). Password sessions and the person's single sign-on sessions with another sid stay. This matters because the provider's notice can arrive late (about 40 seconds on one test): a person who signs out and in again keeps the new session. A notice with a sid that Salt does not know is answered 200 and ends only the sessions that have no sid.
  • Without a sid, all of the person's sessions end, password sessions too.

The URL needs no other setting. It answers 404 when single sign-on is not configured. In Authentik, set the provider's back-channel logout URL to https://<your Salt>/auth/oidc/backchannel-logout.

Salt checks the logout token like an ID token: the signature against the provider's keys with the algorithms the provider lists (never none), the issuer, that the audience has Salt's client id, that iat is not in the future and not older than an hour, so a retry after an outage still counts, that exp has not passed, that the events claim has the back-channel logout member, that there is no nonce, and that sub and jti are present. A token with only a sid and no sub is refused with 400, because Salt does not keep the provider's session ids. A token for a sub Salt does not know is answered 200 and changes nothing, so the provider learns nothing about who has an account. A refused token is 400 with a small JSON error. If Salt has not loaded the provider's keys yet, or cannot check tokens for another reason on its side, the answer is 503 so the provider tries again. When a token names a key Salt does not have (the provider rotated its keys), Salt loads the keys again, at most once a minute, and checks once more. If that reload was already used in the last minute, the answer is 503, so the provider tries again later, and the person is signed out then. A 503 does not count against the limit below.

Only refused tokens count against the rate limit: a client address may send 120 refused tokens a minute, then gets 429. A token that verifies is never limited. The limit is per client address. Behind a reverse proxy Salt sees the proxy's address unless SALT_DNS_TRUSTED_PROXIES names the proxy (its forwarding header is then believed); without it all callers share one counter, so set it when Salt runs behind a proxy.

Salt does not remember jti values. A logout token sent twice only signs the same person out twice. This was written against the specification and tests with a fake provider; it has not yet been seen working against a real one.

Logs

VariableDefaultMeaning
SALT_DNS_LOG_FORMATtextjson writes one JSON object per line (time, level, message, request_id, ...) to standard output.

In both formats secrets are removed from log lines as a second line of defence: API tokens keep only their id, Bearer credentials, the vault keys, the session secret and the OIDC client secret are replaced by [REDACTED]. Request parameters named password, secret, token, api_key, authorization or tsig are filtered by Phoenix.

Knot containers (example stack only)

These are read by the example compose file and the Knot configuration templates in deploy/examples/knot/, not by the application. They tune response rate limiting on the edges; read edge.md before changing them.

VariableDefaultMeaning
KNOT_RRL_RATE_LIMIT200Responses per second to one address before limiting starts. 0 turns RRL off.
KNOT_RRL_INSTANT_LIMIT500Responses to one address in a burst.
KNOT_RRL_SLIP2Every Nth limited response is sent truncated (so a real resolver retries over TCP); the rest are dropped. 0 drops all, 1 truncates all.

Bootstrap (one command only)

VariableMeaning
SALT_DNS_FIRST_USER_EMAILRead by SaltDns.Release.create_user_from_env only, to create a confirmed user with a password. Set it on that one command, not in .env.
SALT_DNS_FIRST_USER_PASSWORDThe password for that user (at least 12 characters).

Removed variables

These were read by earlier versions and are now ignored. A deployment that still sets them starts as usual and logs one warning per variable.

VariableWhat to do
SALT_DNS_NODE_IDRemove it. Replicas are not named. It no longer turns the lease on: set SALT_DNS_CLUSTER=true for several replicas.
SALT_DNS_CLUSTER_NODESRemove it. Replicas find each other through Postgres.
SALT_DNS_TRANSFER_HOST_2Remove it. Secondaries are given one transfer address, SALT_DNS_TRANSFER_HOST; with several replicas make it the address that reaches any of them (the salt-dns-xfr Service in deploy/examples/replicas).

Combinations the application refuses

  • Any required variable missing, or SECRET_KEY_BASE shorter than 64 characters.
  • A vault key that is not 32 bytes of base64, a retired key with the same id as the active one, or two retired keys with the same id.
  • PHX_HOST left at localhost or example.com.
  • SALT_DNS_RESOLVERS containing something other than IP addresses.
  • An OIDC issuer without https, or without a client id and secret.
  • SALT_DNS_PASSWORD_LOGIN=false without an OIDC issuer.
  • A number, address, CIDR, cron expression or header name that does not parse.
  • SALT_DNS_CERTIFICATES=on without SALT_DNS_CERT_STORE_KEY (or with the vault key as store key), or without the settings of the chosen store.

Not available yet

  • E-mail delivery without a relay. With SALT_DNS_MAIL_URL unset, mail (account confirmation, magic links, address changes, the registrar's expiry reminders) is dropped. Sign in through OpenID Connect, or create users with SaltDns.Release.create_user_from_env (getting started).

Not environment variables

Development and test settings (SALT_DNS_STACK, MIX_TEST_PARTITION, DATABASE_HOST, DATABASE_PORT) only matter for dev/compose and mix test; see CONTRIBUTING.md.