]> git.kaiwu.me - haproxy.git/commitdiff
EXAMPLES: acme: add a Lua Gandi DNS-01 configuration
authorWilliam Lallemand <wlallemand@haproxy.com>
Tue, 24 Nov 2026 16:42:04 +0000 (16:42 +0000)
committerWilliam Lallemand <wlallemand@haproxy.com>
Tue, 24 Nov 2026 16:48:45 +0000 (17:48 +0100)
Add a configuration loading the Gandi LiveDNS Lua handler with an ACME
section using Let's Encrypt staging and combined CLI/DNS readiness. Show
the certificate store and TLS frontend using the managed certificate,
and list the Lua, API-token and RRset ownership requirements.

examples/acme-lua.cfg [new file with mode: 0644]

diff --git a/examples/acme-lua.cfg b/examples/acme-lua.cfg
new file mode 100644 (file)
index 0000000..db16e62
--- /dev/null
@@ -0,0 +1,49 @@
+# Example: ACME dns-01 automation via Lua event callbacks
+#
+# The Lua script serializes Gandi LiveDNS TXT updates per certificate/domain
+# and acknowledges each apex or wildcard authorization separately.
+# Cleanup deletes the complete challenge RRset; use dedicated test names.
+#
+# Run from the repository root:
+#   haproxy -f examples/acme-lua.cfg
+#
+# Requirements:
+#   - HAProxy built with USE_SSL=1 USE_LUA=1
+#   - OpenSSL >= 1.1.1 (HAVE_ACME)
+#   - GANDI_API_KEY environment variable with a Gandi Personal Access Token
+# Use lua-load, not lua-load-per-thread: per-domain publication locks belong to
+# one Lua state. Other DNS writers require external coordination.
+
+global
+    setenv GANDI_API_KEY myapikey
+    expose-experimental-directives
+    tune.lua.bool-sample-conversion normal
+    lua-load examples/lua/acme-gandi-livedns.lua
+    log stderr local0
+
+# ---------------------------------------------------------------------------
+# ACME section: describes the CA, the account and the challenge type.
+# ---------------------------------------------------------------------------
+acme letsencrypt
+    directory https://acme-staging-v02.api.letsencrypt.org/directory
+#    directory https://acme-v02.api.letsencrypt.org/directory
+    contact doe@example.com
+    account-key examples/acme-account.key
+    challenge dns-01
+    challenge-ready cli,dns
+
+# ---------------------------------------------------------------------------
+# crt-store: maps the certificate file to the ACME section and SANs.
+# ---------------------------------------------------------------------------
+crt-store
+    load crt examples/acme-example.com.pem acme letsencrypt domains *.example.com.example.com
+
+# ---------------------------------------------------------------------------
+# Frontend: terminates TLS with the ACME-managed certificate.
+# ---------------------------------------------------------------------------
+frontend https
+    bind *:8443 ssl crt examples/acme-example.com.pem alpn h2,http/1.1
+    default_backend webservers
+
+backend webservers
+    server web1 127.0.0.1:8080 check