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