aboutsummaryrefslogtreecommitdiffstats
path: root/bootstrap
diff options
context:
space:
mode:
Diffstat (limited to 'bootstrap')
-rwxr-xr-xbootstrap/make-first-zones.pl43
-rwxr-xr-xbootstrap/make-named.pl74
2 files changed, 100 insertions, 17 deletions
diff --git a/bootstrap/make-first-zones.pl b/bootstrap/make-first-zones.pl
index 0f2754c..63cf1d0 100755
--- a/bootstrap/make-first-zones.pl
+++ b/bootstrap/make-first-zones.pl
@@ -1,6 +1,7 @@
#!/usr/bin/perl -I /root/tgmanage
use strict;
use Net::IP;
+use NetAddr::IP;
use POSIX qw(strftime);
BEGIN {
@@ -76,13 +77,18 @@ EOF
}
else { print "Skipped infra-zone, file exists.\n"; }
-$zonefile = $base . "bind/" . $nms::config::ipv6zone . ".zone";
-if ( not -f $zonefile )
-{
- print $zonefile . "\n";
- open IPV6ZONE, ">" . $zonefile or die $! . " " . $zonefile;
+# 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/\.$//;
- print IPV6ZONE <<"EOF";
+ $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. (
@@ -97,12 +103,23 @@ if ( not -f $zonefile )
; WARNING! Do not edit this file directly!
; on the bootstrapping/nms server!
-
EOF
- my $ip_pri = Net::IP->new( $nms::config::pri_v6 ) or die ( "Error, new Net::IP for " . $nms::config::pri_v6 );
- my $ip_sec = Net::IP->new( $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;
+
+ # 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"; }
}
-else { print "Skipped v6-reverse-zone, file exists.\n"; }
diff --git a/bootstrap/make-named.pl b/bootstrap/make-named.pl
index 4812d81..62ad584 100755
--- a/bootstrap/make-named.pl
+++ b/bootstrap/make-named.pl
@@ -1,5 +1,6 @@
#!/usr/bin/perl -I /root/tgmanage
use strict;
+use NetAddr::IP;
BEGIN {
require "include/config.pm";
@@ -54,6 +55,43 @@ options {
recursion yes;
auth-nxdomain no;
listen-on-v6 { any; };
+ statistics-file "/etc/bind/named.rndc-stats";
+};
+
+logging {
+ category "default" { "debug"; };
+ category "general" { "debug"; };
+ category "database" { "debug"; };
+ category "security" { "debug"; "stats"; };
+ category "config" { "debug"; "stats"; };
+ category "resolver" { "debug"; "stats"; };
+ category "xfer-in" { "debug"; "stats"; };
+ category "xfer-out" { "debug"; "stats"; };
+ category "notify" { "debug"; "stats"; };
+ category "client" { "debug"; };
+ category "unmatched" { "debug"; };
+ category "network" { "debug"; };
+ category "update" { "debug"; };
+ category "queries" { "stats"; };
+ category "dispatch" { "debug"; };
+ category "dnssec" { "debug"; };
+ category "lame-servers" { "debug"; };
+
+ channel "debug" {
+ file "/etc/bind/nameddbg" versions 2 size 50m;
+ print-time yes;
+ print-category yes;
+ print-severity yes;
+ severity debug 9;
+ };
+
+ channel "stats" {
+ file "/etc/bind/namedstats" versions 2 size 50m;
+ print-time yes;
+ print-category yes;
+ print-severity yes;
+ severity debug 3;
+ };
};
key DHCP_UPDATER {
@@ -80,18 +118,33 @@ zone "infra.$nms::config::tgname.gathering.org" {
allow-transfer { ns-xfr; };
};
-zone "$nms::config::ipv6zone" {
+EOF
+
+ # 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/\.$//;
+
+
+ print NFILE <<EOF;
+zone "$ipv6zone" {
type master;
allow-update { key DHCP_UPDATER; };
notify yes;
- file "$nms::config::ipv6zone.zone";
+ file "$ipv6zone.zone";
allow-transfer { ns-xfr; ext-xfr; };
};
+EOF
+ }
+
+ print NFILE <<EOF;
+
include "/etc/bind/named.conf.default-zones";
include "named.reverse4.conf";
include "named.master-include.conf";
EOF
+
}
if ( $role eq "slave" )
@@ -114,14 +167,27 @@ zone "infra.$nms::config::tgname.gathering.org" {
masters { master_ns; };
};
-zone "$nms::config::ipv6zone" {
+EOF
+
+ # 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/\.$//;
+
+ print NFILE <<EOF;
+zone "$ipv6zone" {
type slave;
notify no;
masters { master_ns; };
- file "slave/$nms::config::ipv6zone:";
+ file "slave/$ipv6zone";
allow-transfer { ns-xfr; ext-xfr; };
};
+EOF
+ }
+
+ print NFILE <<EOF;
+
include "named.conf.default-zones";
include "named.slave-reverse4.conf";
include "named.slave-include.conf";