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