Support for exporting to an ISC BIND9 name server
authorkhoff <khoff>
Thu, 24 Apr 2003 01:43:10 +0000 (01:43 +0000)
committerkhoff <khoff>
Thu, 24 Apr 2003 01:43:10 +0000 (01:43 +0000)
FS/FS/part_export.pm
bin/bind.export

index a6a67d2..d898d26 100644 (file)
@@ -718,18 +718,30 @@ tie my %vpopmail_options, 'Tie::IxHash',
 ;
 
 tie my %bind_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',
 ;
 
 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',
 ;
 
 tie my %http_options, 'Tie::IxHash',
index 055782a..64d4406 100755 (executable)
@@ -30,6 +30,10 @@ foreach my $export ( @exports ) {
   my $machine = $export->machine;
   my $prefix = "$spooldir/$machine";
 
   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: $!";
 
   #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: $!";
 
       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 (
       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;
 
   } ) 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 $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: $!";
 
   #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;
 
   } ) 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;
 
 }
 close NAMED_CONF;