From a265ee04af9b21379c4f33cf8838e579f71d99d6 Mon Sep 17 00:00:00 2001 From: Jesper Jensen Date: Sun, 1 Nov 2026 20:33:36 +0100 Subject: Implement Hostinger DNS webhook --- README.md | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 69 insertions(+), 6 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 24ec32c..b0e8712 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,50 @@ 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. @@ -51,13 +95,32 @@ 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.** -An example Go test file has been provided in [main_test.go](https://github.com/cert-manager/webhook-example/blob/master/main_test.go). +```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. -You can run the test suite with: +Run only the mock API and credential tests without live credentials or local +Kubernetes binaries using: -```bash -$ TEST_ZONE_NAME=example.com. make test +```sh +make test-unit ``` -The example file has a number of areas you must fill in and replace with your -own options in order for tests to pass. +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. -- cgit v1.2.3