my @cmd = ($check, '-w', $params->{'warn'}, '-c', $params->{'critical'});
push(@cmd, '-r', $extra->{'initial_refs'}) if exists $extra->{'initial_refs'};
+ push(@cmd, '-d') if $params->{'debug'};
push(@cmd, $zone);
open(P, '-|', @cmd) or die ("Cannot run $CHECK for $zone\n");
my @p = <P>;
return ($res, \@p);
}
-my $USAGE = "Usage: $PROGRAM_NAME [--help] | [--timeout=<nn>] [--warn=<nn>] [--critical=<nn>] [--geozonedir=<geodir>] <indir>\n";
+my $USAGE = "Usage: $PROGRAM_NAME [--help] | [--debug] [--timeout=<nn>] [--warn=<nn>] [--critical=<nn>] [--geozonedir=<geodir>] <indir>\n";
my $params = { 'timeout' => 45, 'warn' => '14d', 'critical' => '7d' };
Getopt::Long::config('bundling');
GetOptions (
'--help' => \$params->{'help'},
'--timeout=i' => \$params->{'timeout'},
'--warn=s' => \$params->{'warn'},
+ '--debug' => \$params->{'debug'},
'--critical=s' => \$params->{'critical'},
'--geozonedir=s' => \$params->{'geozonedir'},
) or die ($USAGE);
for my $file (sort {$a cmp $b} (readdir INDIR)) {
next if ( -l "$file" );
next unless ( -f "$file" );
- next if $file =~ /^(dsset|keyset)-/;
- my $do_dnssec = 0;
+ my $do_dnssec = 1;
+ my $delegated = 1;
my $initial_refs = undef;
open(F, '<', $file) or die ("Cannot open $file: $!\n");
for (<F>) {
- if (/^; wzf:\s*dnssec\s*=\s*1\s*$/) { $do_dnssec = 1; }
+ if (/^; wzf:\s*dnssec\s*=\s*0\s*$/) { $do_dnssec = 0; }
+ if (/^; delegated\s*=\s*no\s*$/) { $delegated = 0; }
if (/^; check-initial-refs\s*=\s*(.*?)\s*$/) { $initial_refs = $1; }
};
close F;
- if ($do_dnssec) {
+ if ($do_dnssec && $delegated) {
die "Duplicate zone $file?\n" if exists $dnsseczones{$file};
$dnsseczones{$file} = {};
$dnsseczones{$file}->{'initial_refs'} = $initial_refs if defined $initial_refs;
for my $file (sort {$a cmp $b} (readdir INDIR)) {
next unless $file =~ /\.zone$/;
- open (F, '<', $file) or die "Cannot open $file: $!\n";
- my ($zc, undef, undef) = Load(join "", (<F>));
- close F;
-
my $zone = basename($file, '.zone');
-
- if ($zc->{'dnssec'}) {
- die "Duplicate zone $zone?\n" if exists $dnsseczones{$zone};
- $dnsseczones{$zone} = {};
- } else {
- push @{$count->{'unsigned'}}, $zone;
- };
+ die "Duplicate zone $zone?\n" if exists $dnsseczones{$zone};
+ $dnsseczones{$zone} = {};
}
closedir(INDIR);
}
else { push @{$count->{'unknown'}}, $zone; };
delete $threads{$zone};
}
- sleep(1) unless scalar keys %threads == 0;
+ last if scalar keys %threads == 0;
+ print STDERR (scalar keys %threads), " threads left: ", join(" ", keys %threads), "\n" if $params->{'debug'};
+ sleep 1;
}
for my $zone (sort {$a cmp $b} keys %threads) {
push @{$count->{'warn'}}, $zone;
};
printf "unsigned: %d", scalar @{$count->{'unsigned'}};
print "\n";
-print $_ for (@details);
-exit $exit;
+for (@details) {
+ s/\|/;/g;
+ print $_;
+}
+exit ((defined $exit) ? $exit : 0);