Subversion Repositories sysadmin_scripts

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
74 rodolico 1
#! /usr/bin/env perl
2
 
3
use strict;
4
use warnings;
5
 
6
# we will list our name servers as CLI arguments
7
my %ourNS = map { lc $_ => 1 } @ARGV;
8
# if we don't clear ARGV, perl thinks we're passing filenames
9
# to open for STDIN
10
@ARGV = ();
11
 
12
# The tab delimited file of nameserver\tdomain are on STDIN
13
my @domainList = <>;
14
chomp @domainList;
15
 
16
my %weHost;
17
my %dontHost;
18
 
19
# get the ones we DO host
20
for ( my $i = 0; $i < @domainList; $i++ ) {
21
   my ($ns,$domain) = split( "\t", $domainList[$i] );
22
   $weHost{$domain} = 1 if $ourNS{lc $ns} || defined( $weHost{$domain} );
23
}
24
 
25
# get the ones we DON'T host. NOTE: we do it this way because a user may have
26
# us as a primary or a secondary, and have an entry with some other entity
27
for ( my $i = 0; $i < @domainList; $i++ ) {
28
   my ($ns,$domain) = split( "\t", $domainList[$i] );
29
   $dontHost{$domain} = 1 unless defined( $weHost{$domain} );
30
}
31
 
32
# dump the output
33
print "We don't do DNS for these domains\n" . join( "\n", keys %dontHost ) . "\n";
34
 
35
1;