source: trunk/DNSDB/ExportBIND.pm@ 848

Last change on this file since 848 was 848, checked in by Kris Deugau, 21 months ago

/trunk

BIND export, unwinding dev saves, 1 of many many

  • Sketch out view configuration export
  • Property svn:keywords set to Date Rev Author Id
File size: 2.0 KB
Line 
1# dns/trunk/DNSDB/ExportBIND.pm
2# BIND data export/publication
3# Call through DNSDB.pm's export() sub
4##
5# $Id: ExportBIND.pm 848 2022-09-01 16:43:41Z kdeugau $
6# Copyright 2022 Kris Deugau <kdeugau@deepnet.cx>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20##
21
22package DNSDB::ExportBIND;
23
24use strict;
25use warnings;
26
27sub export {
28 # expected to be a DNSDB object
29 my $self = shift;
30 my $dbh = $self->{dbh};
31
32 # allow for future exports of subgroups of records
33 my $viewlist = $dnsdb->getLocList(curgroup => 1);
34
35 # Write the view list to a configuration fragment
36 if ($viewlist) {
37 foreach my $view (@{$viewlist}) {
38#print Dumper($view);
39# print BINDCONF "view $view->{location} {\n";
40 print "view $view->{location} {\n";
41 # could also use an acl { ... }; statement, then match-clients { aclname; };, but that gets hairy
42 # note that some semantics of data visibility need to be handled by the record export, since it's
43 # not 100% clear if the semantics of a tinydns view with an empty IP list (matches anyone) are the
44 # same as a BIND view with match-clients { any; };
45 if ($view->{iplist}) {
46# print BINDCONF " match-clients { ".join("; ", $view->iplist)."; };\n";
47 print " match-clients { ".join("; ", split(/[\s,]+/, $view->{iplist}))."; };\n";
48 } else {
49# print BINDCONF " match-clients { any; };\n"
50 print " match-clients { any; };\n"
51 }
52 print "};\n\n";
53 } # foreach @$viewlist
54 } # if $viewlist
55
56} # export()
57
581;
Note: See TracBrowser for help on using the repository browser.