]> git.sesse.net Git - nms/blob - config/make-named-secondary.pl
Un-hijack.
[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 // hijack
50 zone "sth.ip-performance.se" {
51         type slave;
52         notify no;
53         masters { 87.76.254.2; };
54         file "sth.ip-performance.se";
55 };
56
57 // linknett
58 zone "0.76.87.in-addr.arpa" {
59         type slave;
60         notify no;
61         masters { 87.76.254.2; };
62         file "0.76.87.in-addr.arpa";
63         allow-transfer { 193.0.0.0/22; };
64 };
65
66 // linknett
67 zone "174.76.87.in-addr.arpa" {
68         type slave;
69         notify no;
70         masters { 87.76.254.2; };
71         file "174.76.87.in-addr.arpa";
72         allow-transfer { 193.0.0.0/22; };
73 };
74
75 // nett-subnett
76 zone "239.76.87.in-addr.arpa" {
77         type slave;
78         notify no;
79         masters { 87.76.254.2; };
80         file "239.76.87.in-addr.arpa";
81         allow-transfer { 193.0.0.0/22; };
82 };
83
84 // serversubnett
85 zone "254.76.87.in-addr.arpa" {
86         type slave;
87         notify no;
88         masters { 87.76.254.2; };
89         file "254.76.87.in-addr.arpa";
90         allow-transfer { 193.0.0.0/22; };
91 };
92 zone "255.76.87.in-addr.arpa" {
93         type slave;
94         notify no;
95         masters { 87.76.254.2; };
96         file "255.76.87.in-addr.arpa";
97         allow-transfer { 193.0.0.0/22; };
98 };
99
100 zone "76.87.in-addr.arpa" {
101         type slave;
102         notify no;
103         masters { 87.76.254.2; };
104         allow-update { key DHCP_UPDATER; };
105         file "dynamic/76.87.in-addr.arpa";      
106         allow-transfer { 194.19.3.20; 193.0.0.0/22; };
107 };
108 zone "f.f.f.f.8.d.6.1.1.0.0.2.ip6.in-addr.arpa" {
109         type slave;
110         notify no;
111         masters { 87.76.254.2; };
112         allow-update { key DHCP_UPDATER; };
113         file "dynamic/f.f.f.f.8.d.6.1.1.0.0.2.ip6.arpa";        
114         allow-transfer { 194.19.3.20; };
115 };
116
117
118 key DHCP_UPDATER {
119         algorithm HMAC-MD5.SIG-ALG.REG.INT;
120         secret 5Yz1azvh7mE0IRGffTvtKg==;
121 };
122
123 EOF
124
125 for my $net (@nets) {
126         my $d = $net->{name};
127
128         print <<"EOF";
129 zone "$d.tg07.gathering.org" {
130         type slave;
131         notify no;
132         masters { 87.76.254.2; };
133         allow-update { key DHCP_UPDATER; };
134         file "dynamic/$d.tg07.gathering.org";
135         allow-transfer { 194.19.3.20; };
136 };
137 EOF
138 }