diff options
author | khoff <khoff> | 2003-04-24 01:43:10 +0000 |
---|---|---|
committer | khoff <khoff> | 2003-04-24 01:43:10 +0000 |
commit | 2c0751312ced1bcbcfa0907393895fb19d25c280 (patch) | |
tree | 8f3fdfedcd9b0364c6a2ea9e8b8d606e85dfc77e | |
parent | d540445a9a35750e1127e3854ecba420d588a022 (diff) |
Support for exporting to an ISC BIND9 name server
-rw-r--r-- | FS/FS/part_export.pm | 30 | ||||
-rwxr-xr-x | bin/bind.export | 15 |
2 files changed, 34 insertions, 11 deletions
diff --git a/FS/FS/part_export.pm b/FS/FS/part_export.pm index a6a67d2..d898d26 100644 --- a/FS/FS/part_export.pm +++ b/FS/FS/part_export.pm @@ -718,18 +718,30 @@ tie my %vpopmail_options, 'Tie::IxHash', ; tie my %bind_options, 'Tie::IxHash', - #'machine' => { label=>'named machine' }, - 'named_conf' => { label => 'named.conf location', - default=> '/etc/bind/named.conf' }, - 'zonepath' => { label => 'path to zone files', - default=> '/etc/bind/', }, + #'machine' => { label=>'named machine' }, + 'named_conf' => { label => 'named.conf location', + default=> '/etc/bind/named.conf' }, + 'zonepath' => { label => 'path to zone files', + default=> '/etc/bind/', }, + 'bind_release' => { label => 'ISC BIND Release', + type => 'select', + options => [qw(BIND8 BIND9)], + default => 'BIND8' }, + 'bind9_minttl' => { label => 'The minttl required by bind9 and RFC1035.', + default => '1D' }, ; tie my %bind_slave_options, 'Tie::IxHash', - #'machine' => { label=> 'Slave machine' }, - 'master' => { label=> 'Master IP address(s) (semicolon-separated)' }, - 'named_conf' => { label => 'named.conf location', - default => '/etc/bind/named.conf' }, + #'machine' => { label=> 'Slave machine' }, + 'master' => { label=> 'Master IP address(s) (semicolon-separated)' }, + 'named_conf' => { label => 'named.conf location', + default => '/etc/bind/named.conf' }, + 'bind_release' => { label => 'ISC BIND Release', + type => 'select', + options => [qw(BIND8 BIND9)], + default => 'BIND8' }, + 'bind9_minttl' => { label => 'The minttl required by bind9 and RFC1035.', + default => '1D' }, ; tie my %http_options, 'Tie::IxHash', diff --git a/bin/bind.export b/bin/bind.export index 055782a..64d4406 100755 --- a/bin/bind.export +++ b/bin/bind.export @@ -30,6 +30,10 @@ foreach my $export ( @exports ) { my $machine = $export->machine; my $prefix = "$spooldir/$machine"; + my $bind_rel = $export->option('bind_release'); + my $ndc_cmd = ($bind_rel eq 'BIND9') ? 'rndc' : 'ndc'; + my $minttl = $export->option('bind9_minttl'); + #prevent old domain files from piling up #rmtree "$prefix" or die "can't rmtree $prefix.db: $!"; @@ -79,6 +83,10 @@ END open (DB_MASTER,">$prefix/db.$domain") or die "can't open $prefix/db.$domain: $!"; + if ($bind_rel eq 'BIND9') { + print DB_MASTER "\$TTL $minttl\n\$ORIGIN $domain.\n"; + } + my @domain_records = qsearch('domain_record', { 'svcnum' => $svc_domain->svcnum } ); foreach my $domain_record ( @@ -114,7 +122,7 @@ END } ) or die "rsync to $machine failed: ". join(" / ", $rsync->err); # warn $rsync->out; - ssh("root\@$machine", 'ndc reload'); + ssh("root\@$machine", "$ndc_cmd reload"); } @@ -125,6 +133,9 @@ foreach my $sexport ( @sexports ) { #false laziness with above my $machine = $sexport->machine; my $prefix = "$spooldir/$machine"; + my $bind_rel = $sexport->option('bind_release'); + my $ndc_cmd = ($bind_rel eq 'BIND9') ? 'rndc' : 'ndc'; + #prevent old domain files from piling up #rmtree "$prefix" or die "can't rmtree $prefix.db: $!"; @@ -166,7 +177,7 @@ END } ) or die "rsync to $machine failed: ". join(" / ", $rsync->err); # warn $rsync->out; - ssh("root\@$machine", 'ndc reload'); + ssh("root\@$machine", "$ndc_cmd reload"); } close NAMED_CONF; |