DNS Debacle

The past few weeks have been challenging. 6 months ago I inherited a network of five machines. One NS with a seperate backup, Two webservers, a DB server and a mail server. There was no need to move anything, the plan was to leave it all with the hosting environment it's currently in.  However, some developments have made a move to new servers necessary.

The first thing I had to do was find out what domains we hosted. 

  1. grep -i servername /etc/httpd/sites-enabled/* | awk '{print $3}' | sort | uniq > /home/v.flesouras/all_document_roots

That produced output that looks like this:

  1. 4noweeds.com
  2. acnmwa.org
  3. adairdentistry.com
  4. adoptarkids.org
  5. after-sort.net
  6. after-sort.org
  7. aftersort.net
  8. aidtemps.com
  9. allcleanusa.com

Using the large list - about 2200 domains, I used a script that does a DNS query

  1. #!/bin/bash
  3. for dom in cat ./domainslist.txt
  4. do
  6. result=$(dig +noall +answer $domains | awk '{print $5}')
  8. if [ "$result" != '' ];then
  10. echo "$dom" >> /home/xxxx/havingA.txt
  12. else
  14. echo "$dom" >> /home/xxxx/havingNoA.txt
  16. fi
  18. done

and returns

  1. 1stlutheran.com. 2947 IN A
  2. 30a-foreclosures.com. 124 IN A
  3. 4morerice.com. 124 IN A
  4. 4noweeds.com. 124 IN A
  5. 870935ride.com. 1149 IN A
  6. aaasold.com. 2949 IN A
  7. acnmwa.org. 124 IN A
  8. adairdentistry.com. 124 IN A
  9. adamsrestaurants.com. 124 IN A
  10. adoptarkids.org. 124 IN A
  11. adultandbabydiapers.com. 125 IN A
  12. after-sort.com. 125 IN A
  13. after-sort.net. 125 IN A
  14. after-sort.org. 125 IN A
  15. aftersort.com. 3550 IN A
  16. aftersort.net. 125 IN A

Which with a bit of regex in vim can be parsed down to simply "domain.com" Once you have "domain ip" list, you can eliminate lines that don't correspond to your subnet. You're left with a list of domains that by verification with DNS, accurately reflect the domains you host.

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. The supported tag styles are: <foo>, [foo].

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
9 + 3 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
By submitting this form, you accept the Mollom privacy policy.
Twitter icon
Facebook icon
Google icon
StumbleUpon icon
Del.icio.us icon
Digg icon
LinkedIn icon
Pinterest icon
Reddit icon
e-mail icon

The man behind the curtain

Vincent is above all things, a dad. Time that is not spent learning what it is to be a dad and enjoying that journey is spent immersed in the ever evolving realm of all things digital.  He likes to tinker with anything electronic. Often that means making his android phone do complex, but silly things.  He likes to experiment with new languages and stays current on new development strategies and methods. His life is often consumed with being a middling squire and apprentice Armorer