#!/usr/bin/perl print "\n\n########################################\n"; print "# #\n"; print "# This script will create a basic #\n"; print "# DNS Record for use with BIND8++ #\n"; print "# #\n"; print "############################################\n\n\n"; $control = 1; while ($control > 0) { print "What is the domain you would like to create? (e.g., yahoo.com)\n"; $domain = ; chomp($domain); print "You typed: $domain. Is this correct? \t"; $temp = ; chomp($temp); if ($temp ne "y") { next; } $control = 0; } $control = 1; while ($control > 0) { print "What is the IP address for this domain? (e.g., 127.0.0.1)\n"; $domIP = ; chomp($domIP); print "You typed: $domIP. Is this correct? \t"; $temp = ; chomp($temp); if ($temp ne "y") { next; } $control = 0; } print "\nWe will begin processing $domain at $domIP.\n"; sleep(1); $control = 1; while ($control > 0) { print "\nPlease give the canonical name of the primary nameserver (e.g., ns1.nameserver.com)\n"; $primeNS = ; chomp($primeNS); print "You typed: $primeNS. Is this correct? \t"; $temp = ; chomp($temp); if ($temp ne "y") { next; } $control = 0; } $control = 1; while ($control > 0) { print "\nPlease give the canonical name of the secondary nameserver.\n"; $secNS = ; chomp($secNS); print "You typed: $secNS. Is this correct? \t"; $temp = ; chomp($temp); if ($temp ne "y") { next; } $control = 0; } $control = 1; while ($control > 0) { print "\nWhat is the contact email? (webmaster\@$domain)\n"; $contMail = ; chomp($contMail); print "You typed: $contMail. Is this correct? \t"; $temp = ; chomp($temp); if ($temp ne "y") { next; } $control = 0; $contMail =~ s/[@]/./; } print "Would you like to have a serial number generated for you? \t"; $temp2 = ; chomp($temp2); if ($temp2 ne "y") { $control = 1; while ($control > 0) { print "\nPlease enter your serial number.\n"; $serial = ; chomp($serial); print "You typed: $serial. Is this correct? \t"; $temp = ; chomp($temp); if ($temp ne "y") { next; } $control = 0; } } else { &genSerial; } print "The following values will be used for your dns records. You may adjust them to your taste.\n\n\t10800\tRefresh\n\t3600\tRetry\n\t604800\tExpire\n\t86400\tTTL\n\n"; $fileName = "db.$domain"; &printOut($domain, $domIP, $primeNS, $secNS, $contMail, $serial, $fileName); print "\nCongratulations! Your DNS record was created in file $fileName for $domain.\n"; sub genSerial { print "Generating serial number."; @breakMeUp = localtime(time); print "."; $year = (1900 + $breakMeUp[5]); print "."; $month = ($breakMeUp[4] + 1); print "."; $day = $breakMeUp[3]; print "."; $serial = "$year"."$month"."$day"."01"; print "$serial\n"; return $serial; } sub printOut($domain, $domIP, $primeNS, $secNS, $contMail, $serial, $fileName) { open(DNSFILE, ">$fileName"); select(DNSFILE); print <