Files
Eduardo Silva c5f215d9df Add per-host certificate type and DNS challenge support to App Gateway
Each application host now selects how its TLS certificate is issued:
self-signed, ACME HTTP challenge, or ACME DNS challenge using a stored
DNS credential. ACME modes fall back to the internal CA when issuance
fails, so hosts stay reachable with a browser warning instead of a TLS
error.

- Add DnsChallengeCredential model and provider registry (Cloudflare)
- Add certificate_type and dns_credential to ApplicationHost
- Sync WireGuard WebAdmin hosts from .env into the reserved application
- Export per-host TLS settings to tls.json, read only by Caddy
- Group hosts by certificate settings into separate Caddy site blocks
- Build Caddy with the Cloudflare DNS module using xcaddy
- Regenerate the Caddyfile without DNS challenge if validation fails
2026-11-17 15:59:40 -03:00

23 lines
851 B
Python

from django.utils.translation import gettext_lazy as _
# Every provider listed here must also be compiled into the Caddy image
# (see containers/caddy/Dockerfile-caddy). Field names must match the
# subdirectives accepted by the provider's Caddy DNS module, and the optional
# pattern should mirror the module's own validation, since an invalid value
# prevents Caddy from loading the configuration.
DNS_PROVIDERS = {
'cloudflare': {
'label': 'Cloudflare',
'fields': [
{
'name': 'api_token',
'label': _('API Token'),
'secret': True,
'pattern': r'^(cf(ut|at)_[A-Za-z0-9_-]{32,256}|[A-Za-z0-9_-]{35,50})$',
},
],
},
}
DNS_PROVIDER_CHOICES = [(provider, provider_data['label']) for provider, provider_data in DNS_PROVIDERS.items()]