Do not rely on admin subdomain for dns backend config validation
This commit is contained in:
+11
-3
@@ -256,12 +256,20 @@ function verifyDnsConfig(dnsConfig, fqdn, zoneName, ip, callback) {
|
|||||||
return callback(new DomainError(DomainError.BAD_FIELD, 'Domain nameservers are not set to Cloudflare'));
|
return callback(new DomainError(DomainError.BAD_FIELD, 'Domain nameservers are not set to Cloudflare'));
|
||||||
}
|
}
|
||||||
|
|
||||||
upsert(credentials, zoneName, 'my', 'A', [ ip ], function (error, changeId) {
|
const testSubdomain = 'cloudrontestdns';
|
||||||
|
|
||||||
|
upsert(credentials, zoneName, testSubdomain, 'A', [ ip ], function (error, changeId) {
|
||||||
if (error) return callback(error);
|
if (error) return callback(error);
|
||||||
|
|
||||||
debug('verifyDnsConfig: A record added with change id %s', changeId);
|
debug('verifyDnsConfig: Test A record added with change id %s', changeId);
|
||||||
|
|
||||||
callback(null, credentials);
|
del(dnsConfig, zoneName, testSubdomain, 'A', [ ip ], function (error) {
|
||||||
|
if (error) return callback(error);
|
||||||
|
|
||||||
|
debug('verifyDnsConfig: Test A record removed again');
|
||||||
|
|
||||||
|
callback(null, credentials);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
+10
-4
@@ -221,14 +221,20 @@ function verifyDnsConfig(dnsConfig, fqdn, zoneName, ip, callback) {
|
|||||||
return callback(new DomainError(DomainError.BAD_FIELD, 'Domain nameservers are not set to Digital Ocean'));
|
return callback(new DomainError(DomainError.BAD_FIELD, 'Domain nameservers are not set to Digital Ocean'));
|
||||||
}
|
}
|
||||||
|
|
||||||
const name = config.adminLocation() + (fqdn === zoneName ? '' : '.' + fqdn.slice(0, - zoneName.length - 1));
|
const testSubdomain = 'cloudrontestdns';
|
||||||
|
|
||||||
upsert(credentials, zoneName, name, 'A', [ ip ], function (error, changeId) {
|
upsert(credentials, zoneName, testSubdomain, 'A', [ ip ], function (error, changeId) {
|
||||||
if (error) return callback(error);
|
if (error) return callback(error);
|
||||||
|
|
||||||
debug('verifyDnsConfig: A record added with change id %s', changeId);
|
debug('verifyDnsConfig: Test A record added with change id %s', changeId);
|
||||||
|
|
||||||
callback(null, credentials);
|
del(dnsConfig, zoneName, testSubdomain, 'A', [ ip ], function (error) {
|
||||||
|
if (error) return callback(error);
|
||||||
|
|
||||||
|
debug('verifyDnsConfig: Test A record removed again');
|
||||||
|
|
||||||
|
callback(null, credentials);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-4
@@ -187,14 +187,20 @@ function verifyDnsConfig(dnsConfig, fqdn, zoneName, ip, callback) {
|
|||||||
return callback(new DomainError(DomainError.BAD_FIELD, 'Domain nameservers are not set to Google Cloud DNS'));
|
return callback(new DomainError(DomainError.BAD_FIELD, 'Domain nameservers are not set to Google Cloud DNS'));
|
||||||
}
|
}
|
||||||
|
|
||||||
const name = config.adminLocation() + (fqdn === zoneName ? '' : '.' + fqdn.slice(0, - zoneName.length - 1));
|
const testSubdomain = 'cloudrontestdns';
|
||||||
|
|
||||||
upsert(credentials, zoneName, name, 'A', [ ip ], function (error, changeId) {
|
upsert(credentials, zoneName, testSubdomain, 'A', [ ip ], function (error, changeId) {
|
||||||
if (error) return callback(error);
|
if (error) return callback(error);
|
||||||
|
|
||||||
debug('verifyDnsConfig: A record added with change id %s', changeId);
|
debug('verifyDnsConfig: Test A record added with change id %s', changeId);
|
||||||
|
|
||||||
callback(null, credentials);
|
del(dnsConfig, zoneName, testSubdomain, 'A', [ ip ], function (error) {
|
||||||
|
if (error) return callback(error);
|
||||||
|
|
||||||
|
debug('verifyDnsConfig: Test A record removed again');
|
||||||
|
|
||||||
|
callback(null, credentials);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
+10
-4
@@ -247,14 +247,20 @@ function verifyDnsConfig(dnsConfig, fqdn, zoneName, ip, callback) {
|
|||||||
return callback(new DomainError(DomainError.BAD_FIELD, 'Domain nameservers are not set to Route53'));
|
return callback(new DomainError(DomainError.BAD_FIELD, 'Domain nameservers are not set to Route53'));
|
||||||
}
|
}
|
||||||
|
|
||||||
const name = config.adminLocation() + (fqdn === zoneName ? '' : '.' + fqdn.slice(0, - zoneName.length - 1));
|
const testSubdomain = 'cloudrontestdns';
|
||||||
|
|
||||||
upsert(credentials, zoneName, name, 'A', [ ip ], function (error, changeId) {
|
upsert(credentials, zoneName, testSubdomain, 'A', [ ip ], function (error, changeId) {
|
||||||
if (error) return callback(error);
|
if (error) return callback(error);
|
||||||
|
|
||||||
debug('verifyDnsConfig: A record added with change id %s', changeId);
|
debug('verifyDnsConfig: Test A record added with change id %s', changeId);
|
||||||
|
|
||||||
callback(null, credentials);
|
del(dnsConfig, zoneName, testSubdomain, 'A', [ ip ], function (error) {
|
||||||
|
if (error) return callback(error);
|
||||||
|
|
||||||
|
debug('verifyDnsConfig: Test A record removed again');
|
||||||
|
|
||||||
|
callback(null, credentials);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user