]> git.sesse.net Git - nms/blob - config/make-named-secondary.pl
12d521ad665f9c25733497d355389aeadfee5f19
[nms] / config / make-named-secondary.pl
1 #! /usr/bin/perl -w
2 use strict;
3
4 my $date = `date --rfc-2822`;
5 chomp $date;
6
7 my @nets = ();
8 open NAMES, "switches.txt"
9         or die "switches.txt: $!";
10 while (<NAMES>) {
11         chomp;
12         /87\.76\.(\d+\.\d+)\s+(\d+)\s+(\S+)/ or next;
13         push @nets, {
14                 net => $1,
15                 netmask => $2,
16                 name => $3
17         };
18 }       
19
20 print <<"EOF";
21 // Autogenerated by make-named-secondary.pl at $date. Do not edit manually! 
22
23 options {
24         directory "/etc/bind";
25         allow-query { any; };
26         allow-transfer { 194.19.3.20; }; 
27         auth-nxdomain no;
28         recursion yes;
29
30 //      forwarders { 194.19.2.11; 194.19.3.11; }; 
31 //      forward only;
32 };
33
34 zone "." { type hint; file "db.root"; };
35
36 zone "0.0.127.in-addr.arpa" {
37         type master;
38         file "0.0.127.in-addr.arpa";
39         notify no;
40 };
41
42 zone "tg07.gathering.org" {
43         type slave;
44         notify no;
45         masters { 87.76.254.2; };
46         file "tg07.gathering.org";
47 };
48
49 // linknett
50 zone "0.76.87.in-addr.arpa" {
51         type slave;
52         notify no;
53         masters { 87.76.254.2; };
54         file "0.76.87.in-addr.arpa";
55         allow-transfer { 193.0.0.0/22; };
56 };
57
58 // linknett
59 zone "174.76.87.in-addr.arpa" {
60         type slave;
61         notify no;
62         masters { 87.76.254.2; };
63         file "174.76.87.in-addr.arpa";
64         allow-transfer { 193.0.0.0/22; };
65 };
66
67 // nett-subnett
68 zone "239.76.87.in-addr.arpa" {
69         type slave;
70         notify no;
71         masters { 87.76.254.2; };
72         file "239.76.87.in-addr.arpa";
73         allow-transfer { 193.0.0.0/22; };
74 };
75
76 // serversubnett
77 zone "254.76.87.in-addr.arpa" {
78         type slave;
79         notify no;
80         masters { 87.76.254.2; };
81         file "254.76.87.in-addr.arpa";
82         allow-transfer { 193.0.0.0/22; };
83 };
84 zone "255.76.87.in-addr.arpa" {
85         type slave;
86         notify no;
87         masters { 87.76.254.2; };
88         file "255.76.87.in-addr.arpa";
89         allow-transfer { 193.0.0.0/22; };
90 };
91
92 zone "76.87.in-addr.arpa" {
93         type slave;
94         notify no;
95         masters { 87.76.254.2; };
96         allow-update { key DHCP_UPDATER; };
97         file "dynamic/76.87.in-addr.arpa";      
98         allow-transfer { 194.19.3.20; 193.0.0.0/22; };
99 };
100 zone "f.f.f.f.8.d.6.1.1.0.0.2.ip6.in-addr.arpa" {
101         type slave;
102         notify no;
103         masters { 87.76.254.2; };
104         allow-update { key DHCP_UPDATER; };
105         file "dynamic/f.f.f.f.8.d.6.1.1.0.0.2.ip6.arpa";        
106         allow-transfer { 194.19.3.20; };
107 };
108
109
110 key DHCP_UPDATER {
111         algorithm HMAC-MD5.SIG-ALG.REG.INT;
112         secret 5Yz1azvh7mE0IRGffTvtKg==;
113 };
114
115 EOF
116
117 for my $net (@nets) {
118         my $d = $net->{name};
119
120         print <<"EOF";
121 zone "$d.tg07.gathering.org" {
122         type slave;
123         notify no;
124         masters { 87.76.254.2; };
125         allow-update { key DHCP_UPDATER; };
126         file "dynamic/$d.tg07.gathering.org";
127         allow-transfer { 194.19.3.20; };
128 };
129 EOF
130 }