cert-manager project logo

# ACME webhook example The ACME issuer type supports an optional 'webhook' solver, which can be used to implement custom DNS01 challenge solving logic. This is useful if you need to use cert-manager with a DNS provider that is not officially supported in cert-manager core. ## Why not in core? As the project & adoption has grown, there has been an influx of DNS provider pull requests to our core codebase. As this number has grown, the test matrix has become un-maintainable and so, it's not possible for us to certify that providers work to a sufficient level. By creating this 'interface' between cert-manager and DNS providers, we allow users to quickly iterate and test out new integrations, and then packaging those up themselves as 'extensions' to cert-manager. We can also then provide a standardised 'testing framework', or set of conformance tests, which allow us to validate that a DNS provider works as expected. ## Creating your own webhook ### Using Hostinger DNS The webhook implements the [Hostinger DNS zone API](https://docs.hostinger.com/api-reference/endpoints/dns/zone). Build and publish the image, then install the chart with a group name under a domain you own: ```sh make build IMAGE_NAME=your-registry/webhook IMAGE_TAG=latest docker push your-registry/webhook:latest helm upgrade --install hostinger-webhook ./deploy/example-webhook \ --namespace cert-manager \ --set image.repository=your-registry/webhook \ --set image.tag=latest \ --set groupName=acme.example.com ``` Create a Hostinger API token in hPanel and store it in a Secret in cert-manager's cluster resource namespace (normally `cert-manager` for a ClusterIssuer): ```sh kubectl -n cert-manager create secret generic hostinger-api-token \ --from-literal=api-token=YOUR_HOSTINGER_API_TOKEN ``` Use this solver in your Issuer or ClusterIssuer's `spec.acme.solvers`: ```yaml - dns01: webhook: groupName: acme.example.com # Must match the Helm groupName. solverName: hostinger config: apiKeySecretRef: name: hostinger-api-token key: api-token ``` The Secret is read from the challenge's resource namespace. For a namespaced Issuer, put the Secret in the Issuer's namespace and grant the webhook's service account `get` access there. The chart grants access to `apiKeySecretName` (default `hostinger-api-token`) in `certManager.namespace`; adjust these values if needed. Run a single webhook replica so record cleanup and presentation are serialized. Presentation appends the TXT value; cleanup preserves other values at that name. Webhook's themselves are deployed as Kubernetes API services, in order to allow administrators to restrict access to webhooks with Kubernetes RBAC. This is important, as otherwise it'd be possible for anyone with access to your webhook to complete ACME challenge validations and obtain certificates. To make the set up of these webhook's easier, we provide a template repository that can be used to get started quickly. When implementing your webhook, you should set the `groupName` in the [values.yml](deploy/example-webhook/values.yaml) of your chart to a domain name that you - as the webhook-author - own. It should not need to be adjusted by the users of your chart. ### Creating your own repository ### Running the test suite All DNS providers **must** run the DNS01 provider conformance testing suite, else they will have undetermined behaviour when used with cert-manager. **It is essential that you configure and run the test suite when creating a DNS01 webhook.** ```sh export TEST_ZONE_NAME=example.com. export HOSTINGER_API_TOKEN # Populate this variable from your secret store. make test ``` `make test` runs the unit tests and cert-manager's actual `RunConformance` suite against `customDNSProviderSolver`, with strict mode enabled. This includes checking that deleting one TXT value preserves another at the same name. Missing configuration fails the command; conformance tests are never silently skipped. Test results are not cached. The suite creates and removes real TXT records under a unique `_acme-challenge.cert-manager-conformance-.` name and checks public authoritative DNS. It downloads local Kubernetes test binaries and starts a temporary API server; no existing cluster is needed. The token is written to a temporary Secret fixture, applied in each test namespace, and removed afterward. Run only the mock API and credential tests without live credentials or local Kubernetes binaries using: ```sh make test-unit ``` The conformance test is selected with the `conformance` build tag. If running Go directly, use `go test -tags=conformance -count=1 -timeout=30m ./...` and provide `TEST_ASSET_ETCD`, `TEST_ASSET_KUBE_APISERVER`, and `TEST_ASSET_KUBECTL` paths as well as the zone and token. Plain `go test ./...` runs only the unit tests.