Date: Tue, 22 Jul 2003 09:06:03 +0300 (EEST) From: Evren Yurtesen <yurtesen@ispro.net.tr> To: Peter McGarvey <fbsd-x@packet.org.uk> Cc: freebsd-isp@freebsd.org Subject: Re: checking dns records from named.conf Message-ID: <20030722090102.T91254@finland.ispro.net.tr> In-Reply-To: <20030721193402.GA9925@greatmachine.diogenes.intranet> References: <20030721165525.L21521@finland.ispro.net.tr> <20030721193402.GA9925@greatmachine.diogenes.intranet>
next in thread | previous in thread | raw e-mail | index | archive | help
This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. --0-1848576634-1058853963=:91254 Content-Type: TEXT/PLAIN; charset=US-ASCII Excellent script! I have few questions and perhaps good news :) I have already modified your script to read named.conf file and parse it quite properly! :) Meaning nicely skipping commends and finding zones and making an array of domain names. Then of course checking against the array was easy. I now continue to add more functionality :) Now my question is something funny perhaps. Normally I store the domain files at /etc/namedb if you have 350,000 domains, then wouldnt it mean you should have files of those domains somewhere? :) What kind of structure do you use? Evren On Mon, 21 Jul 2003, Peter McGarvey wrote: > * Evren Yurtesen <yurtesen@ispro.net.tr> [2003-07-21 14:57:35 BST]: > > I have about 1000 domain names in my named.conf file. > > I wonder if it would be possible to check the validity of these domains > > or even if they are pointing to my name server or not easily... > > Is there a ready script or something somebody knows here? > > > > Well, I'm trying to combine the DNS platforms of 4 different companies > onto a single standard platform. I've got over 350,000 domains.... all > of which need redelegating. And just to make life fun these 4 different > platforms have all been left to rot for years. > > None of the tools I've found have provided me with any of the > information I need to speed up the process. So I've resorted to using a > variety of tools, and writing my own. > > For checking the actual zonefiles, I tend to use named-checkzone which > is part of the bind distribution - but not part of the BSD install > unfortunately. > > As for my scripts... well they are rather nasty :-( > > But I've attached a re-hacked hack of a hack script of mine that may be > useful. > > cat domainlist | perl auths.pl > > > > -- > TTFN, FNORD > > Peter McGarvey > Freelance FreeBSD Hacker > (will work for bandwidth) > --0-1848576634-1058853963=:91254 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="auths_enhanced.pl" Content-Transfer-Encoding: BASE64 Content-ID: <20030722090603.C91254@finland.ispro.net.tr> Content-Description: Content-Disposition: attachment; filename="auths_enhanced.pl" IyEvdXNyL2Jpbi9wZXJsDQoNCiMgICANCiMNCiMgQ3JlYXRpb24gRGF0ZTog MjFzdCBKdWx5IDIwMDMNCiMNCiMgICAgICAgQXV0aG9yOg0KIyAgICAgICBQ ZXRlciBQLiBNY0dhcnZleSA8eGFwaG9kQHRlY2hpZS5jb20+DQojICAgICAg IA0KIyAgICAgICBBZGRpdGlvbmFsIENvZGU6DQojICAgICAgIEV2cmVuIFl1 cnRlc2VuIDx5dXJ0ZXNlbkBpc3Byby5uZXQudHI+DQojDQojIFZFUlNJT04g SElTVE9SWSAgICAgICAgICAgICAgICAgICAgICAgICAgICANCiMgICAgICAg ICAgICAgICAgDQojICAgICAgIGZvcm1hdCB4Lnkueg0KIyAgICAgICAgICAg ICAgIC0geCA9IE1ham9yIHZlcnNpb24gbnVtYmVyDQojICAgICAgICAgICAg ICAgLSB5ID0gTWluaW9yIHZlcnNpb24gbnVtYmVyICAgICAgICAgICANCiMg ICAgICAgICAgICAgICAtIHogPSBCdXJzdCBudW1iZXIgICAgICAgICAgICAg ICAgICAgIA0KIyAgICAgICAgICAgICAgICAgICAgICAgSSB3b3JrIGluIGJ1 cnN0cy4gIFdlZWtlbmQgaGVyZSwgY291cGxlIG9mIGhvdXJzIGEgbmlnaHQN CiMgICAgICAgICAgICAgICAgICAgICAgIHRoZXJlLCB0aGVuIGEgbmlnaHQg KGEgd2VlayBldGMuKSBvZmYgdG8gdGhpbmsuICBUaGUNCiMgICAgICAgICAg ICAgICAgICAgICAgIGBidXJzdCBudW1iZXInIGhlbHBzIG1lIGtlZXAgdHJh Y2sgb2YgZGlmZmVyZW50IHZlcnNpb25zDQojICAgICAgICAgICAgICAgICAg ICAgICBtZXRoaW5rcyBDVlMgd291bGQgYmUgYSBnb29kIGlkZWEgb25lIGRh eS4NCiMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIA0KIyAgICAwLjAuMSAgMjAwMy0wNy0yMSAgLSBQZXRl ciBQLiBNY0dhcnZleSA8eGFwaG9kQHRlY2hpZS5jb20+DQojCQkJICAqIEEg TkFTVFkgaGFjayBvZiBhIHBlcmwgc2NyaXB0Lg0KIyAgICAwLjEuMSAgMjAw My0wNy0yMiAgLSBFdnJlbiBZdXJ0ZXNlbiA8eXVydGVzZW5AaXNwcm8ubmV0 LnRyPg0KIyAgICAgICAgICAgICAgICAgICAgICAgICAqIEFkZGVkIG5hbWVk LmNvbmYgZmlsZSBwYXJzaW5nDQojICAgICAgICAgICAgICAgICAgICAgICAg ICogQWRkZWQgYXV0b21hdGljYWwgbmFtZXNlcnZlciBjaGVja2luZw0KIyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgDQp1c2UgdmFycyBxdygkVkVSU0lPTik7ICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICANCiRWRVJTSU9OID0gJzAuMS4xJzsgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIA0KIyAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgDQojID09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09DQoNCiNsb2NhdGlvbiBv ZiBuYW1lZC5jb25mIGZpbGUNCiRuYW1lZF9jb25mPSJuYW1lZC5jb25mIjsN Cg0KI3RoZSBuYW1lIHNlcnZlcnMgeW91IGV4cGVjdCB0byBzZWUNCkBuYW1l c2VydmVycz0oJ25zMS5pc3Byby5uZXQnLCduczIuaXNwcm8ubmV0JywnZG5z MS5pc3Byby5uZXQudHInLCdkbnMyLmlzcHJvLm5ldC50cicpOw0KDQojZGVi dWdnaW5nIGxldmVsICh0aGUgaGlnaGVyLCB0aGUgbW9yZSB0ZXh0ISkNCiRk ZWJ1Zz0yMDsNCg0KIyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PQ0KIyBTdGFydGluZyB0aGUgQ29kZQ0KDQoNCnVzZSBOZXQ6OkROUzsgICAg ICAgICANCiAgICAgICAgICAgICAgICAgICAgIA0KDQpteSAkdGltZW91dD0w Ow0KDQpteSBAZG9tYWlubGlzdCA9ICZnZXRfZG9tYWluX2xpc3Q7DQoNCmZv cmVhY2ggbXkgJHpvbmUgKCZnZXRfZG9tYWluX2xpc3QpIHsNCiN3aGlsZSht eSAkem9uZSA9IDxkb21haW5saXN0Pikgew0KICBwcmludCAiIyB6b25lOiAk em9uZVxuIjsNCiAgbXkgKCRwYXJlbnRfem9uZSkgPSAkem9uZSA9fiAvXlte XC5dKlwuKC4qKS87DQogIHByaW50ICIjIHBhcmVudCBvZiAkem9uZSBpcyAk cGFyZW50X3pvbmVcbiI7DQogIG15ICRwYXJlbnRfYXV0aF9wcmltYXJ5ID0g JmdldF9hdXRoX3ByaW1hcnkoJHBhcmVudF96b25lLCAkdGltZW91dCk7DQog IGlmICgkcGFyZW50X2F1dGhfcHJpbWFyeSA9PSAtMSkgeyAgICANCiAgICBw cmludCAiIyBERUFEIFpPTkUhXG4jIEFCT1JUXG5cbiI7DQogICAgcHJpbnQg REVBRCAiIyAkem9uZVxuIjsgICAgICAgICAgDQogICAgbmV4dDsNCiAgfQ0K ICBwcmludCAiIyBwYXJlbnQgYXV0aCBwcmltYXJ5IGlzOiAkcGFyZW50X2F1 dGhfcHJpbWFyeVxuIjsNCiAgbXkgQGF1dGhfc2VydmVycyA9ICZnZXRfbnNf bGlzdCgkem9uZSwgJHBhcmVudF9hdXRoX3ByaW1hcnksICR0aW1lb3V0KTsN CiAgaWYgKHNjYWxhcihAYXV0aF9zZXJ2ZXJzKSA9PSAwKSB7ICAgICAgICAg ICAgICAgDQogICAgcHJpbnQgIiMgTm8gYXV0aCBzZXJ2ZXJzLCBERUFEIFpP TkUhXG4iOw0KICAgIHByaW50IERFQUQgIiR6b25lXG4iOw0KICAgIG5leHQ7 ICAgICAgDQogIH0NCiAgZm9yZWFjaCBteSAkbnMgKEBhdXRoX3NlcnZlcnMp IHsNCiAgICAkbnMgPSBsYygkbnMpOw0KICAgIHByaW50ICRucywgIlxuIjsg ICAgICAgICANCiAgfQ0KfQ0KDQojID09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09DQojIEVuZCBvZiB0aGUgQ29kZQktIFN0YXJ0IG9mIHRoZSBT dWItRnVuY3Rpb25zDQojICZnZXRfZG9tYWluX2xpc3QJLSBSZXR1cm5zIHRo ZSBsaXN0IG9mIGRvbWFpbnMgZnJvbSBuYW1lZC5jb25mLmZpbGUNCiMgJmdl dF9hdXRoX3ByaW1hcnkJLSBUYWtlcyB0aGUgbmFtZSBvZiBhIHpvbmUgICAg ICAgICAgICAgICANCiMJCQkgIFJldHVybiB0aGUgTU5BTUUgZmllbGQgZnJv bSB0aGUgU09BDQojICZnZXRfbnNfbGlzdAkJLSBSZXR1cm5zIHRoZSBsaXN0 IG9mIE5TIHJlY29yZHMgcmVwb3J0ZWQgYnkgdGhhdCBzZXJ2ZXINCg0KIyA9 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQ0KIyBSZXR1cm5zIHRo ZSBsaXN0IG9mIGRvbWFpbnMgZnJvbSBuYW1lZC5jb25mIGZpbGUNCnN1YiBn ZXRfZG9tYWluX2xpc3Qgew0KICBvcGVuKE5BTUVEX0NPTkYsIjwgJG5hbWVk X2NvbmYiKSBvciBkaWUgIkNhbiBub3Qgb3BlbiAkbmFtZWRfY29uZiI7DQog ICNzZXQgc29tZSB2Y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kem9uZSA9IHNoaWZ0Ow0KICAgIG15ICR0Y3BfdGltZW91dCA9IHNoaWZ0 Ow0KICAgIA0KICAgIG15ICRyZXMgPSBuZXcgTmV0OjpETlM6OlJlc29sdmVy Ow0KICAgIG15ICRwYWNrZXQgPSBuZXcgTmV0OjpETlM6OlBhY2tldCgkem9u ZSwgIlNPQSIsICJJTiIpOw0KICAgICAgICANCiAgICAkcmVzLT50Y3BfdGlt ZW91dCgkdGNwX3RpbWVvdXQpIGlmICR0Y3BfdGltZW91dDsNCg0KICAgIG15 ICRyZXEgPSAkcmVzLT5zZW5kKCRwYWNrZXQpOw0KDQogICAgcmV0dXJuIC0x DQogICAgICAgIHVubGVzcyBkZWZpbmVkKCRyZXEpOw0KICAgIHJldHVybiAt MQ0KICAgICAgICB1bmxlc3MgKCAoJHJlcS0+aGVhZGVyLT5hbmNvdW50ID49 IDEpDQogICAgICAgICAgICAgICYmICgoJHJlcS0+YW5zd2VyKVswXS0+dHlw ZSBlcSAiU09BIikgKTsNCiAgICByZXR1cm4gKCRyZXEtPmFuc3dlcilbMF0t Pm1uYW1lIC4gIi4iOw0KICAgICAgICAgICAgIyBSZXR1cm4gdGhlIEZRRE4N Cn0NCg0KIyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQ0KIyBS ZXR1cm5zIHRoZSBsaXN0IG9mIE5TIHJlY29yZHMgcmVwb3J0ZWQgYnkgdGhh dCBzZXJ2ZXINCnN1YiBnZXRfbnNfbGlzdCB7DQogICAgbXkgJHpvbmUgPSBz aGlmdDsgICAgICAgICAgICANCiAgICBteSAkc2VydmVyID0gc2hpZnQ7DQog ICAgbXkgJHRjcF90aW1lb3V0ID0gc2hpZnQ7DQogDQogICAgbXkgQG5zX2xp c3Q7DQogICAgICAgICAgICAgICAgICAgICAgICAgIA0KICAgIG15ICRyZXMg PSBuZXcgTmV0OjpETlM6OlJlc29sdmVyOw0KICAgICAgICAgDQogICAgJHJl cy0+dGNwX3RpbWVvdXQoJHRjcF90aW1lb3V0KSBpZiAkdGNwX3RpbWVvdXQ7 DQogICAgICAgDQogICAgI2RpZSAiRkFJTDogTlMgaGFzIG5vIGFkZHJlc3Mg KCIgLiAkcmVzLT5lcnJvcnN0cmluZyAuICIpIiAgICAgICAgICAgICAgICAg DQogICAgcmV0dXJuIEBuc19saXN0ICAgICAgIA0KICAgICAgICAgdW5sZXNz ICRyZXMtPm5hbWVzZXJ2ZXJzKCRzZXJ2ZXIpOw0KDQogICAgbXkgJHJlcSA9 ICRyZXMtPnF1ZXJ5KCR6b25lLCAiTlMiKTsNCiAgICANCiAgICAjZGllICJX QVJOOiBOUyBxdWVyeSByZXN1bHRzIHdlcmUgYmFkICgiIC4gJHJlcy0+ZXJy b3JzdHJpbmcgLiAiKSINCiAgICByZXR1cm4gQG5zX2xpc3QgICAgICAgICAg ICAgICAgICANCiAgICAgICAgICAgdW5sZXNzICggZGVmaW5lZCgkcmVxKQ0K ICAgICAgICAgICAgICAgICAmJiAoJHJlcS0+aGVhZGVyLT5hbmNvdW50ID4g MCkgKTsNCiAgICANCiAgICBmb3JlYWNoIG15ICRycl9ucyAoJHJlcS0+YW5z d2VyKSB7DQogICAgICAgIHB1c2ggQG5zX2xpc3QsICRycl9ucy0+bnNkbmFt ZSAuICIuIjsgI0ZRRE4hDQogICAgfQ0KICAgIHJldHVybiBzb3J0IEBuc19s aXN0Ow0KfQ0K --0-1848576634-1058853963=:91254--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030722090102.T91254>