A Rust implementation of a cert-manager DNS01 webhook
solver for
Alibaba Cloud DNS (AliDNS). It is a drop-in replacement for the unmaintained
Go cert-manager-alidns-webhook at the Issuer level (solverName: alidns-solver). It is deployed with plain Kustomize manifests.
cert-manager ── POST /apis/<group>/v1alpha1/alidns-solver ──▶ kube-apiserver
│ RBAC check, aggregation proxy
▼ (front-proxy client certificate)
Rust webhook (APIService backend)
│ RPC, signature V3 (ACS3-HMAC-SHA256)
▼
AliDNS API
- Present creates the
_acme-challengeTXT record. It is idempotent: an existing record, or a lostDomainRecordDuplicaterace, counts as success. - CleanUp deletes only records whose value equals the challenge key, so concurrent validations for the same name keep working. Lookups page through every result.
- Authentication mirrors the Kubernetes aggregation layer. API routes
require a client certificate that chains to
requestheader-client-ca-fileand whose CN is inrequestheader-allowed-names. Both values come fromkube-system/extension-apiserver-authenticationand are re-read every 60s./healthz,/livezand/readyzneed no client certificate. - Serving certificate rotation is picked up on the next TLS handshake. No restart is needed.
- Credentials come from the webhook's own environment (single tenant). Issuers carry no secret references, so the webhook needs no cluster-wide Secret read access.
| Variable | Default | Meaning |
|---|---|---|
GROUP_NAME |
required | API group registered by the APIService |
SOLVER_NAME |
alidns-solver |
resource name used as solverName |
ALIBABA_CLOUD_ACCESS_KEY_ID |
required | RAM AccessKey ID |
ALIBABA_CLOUD_ACCESS_KEY_SECRET |
required | RAM AccessKey secret |
LISTEN_ADDR |
0.0.0.0:8443 |
HTTPS listen address |
TLS_CERT_FILE / TLS_KEY_FILE |
/tls/tls.crt / /tls/tls.key |
serving certificate |
ALIDNS_ENDPOINT |
https://alidns.aliyuncs.com |
AliDNS API endpoint |
RUST_LOG |
info |
log filter |
Minimal RAM policy (replace example.com with the hosted zones):
{
"Version": "1",
"Statement": [
{
"Effect": "Allow",
"Action": [
"alidns:DescribeDomainRecords",
"alidns:AddDomainRecord",
"alidns:DeleteDomainRecord"
],
"Resource": "acs:alidns:*:*:domain/example.com"
}
]
}deploy/base is a Kustomize base for a cluster where cert-manager runs in the
cert-manager namespace with the cert-manager service account. It contains:
- the webhook ServiceAccount;
- a RoleBinding to read the aggregator CA;
- the
domain-solverClusterRole for cert-manager; - a private CA and the serving Certificate;
- the Deployment, Service and APIService.
-
Provide the
alidns-credentialsSecret, using SOPS, ExternalSecrets or similar.deploy/examples/credentials-secret.yamlshows its shape. -
Point Argo CD or Flux at an overlay that references
deploy/baseand pins the image:apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - https://github.com/llc1123/cert-manager-alidns-webhook-rust//deploy/base?ref=<commit> images: - name: ghcr.io/llc1123/cert-manager-alidns-webhook-rust newTag: sha-<commit>
-
Reference the solver from an Issuer or ClusterIssuer, as in
deploy/examples/clusterissuer.yaml.
The group name alidns.acme.local is internal to the cluster. To change it,
patch the APIService (name and spec.group), the domain-solver ClusterRole,
and GROUP_NAME. Do not add a namespace: transformer to an overlay: it would
also move the RoleBinding out of kube-system.
cargo fmt --all -- --check
cargo test --all-targets --all-features
cargo clippy --all-targets --all-features -- -D warnings
cargo build --release
cd conformance
RUST_BINARY="$PWD/../target/release/cert-manager-alidns-webhook" \
go test -race -shuffle=on -count=1 ./...The conformance suite drives the compiled binary through cert-manager's own
webhook client. It needs no Kubernetes cluster; see
conformance/README.md.