dns-gate

Delegate DNS changes without handing out provider keys

A DNS provider key or role usually opens a whole account or zone. dns-gate holds those credentials alone and lets teams, pipelines, third parties and ACME clients change exactly the records they own, with their own identity, through one API in front of every provider.

OIDC and SAMLREST APIWeb UIMCP serverTerraform providerACME DNS-01Container or LambdaMIT

example.com 6 record sets · zone version 42
NameTypeOwnerCustody
@Ateam webHeld
wwwCNAMEteam webHeld
_acme-challengeTXTteam certsPending
apiCNAMEteam webTainted
legacyAnoneForeign
@MXnoneProtected
team web may change @ and www; nobody may touch the apex MX

The problem

DNS access is all or nothing

Provider credentials are coarse: the key or role a pipeline needs for one record usually reaches every record of the zone, often every zone of the account, sometimes the domains themselves. So teams, pipelines, third parties and ACME clients either get far too much power, or wait for a central team to make the change.

Provider credential API key or IAM role The one record needed Every record of the zone Every zone of the account Registrar: contacts, NS DNSSEC, zone settings

Too much power, or a queue

Handing out the provider key is a domain hijack waiting to happen; keeping it means every change goes through one team.

The gate holds the credentials; each caller gets exactly its zones, host patterns and record types.

Nobody knows who owns a record

A record has no field for an owner: any pipeline can overwrite another team’s.

Each record set is owned by the team that created or adopted it, and only that team changes it.

Changes overwrite each other

Consoles, scripts and pipelines edit the same zone with no lock and no precondition.

Per-zone lock, plan then apply against content hashes, drift detected and blocked.

No audit with diffs

Provider logs, when they exist, say an API key changed something.

Every request, allowed or denied, is logged with the identity, the team and the diff.

How it works

One gate in front of your DNS providers

Callers bring their own identity and use one API, the same for every provider. Every request, read or write, walks the same checks before anything reaches a provider.

OpenTofu / Terraform

dnsgate provider

CI and workloads

GitHub, GitLab, Azure DevOps, Kubernetes, Entra ID, AWS

People

web UI, OIDC or SAML sign-in

AI assistants

MCP server at /mcp

ACME clients, third parties

certbot, acme.sh, lego, cert-manager

dns-gate

sole holder of the provider credentials

  1. Authenticateissuer, signature, expiry, audience
  2. Routeunknown operation: denied
  3. Zonemust be managed by the gate
  4. Authorizezone, host pattern, record type
  5. Ownershiponly record sets of the caller’s team
  6. Safe writezone lock, If-Match on the record set, dry run, change limit
  7. Auditwho, what, diff, snapshot, allowed or denied

DNS providers

Route 53 · EuroDNS · more on the roadmap

Store

ownership, zone locks, plans, audit, policy revisions · DynamoDB, PostgreSQL, or SQLite for one replica

Providers today: Route 53 and EuroDNS, several accounts each, zones discovered from the accounts. On the roadmap: Cloudflare, OVHcloud, Azure DNS, Google Cloud DNS, Gandi, Infomaniak, Scaleway, IONOS, PowerDNS, RFC 2136 and a libdns adapter for the long tail.

Three layers

A change goes through only when all three agree

1Provider account scope

2RBAC: zone, host, record type

3Ownership

www.example.com · CNAME

owned by team web, unchanged since its last gate write

1

Provider account scope

The gate’s own credentials are limited at the provider, an IAM role scoped to the hosted zones or a restricted EuroDNS user: a last line if the gate itself is compromised.

2

RBAC

Who may read or write which zone, host pattern and record type. Protected records, such as the apex NS, SOA, MX and CAA, win over any role.

3

Ownership

Only record sets created or adopted through the gate, owned by one of the caller’s teams, and unchanged since the gate last wrote them.

Ownership

The gate only changes what it created

A DNS record has no free field to carry an owner, so custody lives in the gate’s store, per record set (zone, host, type) and per team, with a hash of its content. Every record set carries one of these seals, in the UI and in the API.

Held

Created or adopted through the gate. Its team may change it.

Pending

A write is in flight. The next reconcile settles it if the gate stopped midway.

Tainted

Changed or deleted outside the gate. Blocked until it is adopted again.

Foreign

Existed before the gate. Read-only through it until an operator adopts it.

Protected

Matches a protected rule. Refused for everyone, admins included.

SituationResultReason
New record set, allowed by the caller’s roleCreated, owned by the caller’s team—
Record set that exists upstream with no ownerRefused until adopted409 foreign_rrset
Record set owned by another teamRefused403 not_owner
Owned, but changed outside the gate since its last writeRefused, marked tainted409 tainted
Protected record setRefused, whoever asks403 forbidden
More changes in one request than the limitRefused403 too_many_changes
If-Match older than the zone versionRefused, read again412 precondition

Safe writes

Every write is checked against the zone as it is now

