]> git.sesse.net Git - nms/blob - config/make-named-secondary.pl
493f7c932242cf2d67308adf89a7f43a18b65652
[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 // nett-subnett
50 zone "239.0.194.in-addr.arpa" {
51         type slave;
52         notify no;
53         masters { 87.76.254.2; };
54         file "239.0.194.in-addr.arpa";
55         allow-transfer { 193.0.0.0/22; };
56 };
57
58 // serversubnett
59 zone "254.0.194.in-addr.arpa" {
60         type slave;
61         notify no;
62         masters { 87.76.254.2; };
63         file "254.0.194.in-addr.arpa";
64         allow-transfer { 193.0.0.0/22; };
65 };
66 zone "255.0.194.in-addr.arpa" {
67         type slave;
68         notify no;
69         masters { 87.76.254.2; };
70         file "255.0.194.in-addr.arpa";
71         allow-transfer { 193.0.0.0/22; };
72 };
73
74 zone "76.87.in-addr.arpa" {
75         type slave;
76         notify no;
77         masters { 87.76.254.2; };
78         allow-update { key DHCP_UPDATER; };
79         file "dynamic/0.194.in-addr.arpa";      
80         allow-transfer { 194.19.3.20; 193.0.0.0/22; };
81 };
82
83 key DHCP_UPDATER {
84         algorithm HMAC-MD5.SIG-ALG.REG.INT;
85         secret 5Yz1azvh7mE0IRGffTvtKg==;
86 };
87
88 EOF
89
90 for my $net (@nets) {
91         my $d = $net->{name};
92
93         print <<"EOF";
94 zone "$d.tg07.gathering.org" {
95         type slave;
96         notify no;
97         masters { 87.76.254.2; };
98         allow-update { key DHCP_UPDATER; };
99         file "dynamic/$d.tg07.gathering.org";
100         allow-transfer { 194.19.3.20; };
101 };
102 EOF
103 }