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