diff options
Diffstat (limited to 'tools/make-first-zones.pl')
-rwxr-xr-x | tools/make-first-zones.pl | 60 |
1 files changed, 24 insertions, 36 deletions
diff --git a/tools/make-first-zones.pl b/tools/make-first-zones.pl index b869115..7d6d9f4 100755 --- a/tools/make-first-zones.pl +++ b/tools/make-first-zones.pl @@ -14,46 +14,34 @@ my $base = "/etc"; $base = $ARGV[0] if $#ARGV > -1; $base .= "/" if not $base =~ m/\/$/ and not $base eq ""; -my $tgname = $nms::config::tgname; -my $pri_hostname = $nms::config::pri_hostname; -my $pri_v4 = $nms::config::pri_v4; -my $pri_v6 = $nms::config::pri_v6; -my $sec_hostname = $nms::config::sec_hostname; -my $sec_v4 = $nms::config::sec_v4; -my $sec_v6 = $nms::config::sec_v6; -my $ipv6zone = $nms::config::ipv6zone; - -# FIXME: THIS IS NOT APPRORPIATE! -my $serial = `date +%Y%m%d01`; -chomp $serial; -# FIXME +my $serial = strftime("%Y%m%d", localtime(time())) . "01"; my $zonefile; +$zonefile = $base . "bind/" . $nms::config::tgname . ".gathering.org.zone"; -$zonefile = $base . "bind/" . $tgname . ".gathering.org.zone"; -if ( not -f $zonefile ) +if ( not -f $zonefile ) { print $zonefile . "\n"; open MAINZONE, ">" . $zonefile or die $! . " " . $zonefile; print MAINZONE <<"EOF"; \$TTL 3600 -@ IN SOA $pri_hostname.$tgname.gathering.org. abuse.gathering.org. ( +@ IN SOA $nms::config::pri_hostname.$nms::config::tgname.gathering.org. abuse.gathering.org. ( $serial; serial 3600 ; refresh 1800 ; retry 608400 ; expire 3600 ) ; minimum and default TTL - IN NS $pri_hostname.$tgname.gathering.org. - IN NS $sec_hostname.$tgname.gathering.org. + IN NS $nms::config::pri_hostname.$nms::config::tgname.gathering.org. + IN NS $nms::config::sec_hostname.$nms::config::tgname.gathering.org. -$pri_hostname IN A $pri_v4 -$pri_hostname IN AAAA $pri_v6 -$sec_hostname IN A $sec_v4 -$sec_hostname IN AAAA $sec_v6 -ns1 IN CNAME $pri_hostname.$tgname.gathering.org. -ns2 IN CNAME $sec_hostname.$tgname.gathering.org. +$nms::config::pri_hostname IN A $nms::config::pri_v4 +$nms::config::pri_hostname IN AAAA $nms::config::pri_v6 +$nms::config::sec_hostname IN A $nms::config::sec_v4 +$nms::config::sec_hostname IN AAAA $nms::config::sec_v6 +ns1 IN CNAME $nms::config::pri_hostname.$nms::config::tgname.gathering.org. +ns2 IN CNAME $nms::config::sec_hostname.$nms::config::tgname.gathering.org. ; Generated by make-all-config.sh on the bootstrapping/nms server. ; Will not be overwritten unless it is missing ;) @@ -63,7 +51,7 @@ EOF } else { print "Skipped TG-zone, file exists.\n"; } -$zonefile = $base . "bind/infra." . $tgname . ".gathering.org.zone"; +$zonefile = $base . "bind/infra." . $nms::config::tgname . ".gathering.org.zone"; if ( not -f $zonefile ) { print $zonefile . "\n"; @@ -71,15 +59,15 @@ if ( not -f $zonefile ) print MAINZONE <<"EOF"; \$TTL 3600 -@ IN SOA $pri_hostname.$tgname.gathering.org. abuse.gathering.org. ( +@ IN SOA $nms::config::pri_hostname.$nms::config::tgname.gathering.org. abuse.gathering.org. ( $serial; serial 3600 ; refresh 1800 ; retry 608400 ; expire 3600 ) ; minimum and default TTL - IN NS $pri_hostname.$tgname.gathering.org. - IN NS $sec_hostname.$tgname.gathering.org. + IN NS $nms::config::pri_hostname.$nms::config::tgname.gathering.org. + IN NS $nms::config::sec_hostname.$nms::config::tgname.gathering.org. ; Generated by make-all-config.sh on the bootstrapping/nms server. ; Will not be overwritten unless it is missing ;) @@ -88,7 +76,7 @@ EOF } else { print "Skipped infra-zone, file exists.\n"; } -$zonefile = $base . "bind/" . $ipv6zone . ".zone"; +$zonefile = $base . "bind/" . $nms::config::ipv6zone . ".zone"; if ( not -f $zonefile ) { print $zonefile . "\n"; @@ -97,24 +85,24 @@ if ( not -f $zonefile ) print IPV6ZONE <<"EOF"; ; autogenerated, and updated from dhcpd -- DO NOT TOUCH! \$TTL 3600 -@ IN SOA $pri_hostname.$tgname.gathering.org. abuse.gathering.org. ( +@ IN SOA $nms::config::pri_hostname.$nms::config::tgname.gathering.org. abuse.gathering.org. ( $serial; serial 3600 ; refresh 1800 ; retry 608400 ; expire 3600 ) ; minimum and default TTL - IN NS $pri_hostname.$tgname.gathering.org. - IN NS $sec_hostname.$tgname.gathering.org. + IN NS $nms::config::pri_hostname.$nms::config::tgname.gathering.org. + IN NS $nms::config::sec_hostname.$nms::config::tgname.gathering.org. ; WARNING! Do not edit this file directly! ; on the bootstrapping/nms server! EOF - my $ip_pri = new Net::IP( $pri_v6 ) or die ( "Error, new Net::IP for " . $pri_v6 ); - my $ip_sec = new Net::IP( $sec_v6 ) or die ( "Error, new Net::IP for " . $sec_v6 ); - print IPV6ZONE $ip_pri->reverse_ip() . " IN PTR $pri_hostname.$tgname.gathering.org.\n"; - print IPV6ZONE $ip_sec->reverse_ip() . " IN PTR $sec_hostname.$tgname.gathering.org.\n"; + my $ip_pri = new Net::IP( $nms::config::pri_v6 ) or die ( "Error, new Net::IP for " . $nms::config::pri_v6 ); + my $ip_sec = new Net::IP( $nms::config::sec_v6 ) or die ( "Error, new Net::IP for " . $nms::config::sec_v6 ); + print IPV6ZONE $ip_pri->reverse_ip() . " IN PTR $nms::config::pri_hostname.$nms::config::tgname.gathering.org.\n"; + print IPV6ZONE $ip_sec->reverse_ip() . " IN PTR $nms::config::sec_hostname.$nms::config::tgname.gathering.org.\n"; close IPV6ZONE; } else { print "Skipped v6-reverse-zone, file exists.\n"; } |