Files
wireguard_webadmin/app_gateway/migrations/0009_dns_challenge_credentials.py
T
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

45 lines
1.9 KiB
Python

# Generated by Django 5.2.19 on 2026-11-17 18:30
import uuid
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app_gateway', '0008_accesspolicy_display_name_applicationroute_display_name'),
]
operations = [
migrations.CreateModel(
name='DnsChallengeCredential',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.SlugField(max_length=64, unique=True)),
('display_name', models.CharField(blank=True, max_length=128)),
('provider', models.CharField(choices=[('cloudflare', 'Cloudflare')], max_length=32)),
('credentials', models.JSONField(default=dict)),
('created', models.DateTimeField(auto_now_add=True)),
('updated', models.DateTimeField(auto_now=True)),
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)),
],
options={
'verbose_name': 'DNS Challenge Credential',
'verbose_name_plural': 'DNS Challenge Credentials',
'ordering': ['name'],
},
),
migrations.AddField(
model_name='applicationhost',
name='certificate_type',
field=models.CharField(choices=[('self_signed', 'Self-signed'), ('http_challenge', 'HTTP challenge'), ('dns_challenge', 'DNS challenge')], default='http_challenge', max_length=16),
),
migrations.AddField(
model_name='applicationhost',
name='dns_credential',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='hosts', to='app_gateway.dnschallengecredential'),
),
]