2025-04-08, 01:20 PM
(This post was last modified: 2025-04-21, 07:42 AM by Duvel. Edited 3 times in total.)
(2025-04-07, 12:57 PM)Balinus Wrote: For reference, here's the thread I started on Caddy Community forum.
https://caddy.community/t/best-way-to-in...dule/30701
If you want to use a DNS module you should build your own caddy image that includes the stuff for your specific DNS provider.
All custom images for all supported DNS providers are there : https://github.com/orgs/caddy-dns/repositories?type=all
You can add any other module you'd like to build the image you need
For instance my DNS provider is Infomaniak, and I also use the Crowdsec bouncer module on my Caddy to detect and block known attacks scenarios and offenders IPs, and so I build my caddy image with this docker command :
Code:
FROM caddy:builder AS builder
RUN xcaddy build \
--with github.com/caddy-dns/infomaniak \
--with github.com/hslatman/caddy-crowdsec-bouncer/http
FROM caddy:latest
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
Once your image is cooked, you should also configure properly the DNS parameters using a tls{} in your Caddyfile, for instance this is mine for infomaniak
Code:
*.domain.tld, domain.tld {
crowdsec # this executes the CrowdSec module; if an IP is denied, it won't get access to the reverse proxy
tls {
dns infomaniak my_very_long_api_key_provided_by_infomaniak
propagation_delay 60s
propagation_timeout -1
}
The parameters for your DNS might be different than mine, and you should find how to configure yours by yourself. There's generally some explanations on the readme of each caddy-dns sub-github