diff --git a/dashboard/src/js/setupdns.js b/dashboard/src/js/setupdns.js index 602773415..0c74bc0df 100644 --- a/dashboard/src/js/setupdns.js +++ b/dashboard/src/js/setupdns.js @@ -33,6 +33,7 @@ app.controller('SetupDNSController', ['$scope', '$http', '$timeout', 'Client', f }; $scope.sysinfoProvider = [ + { name: 'Disabled', value: 'noop' }, { name: 'Public IP', value: 'generic' }, { name: 'Static IP Address', value: 'fixed' }, { name: 'Network Interface', value: 'network-interface' } diff --git a/dashboard/src/views/network.html b/dashboard/src/views/network.html index f399754b1..3c83f1ba9 100644 --- a/dashboard/src/views/network.html +++ b/dashboard/src/views/network.html @@ -171,7 +171,7 @@ -
+
{{ 'network.ip.address' | tr }}
diff --git a/dashboard/src/views/network.js b/dashboard/src/views/network.js index 50c3cd82a..0cafbe206 100644 --- a/dashboard/src/views/network.js +++ b/dashboard/src/views/network.js @@ -11,6 +11,7 @@ angular.module('Application').controller('NetworkController', ['$scope', '$locat // keep in sync with sysinfo.js $scope.sysinfoProvider = [ + { name: 'Disabled', value: 'noop' }, { name: 'Public IP', value: 'generic' }, { name: 'Static IP Address', value: 'fixed' }, { name: 'Network Interface', value: 'network-interface' } diff --git a/src/dns.js b/src/dns.js index a4017d3ea..85da36db6 100644 --- a/src/dns.js +++ b/src/dns.js @@ -127,11 +127,13 @@ async function checkDnsRecords(subdomain, domain) { const cnameRecords = await getDnsRecords(subdomain, domain, 'CNAME'); if (cnameRecords.length !== 0) return { needsOverwrite: true }; - const ipv4Records = await getDnsRecords(subdomain, domain, 'A'); const ipv4 = await network.getIPv4(); + if (ipv4) { + const ipv4Records = await getDnsRecords(subdomain, domain, 'A'); - // if empty OR exactly one record with the ip, we don't need to overwrite - if (ipv4Records.length !== 0 && (ipv4Records.length !== 1 || ipv4Records[0] !== ipv4)) return { needsOverwrite: true }; + // if empty OR exactly one record with the ip, we don't need to overwrite + if (ipv4Records.length !== 0 && (ipv4Records.length !== 1 || ipv4Records[0] !== ipv4)) return { needsOverwrite: true }; + } const ipv6 = await network.getIPv6(); if (ipv6) { @@ -198,8 +200,11 @@ async function waitForLocations(locations, progressCallback) { const { subdomain, domain } = location; progressCallback({ message: `Waiting for propagation of ${fqdn(subdomain, domain)}` }); - const [error] = await safe(waitForDnsRecord(subdomain, domain, 'A', ipv4, { times: 240 })); - if (error) throw new BoxError(BoxError.DNS_ERROR, `DNS A Record is not synced yet: ${error.message}`, { ipv4, subdomain, domain }); + if (ipv4) { + const [error] = await safe(waitForDnsRecord(subdomain, domain, 'A', ipv4, { times: 240 })); + if (error) throw new BoxError(BoxError.DNS_ERROR, `DNS A Record is not synced yet: ${error.message}`, { ipv4, subdomain, domain }); + } + if (ipv6) { const [error] = await safe(waitForDnsRecord(subdomain, domain, 'AAAA', ipv6, { times: 240 })); if (error) throw new BoxError(BoxError.DNS_ERROR, `DNS AAAA Record is not synced yet: ${error.message}`, { ipv6, subdomain, domain }); @@ -262,7 +267,7 @@ async function registerLocations(locations, options, progressCallback) { await removeDnsRecords(location.subdomain, location.domain, 'CNAME', values); } - await registerLocation(location, options, 'A', ipv4); + if (ipv4) await registerLocation(location, options, 'A', ipv4); if (ipv6) await registerLocation(location, options, 'AAAA', ipv6); }); } @@ -289,7 +294,7 @@ async function unregisterLocations(locations, progressCallback) { progressCallback({ message: `Unregistering location: ${location.subdomain ? (location.subdomain + '.') : ''}${location.domain}` }); await promiseRetry({ times: 30, interval: 5000, debug, retry: (error) => error.retryable }, async function () { - await unregisterLocation(location, 'A', ipv4); + if (ipv4) await unregisterLocation(location, 'A', ipv4); if (ipv6) await unregisterLocation(location, 'AAAA', ipv6); }); } diff --git a/src/dns/wildcard.js b/src/dns/wildcard.js index a650c7895..4be5be0af 100644 --- a/src/dns/wildcard.js +++ b/src/dns/wildcard.js @@ -79,13 +79,15 @@ async function verifyDomainConfig(domainObject) { const location = 'cloudrontestdns'; const fqdn = dns.fqdn(location, domainObject.domain); - const [ipv4Error, ipv4Result] = await safe(dig.resolve(fqdn, 'A', { server: '127.0.0.1', timeout: 5000 })); - if (ipv4Error && (ipv4Error.code === 'ENOTFOUND' || ipv4Error.code === 'ENODATA')) throw new BoxError(BoxError.BAD_FIELD, `Unable to resolve IPv4 of ${fqdn}. Please check if you have set up *.${domainObject.domain} to point to this server's IP`); - if (ipv4Error) throw new BoxError(BoxError.BAD_FIELD, `Unable to resolve IPv4 of ${fqdn}: ${ipv4Error.message}`); - if (!ipv4Result) throw new BoxError(BoxError.BAD_FIELD, `Unable to resolve IPv4 of ${fqdn}`); - const ipv4 = await network.getIPv4(); - if (ipv4Result.length !== 1 || ipv4 !== ipv4Result[0]) throw new BoxError(BoxError.EXTERNAL_ERROR, `Domain resolves to ${JSON.stringify(ipv4Result)} instead of IPv4 ${ipv4}`); + if (ipv4) { + const [ipv4Error, ipv4Result] = await safe(dig.resolve(fqdn, 'A', { server: '127.0.0.1', timeout: 5000 })); + if (ipv4Error && (ipv4Error.code === 'ENOTFOUND' || ipv4Error.code === 'ENODATA')) throw new BoxError(BoxError.BAD_FIELD, `Unable to resolve IPv4 of ${fqdn}. Please check if you have set up *.${domainObject.domain} to point to this server's IP`); + if (ipv4Error) throw new BoxError(BoxError.BAD_FIELD, `Unable to resolve IPv4 of ${fqdn}: ${ipv4Error.message}`); + if (!ipv4Result) throw new BoxError(BoxError.BAD_FIELD, `Unable to resolve IPv4 of ${fqdn}`); + + if (ipv4Result.length !== 1 || ipv4 !== ipv4Result[0]) throw new BoxError(BoxError.EXTERNAL_ERROR, `Domain resolves to ${JSON.stringify(ipv4Result)} instead of IPv4 ${ipv4}`); + } const ipv6 = await network.getIPv6(); // both should be RFC 5952 format if (ipv6) {