From cc6dae0f9ea9c9f37da4b4ee48938950f0283ccd Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Tue, 14 Feb 2017 22:27:27 -0800 Subject: [PATCH] check if ns is set to DO nameservers --- src/dns/digitalocean.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/dns/digitalocean.js b/src/dns/digitalocean.js index da635a1f3..8d25a5f82 100644 --- a/src/dns/digitalocean.js +++ b/src/dns/digitalocean.js @@ -192,6 +192,11 @@ function verifyDnsConfig(dnsConfig, domain, ip, callback) { if (error && error.code === 'ENOTFOUND') return callback(new SubdomainError(SubdomainError.BAD_FIELD, 'Unable to resolve nameservers for this domain')); if (error || !nameservers) return callback(new SubdomainError(SubdomainError.BAD_FIELD, error ? error.message : 'Unable to get nameservers')); + if (nameservers.map(function (n) { return n.toLowerCase(); }).indexOf('ns1.digitalocean.com') === -1) { + debug('verifyDnsConfig: %j does not contains DO NS', nameservers); + return callback(new SubdomainError(SubdomainError.BAD_FIELD, 'Domain nameservers are not set to Digital Ocean')); + } + upsert(credentials, domain, 'my', 'A', [ ip ], function (error, changeId) { if (error) return callback(error);