Adding, changing or deleting a record set is computed against the current zone, under a lock and with the expected content of each record set, so a client holding a stale copy cannot overwrite or wipe records it never saw. The gate then writes through the provider’s own API: record set changes where it has them (Route 53), one checked save of the whole zone where it has not (EuroDNS).

Client dns-gate Store Provider 1 · change, with token and If-Match 2 · lock zone, compare version 3 · read the current zone 4 · diff against the current zone RBAC · ownership · protected · limit 5 · pending ownership claim 6 · dry run, where the provider has one 8 · claim active, unlock, audit 9 · result, new ETag 7 · apply the change, then read it back
1writer at a time per zone, across replicas
planthen apply, bound to the zone version
diffof every write in the audit log

Policy

Deny by default, then name who may change what

An issuer says which tokens to trust, a role says what may change, a binding gives a role to a group or a subject and names the team that will own what it writes.

issuers:
  - name: ci
    issuer: https://token.actions.githubusercontent.com
    audiences: [dns-gate]
roles:
  site-records:
    rules:
      - zones: [example.com]
        actions: [dns.read, dns.record.write]
        records: {hosts: ["@", www], types: [A, AAAA, CNAME]}
bindings:
  - role: site-records
    team: web        # owns every record it creates
    subjects:
      - issuer: ci
        claims: {sub: ["repo:example/website:ref:refs/heads/main"]}
protected:
  - zones: ["*"]
    hosts: ["@"]
    types: [NS, SOA, MX, CAA]

Base git · config.yaml

Issuers, zones, roles, bindings, protected records. Reviewed by pull request, and the only place that decides who may edit or approve the policy.

Managed web UI · store

Revisions on top of the base, with diff, impact analysis, approval by another approver, atomic activation and rollback. A fresh sign-in is required to change it, and a redeploy never erases it.

Delegated a pipeline stack

A stack that creates pipelines writes each one’s role and binding in the same apply, through the Terraform provider, within bounds set in the base file.

Discovery the whole account

Every zone of the provider accounts is listed read-only and can be brought under management from the UI, without a redeploy.

Callers

Every caller brings its own short-lived identity

Pipelines and people never hold a provider secret. The same roles and the same ownership apply to all of them.

OpenTofu and Terraform

The KamorionLabs/dnsgate provider talks to the gate REST API, for every DNS provider behind it, alias records included. Writes carry the expected content of each record set, and a zone can be exported as HCL with import blocks whose first plan is empty.

resource "dnsgate_record_set" "www" {
  zone   = "example.com"
  name   = "www"
  type   = "CNAME"
  ttl    = 3600
  values = ["site.example.net."]
}

resource "dnsgate_record_set" "apex" {
  zone = "example.com"
  name = "@"
  type = "A"

  alias {
    name    = "d111111abcdef8.cloudfront.net."
    zone_id = "Z2FDTNDATAQYW2"
  }
}

CI pipelines

Short-lived OIDC tokens with the gate as audience, bound to exact subjects.

GitHub Actions · GitLab CI · Azure DevOps · AWS outbound identity federation · Kubernetes service accounts · Entra ID

People

A web console: every record set with its seal and owner, a journal of every request with the diff of each write, who can change what, zone by zone, and the policy editor.

OIDC or SAML sign-in · Entra ID · IAM Identity Center · any IdP

AI assistants

An MCP server at /mcp with the same authentication and rules. Read tools by default; a write is a plan, then an apply bound to that plan.

Claude Code · Claude Desktop extension · any MCP client

Certificates and third parties

ACME clients write their _acme-challenge records through the gate’s httpreq and acme-dns endpoints, on any provider, with no CNAME: an OIDC token, a 15-minute token from the token exchange, or, for parties without an identity provider, an API key bound to a team and a role, rotated and revoked through the API.

certbot · acme.sh · lego · win-acme · cert-manager · Caddy

Run it

A container or a Lambda

The gate is a single Go binary with its web UI built in. Validate a configuration before you ship it, run it locally against a test zone, then deploy the Helm chart, or the same binary as an AWS Lambda function behind API Gateway.

Locally

# provider credentials, held by the gate only:
# Route 53 through the AWS credential chain (role, profile),
# EuroDNS through EURODNS_APP_ID and EURODNS_API_KEY

go run ./cmd/dns-gate -check -config config.yaml   # validate only
go run ./cmd/dns-gate -config config.yaml

On Kubernetes

helm install dns-gate \
  oci://ghcr.io/kamorionlabs/charts/dns-gate \
  -f values.yaml

# image: ghcr.io/kamorionlabs/dns-gate

On AWS Lambda

make lambda   # dist/dns-gate_<version>_lambda_arm64.zip

# provided.al2023, arm64, API Gateway HTTP API,
# DynamoDB store, no VPC

Repositories

Beta, in production since November 2026 for one organization: 14 zones, OpenTofu pipelines writing certificate validation and site records, the web UI and the MCP server. Versions are still 0.x.

Read more: documentation · quickstart · Helm · AWS Lambda · API by example · API reference · configuration · threat model · certificates (ACME)