initial ipv6 support
this adds and waits for AAAA records based on setting. we have to wait for both A and AAAA because we don't know if the user is accessing via IPv4 or IPv6. For Let's Encrypt, IPv6 is preferred (but not sure if it retries if IPv6 is unreachable). part of #264
This commit is contained in:
@@ -323,12 +323,16 @@ async function setupDnsAndCert(subdomain, domain, auditSource, progressCallback)
|
||||
const domainObject = await domains.get(domain);
|
||||
const dashboardFqdn = dns.fqdn(subdomain, domainObject);
|
||||
|
||||
const ip = await sysinfo.getServerIPv4();
|
||||
const ipv4 = await sysinfo.getServerIPv4();
|
||||
const ipv6Enabled = await settings.getIPv6Config();
|
||||
const ipv6 = ipv6Enabled ? await sysinfo.getServerIPv6() : null;
|
||||
|
||||
progressCallback({ message: `Updating DNS of ${dashboardFqdn}` });
|
||||
await dns.upsertDnsRecords(subdomain, domain, 'A', [ ip ]);
|
||||
await dns.upsertDnsRecords(subdomain, domain, 'A', [ ipv4 ]);
|
||||
if (ipv6Enabled) await dns.upsertDnsRecords(subdomain, domain, 'AAAA', [ ipv6 ]);
|
||||
progressCallback({ message: `Waiting for DNS of ${dashboardFqdn}` });
|
||||
await dns.waitForDnsRecord(subdomain, domain, 'A', ip, { interval: 30000, times: 50000 });
|
||||
await dns.waitForDnsRecord(subdomain, domain, 'A', ipv4, { interval: 30000, times: 50000 });
|
||||
if (ipv6Enabled) await dns.waitForDnsRecord(subdomain, domain, 'AAAA', ipv6, { interval: 30000, times: 50000 });
|
||||
progressCallback({ message: `Getting certificate of ${dashboardFqdn}` });
|
||||
await reverseProxy.ensureCertificate(dns.fqdn(subdomain, domainObject), domain, auditSource);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user