Skip to content

DNS Provider Automation

The dns_provider validation implementation is driven by a DNS Provider Profile: a configuration stored at <data-dir>/providers/<name>.toml describing which backend publishes TXT records in which zone. Built-in and external backends share the same publication, receipt, propagation, and cleanup flow.

终端窗口
aster-acme provider backends # backends supported by this build and their fields
aster-acme provider list
aster-acme provider show NAME

provider backends is the authority: backend IDs and fields are whatever it displays.

终端窗口
aster-acme provider add cf-prod --backend com.astercosm.acme.dns.cloudflare
aster-acme cert issue -a default -d example.com -d '*.example.com' \
-c dns_provider --provider cf-prod

The interactive flow prompts field by field per the backend descriptor, with the API token entered hidden. For automation, use a private TOML file so the token never appears on the command line:

# Optional; when omitted the zone is auto-discovered from the final publication target
# zone_id = "0123456789abcdef0123456789abcdef"
# Credentials: exactly one of the two
api_token = "your-cloudflare-api-token"
# token_file = "/absolute/path/private-cloudflare-token"
终端窗口
aster-acme provider add cf-prod --backend com.astercosm.acme.dns.cloudflare \
--settings-file /absolute/path/cf-settings.toml --json
  • The token must cover the target zone with Zone Read and DNS Edit
  • With no zone ID, the zone is discovered from the longest suffix of the final publication target; the discovered zone is saved per publication and reused by recovery and cleanup
  • Built-in providers use asteracme-<publication_id> by default; Alibaba Cloud overrides this with acme-<publication_id> because its remark field is limited to 50 characters; Huawei Cloud appends =<sha256(txt_value)> for value binding inside an RRset; deletion verifies every record attribute first
  • Existing same-value records owned by another AsterACME publication are never borrowed; the user’s own unmarked records are preserved
  • Credential rotation is allowed; a saved certificate’s backend and zone-selection mode are not

The CLI includes Cloudflare, Alibaba Cloud DNS, Tencent Cloud DNSPod, and Huawei Cloud DNS by default. Run provider backends to inspect the active build. A smaller source build can pass --no-default-features and select only required dns-* features; the embedded crate defaults to no vendor.

Built-in Alibaba Cloud DNS and Tencent Cloud DNSPod

Section titled “Built-in Alibaba Cloud DNS and Tencent Cloud DNSPod”

Both backends are available in the default CLI build. A smaller source build can enable dns-aliyun or dns-tencent-cloud individually.

Backend ID Private settings fields
com.astercosm.acme.dns.aliyun access_key_id, access_key_secret
com.astercosm.acme.dns.tencent-cloud secret_id, secret_key

Run provider add NAME --backend BACKEND_ID to enter both credentials at hidden prompts. Automation can pass a private TOML file with --settings-file. Both backends discover the zone from the final TXT target and record the observed TTL in the receipt. DNSPod writes the common remark in its create request; Alibaba Cloud DNS writes it with UpdateDomainRecordRemark after AddDomainRecord succeeds. A failed Alibaba remark update is checkpointed and retries only the remark request, never the TXT creation. Alibaba Cloud DNS requires a saved create-response RecordId; when that ID is unavailable, recovery stops and leaves the remote record in place.

See the permissions, TTL and recovery guide.

Huawei Cloud DNS: no atomic isolation guarantee

Section titled “Huawei Cloud DNS: no atomic isolation guarantee”

The default CLI build includes backend com.astercosm.acme.dns.huawei-cloud; a smaller source build can enable dns-huawei-cloud. Private settings require access_key_id and access_key_secret; project_id is optional and is discovered through IAM for the selected region when omitted. region is optional and defaults to cn-north-4.

This backend cannot guarantee safety against concurrent remote writers. Huawei DNS updates replace a whole RRset without a documented revision precondition. A console or external client change between our read and PUT/DELETE may be overwritten or deleted. Coordinate every writer and prefer a dedicated ACME CNAME target. The backend preserves observed unrelated TXT values, checks ownership markers, checkpoints writes and reconciles lost responses, but these safeguards do not make the operation atomic.

See Huawei configuration and limitations.

Other providers implement ADPP (AsterACME DNS Provider Protocol), a stdin/stdout JSON protocol:

终端窗口
aster-acme provider add dns-prod --exec /absolute/path/my-dns-provider
aster-acme provider add dns-prod --exec /absolute/path/my-dns-provider \
--arg --production --allow-zone example.com
  • --exec takes an absolute path; the process starts directly without a shell, and --arg is repeatable
  • The subprocess does not inherit the host environment: scripts should use absolute interpreter paths and must not rely on PATH, HOME, proxy, or cloud-credential variables
  • --allow-zone restricts where TXT records may land (the zone or its subdomains, matched on whole labels); omit it for no restriction
  • The executable manages its own credentials (Keychain, secret manager, its own config); non-sensitive selection information may live in the profile’s provider_custom

A reference Python implementation with tests lives in the repository at examples/dns-providers/ (Cloudflare ADPP adapter).

A profile created by provider add (excerpt):

provider_profile_version = 1
backend_id = "com.astercosm.acme.adpp"
executable = "/absolute/path/my-dns-provider"
args = []
allowed_zones = [] # empty = unrestricted
timeout_seconds = 30 # per provider call (1–300)
ttl_seconds = 120 # requested value; vendors may clamp
propagation_timeout = 5 # single local check budget (1–3600)
propagation_interval = 5 # wait before the check (1–60)

provider_custom is interpreted by the corresponding backend and treated as a sensitive object: fully hidden in every output, never logged or journaled, never forwarded via argv or ENV. The whole profile is capped at 64KiB.

Existing CNAME delegation of _acme-challenge is supported out of the box — for example _acme-challenge.example.com. CNAME acme.validation.net.. AsterACME follows the CNAME (up to 8 hops, loops detected) and publishes at the final location; add --allow-zone validation.net to constrain writes. When DNS cannot resolve, new issuances can map targets explicitly with --dns-target 'DOMAIN=TXT_NAME'.

After present succeeds, AsterACME waits 5 seconds by default, then runs one advisory local TXT check (5-second budget by default). When every expected value is visible it requests CA validation immediately; missing values, resolver errors, or timeouts only warn, and the CA request proceeds after a further 10 seconds. Local visibility never implies CA approval.

Temporary TXT records are cleaned up automatically once the order completes or reaches a terminal failure: only records this publication created and left unchanged are deleted; pre-existing same-value records (preexisting) are preserved. Failed cleanup keeps a retryable state:

终端窗口
aster-acme provider cleanup dns-prod

cleanup loads no account keys and calls no CA; applications with unknown outcomes are not cleaned. Profiles referenced by certificate definitions cannot be removed (provider remove protects renewals).

  • Profile files are 0600 in a private directory on Unix; links or unsafe permissions are rejected outright
  • Putting tokens in provider_custom means they are genuinely stored in that file; preferring executable-managed credentials keeps the profile to selection info only
  • Onboard new executables against a controlled zone and a staging CA first