Changing AWS registred domain back to AWS name servers

30 views Asked by At

Got into the issue with the AWS domain. Here is what happened:

  1. Registered domain in AWS
  2. Created Hosted Zone, configure GMAIL MX records
  3. Changed name servers in AWS to point to the WIX NS
  4. Deleted the WIX site
  5. Changed name servers in AWS back to AWS name servers. (not the original ones, don't have them, using another AWS registered domain name servers)

Multiple problems now:

  1. Domain is not resolving (dig, nslookup) - AWS reports ("..[205.251.196.25] rcode=REFUSED for ***")
  2. AWS does not validate the certificate for this domain
  • DNS validation creates records, but the certificate is stuck in pending state
  • email validation also does not work, email is not sent to the registered domain owner address (check in promotions, spam etc, no email at all).

Thanks, Regards, Evgeny

1

There are 1 answers

0
Evgeny On

Thank you Halod for the hint.

Here is a piece of code to lookup domain name across all AWS NS servers

[TestClass]
public class AWSDomainRecovery
{
    [TestMethod]
    public async Task Recover()
    {
        var client = new HttpClient();
        var list = await client.GetStringAsync("https://gist.githubusercontent.com/otsuka752/993b1851d5772f72c161effb6eb1a23e/raw/1ec4bb40c9a67f93386f69a38047f195dff499c6/list_ns-of-R53");
        var nameServers = list.Split("\n").Select(l => l.Trim().Split("\t")[1].Trim());
        
        var responding = new List<string>();            
        var domain = "<<YOUR DOMAIN HERE>>";

        foreach (var ns in nameServers)
        {
            var tld = Path.GetExtension(ns.TrimEnd('.'));
            if (responding.Any(r => r.Contains(tld)))
                continue;

            var args = $"{domain} {ns}";

            var info = new ProcessStartInfo()
            {
                FileName = "nslookup",
                Arguments = args,
                RedirectStandardOutput = true,
                RedirectStandardError = true,
            };

            var p = Process.Start(info);
            p.WaitForExit();
            var output = await p.StandardOutput.ReadToEndAsync();
            var error = await p.StandardError.ReadToEndAsync();
            if (string.IsNullOrWhiteSpace(error))
                responding.Add(ns);
        }
    }
}