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