aboutsummaryrefslogtreecommitdiffstats
path: root/bootstrap/make-first-zones.pl
diff options
context:
space:
mode:
Diffstat (limited to 'bootstrap/make-first-zones.pl')
-rwxr-xr-xbootstrap/make-first-zones.pl125
1 files changed, 0 insertions, 125 deletions
diff --git a/bootstrap/make-first-zones.pl b/bootstrap/make-first-zones.pl
deleted file mode 100755
index 63cf1d0..0000000
--- a/bootstrap/make-first-zones.pl
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/usr/bin/perl -I /root/tgmanage
-use strict;
-use Net::IP;
-use NetAddr::IP;
-use POSIX qw(strftime);
-
-BEGIN {
- require "include/config.pm";
- eval {
- require "include/config.local.pm";
- };
-}
-
-my $base = "/etc";
-$base = $ARGV[0] if $#ARGV > -1;
-$base .= "/" if not $base =~ m/\/$/ and not $base eq "";
-
-my $serial = strftime("%Y%m%d", localtime(time())) . "01";
-
-my $zonefile;
-$zonefile = $base . "bind/" . $nms::config::tgname . ".gathering.org.zone";
-
-if ( not -f $zonefile )
-{
- print $zonefile . "\n";
- open MAINZONE, ">" . $zonefile or die $! . " " . $zonefile;
-
- print MAINZONE <<"EOF";
-\$TTL 3600
-@ 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 $nms::config::pri_hostname.$nms::config::tgname.gathering.org.
- IN NS $nms::config::sec_hostname.$nms::config::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 ;)
-
-EOF
- close MAINZONE;
-}
-else { print "Skipped TG-zone, file exists.\n"; }
-
-$zonefile = $base . "bind/infra." . $nms::config::tgname . ".gathering.org.zone";
-if ( not -f $zonefile )
-{
- print $zonefile . "\n";
- open MAINZONE, ">" . $zonefile or die $! . " " . $zonefile;
-
- print MAINZONE <<"EOF";
-\$TTL 3600
-@ 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 $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 ;)
-EOF
- close MAINZONE;
-}
-else { print "Skipped infra-zone, file exists.\n"; }
-
-# IPv6 PTR
-foreach my $ipv6_net (NetAddr::IP->new($nms::config::base_ipv6net)->split(32)){
- my $ipv6 = Net::IP->new($ipv6_net);
- (my $ipv6zone = $ipv6->reverse_ip()) =~ s/\.$//;
-
- $zonefile = $base . "bind/" . $ipv6zone . ".zone";
- if ( not -f $zonefile )
- {
- print $zonefile . "\n";
- open IPV6ZONE, ">" . $zonefile or die $! . " " . $zonefile;
-
- print IPV6ZONE <<"EOF";
-; autogenerated, and updated from dhcpd -- DO NOT TOUCH!
-\$TTL 3600
-@ 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 $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
-
- # print NS reverse
- my $ipv6addr = NetAddr::IP->new($ipv6_net);
- my $ip_pri_1 = NetAddr::IP->new($nms::config::pri_v6);
- if($ipv6addr->contains($ip_pri_1)){
- my $ip_pri = Net::IP->new( $nms::config::pri_v6 ) or die ( "Error, new Net::IP for " . $nms::config::pri_v6 );
- print IPV6ZONE $ip_pri->reverse_ip() . " IN PTR $nms::config::pri_hostname.$nms::config::tgname.gathering.org.\n";
- }
-
- my $ip_sec_1 = NetAddr::IP->new($nms::config::sec_v6);
- if($ipv6addr->contains($ip_sec_1)){
- my $ip_sec = Net::IP->new( $nms::config::sec_v6 ) or die ( "Error, new Net::IP for " . $nms::config::sec_v6 );
- 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"; }
-}