[freeside-users] patch bind.export to rsync/ssh as non-root user

Luke S Crawford lsc at prgmr.com
Mon Mar 27 06:32:59 PST 2006


On Fri, 24 Mar 2006, Ivan Kohler wrote:
> The first argument to bind.export is a freeside username.  It doesn't
> necessarily have any relation to system users.  Your patch would break
> every existing installation that uses the BIND export.  Why don't you
> make the remote user an export option instead, and default to "root"?


Whoops,  I attached updated patches for both part_export/bind.pm and 
bin/bind.export that make the remote user an export option, with a default 
of root as you suggested.

>> let me know if this is the wrong place to send patches.
>
> I guess -devel is slightly more appropriate if you're subscribed, but
> here is fine too.


I posted this here to preserve continuity.  My next patch will go to 
-devel.
-------------- next part --------------
*** bind.pm.orig	Mon Mar 27 05:49:17 2006
--- bind.pm	Mon Mar 27 05:50:57 2006
***************
*** 7,12 ****
--- 7,14 ----
  @ISA = qw(FS::part_export::null);
  
  tie %options, 'Tie::IxHash',
+   'ssh_user'   => { label  => 'system user on the dns server',
+                       default=> 'root' },
    'named_conf'   => { label  => 'named.conf location',
                        default=> '/etc/bind/named.conf' },
    'zonepath'     => { label => 'path to zone files',
-------------- next part --------------
*** bind.export.orig	Fri Mar 24 02:35:37 2006
--- bind.export	Mon Mar 27 06:16:45 2006
***************
*** 114,131 ****
    $rsync->exec( {
      src       => "$prefix/",
      recursive => 1,
!     dest      => "root\@$machine:$zonepath/",
      exclude   => [qw( *.import named.conf.HEADER named.conf )],
    } ) or die "rsync to $machine failed: ". join(" / ", $rsync->err);
   # warn $rsync->out;
  
    $rsync->exec( {
      src     => "$prefix/named.conf",
!     dest    => "root\@$machine:". $export->option('named_conf'),
    } ) or die "rsync to $machine failed: ". join(" / ", $rsync->err);
  #  warn $rsync->out;
  
!   ssh("root\@$machine", "$ndc_cmd reload");
  
  }
  
--- 114,131 ----
    $rsync->exec( {
      src       => "$prefix/",
      recursive => 1,
!     dest      => $export->option('ssh_user')."\@$machine:$zonepath/",
      exclude   => [qw( *.import named.conf.HEADER named.conf )],
    } ) or die "rsync to $machine failed: ". join(" / ", $rsync->err);
   # warn $rsync->out;
  
    $rsync->exec( {
      src     => "$prefix/named.conf",
!     dest    => $export->option('ssh_user')."\@$machine:". $export->option('named_conf'),
    } ) or die "rsync to $machine failed: ". join(" / ", $rsync->err);
  #  warn $rsync->out;
  
!   ssh($export->option('ssh_user')."\@$machine", "$ndc_cmd reload");
  
  }
  
***************
*** 178,188 ****
  
    $rsync->exec( {
      src     => "$prefix/named.conf",
!     dest    => "root\@$machine:". $sexport->option('named_conf'),
    } ) or die "rsync to $machine failed: ". join(" / ", $rsync->err);
  #  warn $rsync->out;
  
!   ssh("root\@$machine", "$ndc_cmd reload");
  
  }
  close NAMED_CONF;
--- 178,188 ----
  
    $rsync->exec( {
      src     => "$prefix/named.conf",
!     dest    => $sexport->option('ssh_user')."\@$machine:". $sexport->option('named_conf'),
    } ) or die "rsync to $machine failed: ". join(" / ", $rsync->err);
  #  warn $rsync->out;
  
!   ssh($sexport->option('ssh_user')."\@$machine", "$ndc_cmd reload");
  
  }
  close NAMED_CONF;


More information about the freeside-users mailing list