]> git.sesse.net Git - nms/blob - config/make-named.pl
Remove the split stuff from make-named.pl.
[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; 194.0.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 { 194.0.255.2; };
47 };
48
49 // serversubnett
50 zone "255.76.87.in-addr.arpa" {
51         type master;
52         file "255.76.87.in-addr.arpa";
53         notify yes;
54         allow-transfer { 194.0.255.2; 193.0.0.0/22; };
55 };
56
57 zone "76.87.in-addr.arpa" {
58         type master;
59         allow-update { key DHCP_UPDATER; };
60         notify yes;
61         file "dynamic/76.87.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 F388UOhaIIKHRH9TDE5PTA==;
68 };
69
70 EOF
71
72 for my $net (@nets) {
73         my $domain = $net->{name};
74         print <<"EOF";
75 zone "$domain.tg07.gathering.org" {
76         type master;
77         allow-update { key DHCP_UPDATER; };
78         notify yes;
79         file "dynamic/$domain.tg07.gathering.org";
80         allow-transfer { 194.19.3.20; 194.0.255.2; };
81 };
82 EOF
83 }