]> git.sesse.net Git - nms/blob - config/make-named.pl
Update make-named.pl for TG06.
[nms] / config / make-named.pl
1 #! /usr/bin/perl -w
2 use strict;
3
4 # les inn nettnavn
5 my %netnames = ();
6 my %netmasks = ();
7 my @nets = ();
8 open NAMES, "switches.txt"
9 or die "switches.txt: $!";
10 while (<NAMES>) {
11         chomp;
12         /194\.0\.(\d+\.\d+)\s+(\d+)\s+(\S+)/ or next;
13         $netmasks{$1} = $2;
14         $netnames{$1} = $3;
15         push @nets, $1;
16 }
17
18 print <<"EOF";
19 // Autogenerated by make-named.pl. Do not edit manually! 
20
21 options {
22         directory "/etc/bind";
23         allow-query { any; };
24         allow-transfer { 194.19.3.20; 194.0.255.2; }; 
25         auth-nxdomain no;
26         recursion yes;
27
28         forwarders { 194.19.2.11; 194.19.3.11; }; 
29         forward only;
30 };
31
32 zone "." { type hint; file "db.root"; };
33
34 zone "0.0.127.in-addr.arpa" {
35         type master;
36         file "0.0.127.in-addr.arpa";
37         notify no;
38 };
39
40 zone "tg06.gathering.org" {
41         type master;
42         file "tg06.gathering.org";
43         notify yes;
44         allow-transfer { 194.0.255.2; };
45 };
46 zone "www.gathering.org" {
47         type master;
48         file "www.gathering.org";
49         notify yes;
50         allow-transfer { 194.0.255.2; };
51 };
52
53 // serversubnett
54 zone "255.0.194.in-addr.arpa" {
55         type master;
56         file "254.0.194.in-addr.arpa";
57         notify yes;
58         allow-transfer { 194.0.255.2; 193.0.0.0/22; };
59 };
60
61 zone "0.194.in-addr.arpa" {
62         type master;
63         allow-update { key DHCP_UPDATER; };
64         notify yes;
65         file "dynamic/0.194.in-addr.arpa";      
66         allow-transfer { 194.19.3.20; 194.0.255.2; 193.0.0.0/22; };
67 };
68
69 key DHCP_UPDATER {
70         algorithm HMAC-MD5.SIG-ALG.REG.INT;
71         secret removed;
72 };
73
74 EOF
75
76 for my $net (@nets) {
77         my $domain = $netnames{$net};
78         my @domains;
79         if ($domain =~ /^split:(.*)/) {
80                 @domains = split /,/, $1;
81         } else {
82                 @domains = ($domain);
83         }
84
85         for my $d (@domains) {
86                 print <<"EOF";
87 zone "$d.tg06.gathering.org" {
88         type master;
89         allow-update { key DHCP_UPDATER; };
90         notify yes;
91         file "dynamic/$d.tg06.gathering.org";
92         allow-transfer { 194.19.3.20; 194.0.255.2; };
93 };
94 EOF
95         }
96 }