]> git.sesse.net Git - nms/blob - config/make-named.pl
Minor TG06 adjustments to make-named.pl.
[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
47 // serversubnett
48 zone "255.0.194.in-addr.arpa" {
49         type master;
50         file "255.0.194.in-addr.arpa";
51         notify yes;
52         allow-transfer { 194.0.255.2; 193.0.0.0/22; };
53 };
54
55 zone "0.194.in-addr.arpa" {
56         type master;
57         allow-update { key DHCP_UPDATER; };
58         notify yes;
59         file "dynamic/0.194.in-addr.arpa";      
60         allow-transfer { 194.19.3.20; 194.0.255.2; 193.0.0.0/22; };
61 };
62
63 key DHCP_UPDATER {
64         algorithm HMAC-MD5.SIG-ALG.REG.INT;
65         secret 5Yz1azvh7mE0IRGffTvtKg==;
66 };
67
68 EOF
69
70 for my $net (@nets) {
71         my $domain = $netnames{$net};
72         my @domains;
73         if ($domain =~ /^split:(.*)/) {
74                 @domains = split /,/, $1;
75         } else {
76                 @domains = ($domain);
77         }
78
79         for my $d (@domains) {
80                 print <<"EOF";
81 zone "$d.tg06.gathering.org" {
82         type master;
83         allow-update { key DHCP_UPDATER; };
84         notify yes;
85         file "dynamic/$d.tg06.gathering.org";
86         allow-transfer { 194.19.3.20; 194.0.255.2; };
87 };
88 EOF
89         }
90 }