feat: DNS provider abstraction — Technitium, Cloudflare, RFC 2136, Manual
CI / Test & Lint (push) Has been cancelled
CI / Security audit (push) Has been cancelled

- dns-providers/: adapter base class + registry with auto-discovery
- technitium.js: wraps existing Technitium API calls into adapter interface
- cloudflare.js: Cloudflare API v4 adapter (zones, records, credentials)
- rfc2136.js: RFC 2136 dynamic DNS via nsupdate (BIND, PowerDNS, etc.)
- manual.js: no-op adapter for external DNS management with instructions
- provider-dns.js: provider-aware DNS context, resolves active adapter from config
- Universal helper methods: universalCreateRecord/Delete/ResolveRecord
- All 7 route files updated to use universal methods instead of raw dns.call()
- Setup wizard: provider dropdown (Technitium, Cloudflare, RFC 2136, Manual)
- DNS template selector: added Cloudflare and External/Manual options
- Config schema: validates dns.provider field
- Capability gating on Technitium-specific endpoints (logs, restart, update)
- Backward compatible: no provider set = auto-detect (technitium if dns.ip exists)
This commit is contained in:
Hermes
2026-06-10 15:06:41 -07:00
parent 0aa1c3d077
commit 2de72ed506
21 changed files with 1965 additions and 33 deletions
+8 -2
View File
@@ -393,8 +393,14 @@
<!-- DNS Server Configuration -->
<div>
<label class="form-label-accent">
🗂️ DNS Server (Technitium)
🗂️ DNS Provider
</label>
<select id="setup-dns-provider" class="form-input-lg" style="margin-bottom: 12px;">
<option value="technitium">Technitium DNS (recommended)</option>
<option value="cloudflare">Cloudflare DNS</option>
<option value="rfc2136">RFC 2136 (BIND / PowerDNS / other)</option>
<option value="manual">Manual / External DNS</option>
</select>
<div style="display: grid; grid-template-columns: 1fr auto; gap: 8px;">
<input type="text" id="setup-dns-ip" value="" placeholder="DNS server IP"
style="padding: 12px; background: var(--card-bg); color: var(--fg); border: 1px solid var(--border); border-radius: 6px; font-size: 1rem;" />
@@ -409,7 +415,7 @@
<!-- DNS Admin Token -->
<div>
<label class="form-label-accent">
🔑 Technitium Admin Token
🔑 DNS Admin Token / API Key
</label>
<input type="password" id="setup-dns-token" placeholder="Paste your admin token here"
class="form-input-lg" />
+30
View File
@@ -95,6 +95,36 @@
'Prometheus metrics'
],
recommended: false
},
{
id: 'cloudflare',
name: 'Cloudflare DNS',
description: 'Managed DNS with API access — no self-hosting needed',
icon: '🔶',
difficulty: 'Easy',
features: [
'Fully managed, no server needed',
'API for automated record management',
'Global anycast network',
'Free tier available'
],
recommended: false,
providerId: 'cloudflare'
},
{
id: 'external',
name: 'External / Manual DNS',
description: 'Use your own DNS provider (cPanel, Route53, etc.)',
icon: '🔗',
difficulty: 'Easy',
features: [
'Works with any DNS provider',
'DashCaddy shows you what records to create',
'Propagation checking still works',
'No API credentials needed'
],
recommended: false,
providerId: 'manual'
}
];
}
+2 -1
View File
@@ -174,8 +174,9 @@ window.populateTimezoneSelect = function(selectEl, selectedTz) {
if (currentConfigType === 'homelab') {
config.tld = document.getElementById('setup-tld')?.value?.trim() || '.home';
config.caName = document.getElementById('setup-ca-name')?.value?.trim() || '';
const selectedProvider = document.getElementById('setup-dns-provider')?.value || 'technitium';
config.dns = {
provider: 'technitium',
provider: selectedProvider,
ip: document.getElementById('setup-dns-ip')?.value?.trim() || '',
port: document.getElementById('setup-dns-port')?.value?.trim() || DC.DEFAULTS.DNS_PORT,
token: document.getElementById('setup-dns-token')?.value?.trim() || ''