check_ldap_repl.pl
changeset 1 36f66a013838
parent 0 a04ea5e7c15b
child 3 1be7213b89b1
equal deleted inserted replaced
0:a04ea5e7c15b 1:36f66a013838
    15 #    You should have received a copy of the GNU General Public License
    15 #    You should have received a copy of the GNU General Public License
    16 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
    16 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
    17 #
    17 #
    18 #    Christian Arnold <arnold@schlittermann.de>
    18 #    Christian Arnold <arnold@schlittermann.de>
    19 
    19 
    20 # packages: libnet-ldap-perl
       
    21 # packages: libio-prompt-perl
       
    22 # packages: libio-socket-ssl-perl
       
    23 # packages: libconfig-inifiles-perl
       
    24 # packages: perl-doc (optional - for man page)
       
    25 
       
    26 use strict;
    20 use strict;
    27 use File::Basename;
    21 use File::Basename;
    28 use Getopt::Long;
    22 use Getopt::Long;
    29 use Config::IniFiles;
    23 use Config::IniFiles;
    30 use Net::LDAP;
    24 use Net::LDAP;
    47 	DEPENDENT => 4
    41 	DEPENDENT => 4
    48 );
    42 );
    49 
    43 
    50 my $ME      = basename $0;
    44 my $ME      = basename $0;
    51 my $NAME    = "LDAPREPL";
    45 my $NAME    = "LDAPREPL";
    52 my $VERSION = "0.1";
    46 my $VERSION = "0.2";
    53 
    47 
    54 my %opt = (
    48 my %opt = (
    55 	init	=> 0,
    49 	init	=> 0,
    56 	delete  => 0,
    50 	delete  => 0,
    57 	refresh => 0,
    51 	refresh => 0,
   155 	my $cn = $opt{cn};
   149 	my $cn = $opt{cn};
   156 
   150 
   157 	if ( ($type eq "init") || ($type eq "delete") ) {
   151 	if ( ($type eq "init") || ($type eq "delete") ) {
   158 		$binddn = prompt('BindDN: ');
   152 		$binddn = prompt('BindDN: ');
   159 		$password = prompt('Password: ', -e => '*');
   153 		$password = prompt('Password: ', -e => '*');
       
   154 		if (-r $opt{file}) {
       
   155 			(undef, undef, $master, undef, undef) = read_config();
       
   156 		}
   160 	} else {
   157 	} else {
   161 		if ($opt{binddn} && $opt{password}) {
   158 		if ($opt{binddn} && $opt{password}) {
   162 			$binddn = $opt{binddn};
   159 			$binddn = $opt{binddn};
   163 			$password = $opt{password};
   160 			$password = $opt{password};
   164 		} elsif (-r $opt{file}) {
   161 		} elsif (-r $opt{file}) {
   307 
   304 
   308 =over
   305 =over
   309 
   306 
   310 =item B<-i>|B<--init>
   307 =item B<-i>|B<--init>
   311 
   308 
   312 Add the check object cn=replcheck,I<namingContext> to the master server if not existis. See also the B<--cn> option.
   309 Add the check object cn=replcheck,I<namingContext> to the master server if not exists. See also the B<--cn> option.
   313 You will ask for an B<binddn> and B<password>, if not given B<--binddn> and B<--password> options.
   310 You will ask for an B<binddn> and B<password>, if not given B<--binddn> and B<--password> options.
   314 Your B<binddn> must have write permission to the ldap master server.
   311 Your B<binddn> must have write permission to the ldap master server.
   315 
   312 
   316 =item B<-d>|B<--delete>
   313 =item B<-d>|B<--delete>
   317 
   314 
   318 Delete the check object from the ldap master server if existis. See also the B<--cn> option.
   315 Delete the check object from the ldap master server if exists. See also the B<--cn> option.
   319 You will ask for an B<binddn> and B<password>, if not given B<--binddn> and B<--password> options.
   316 You will ask for an B<binddn> and B<password>, if not given B<--binddn> and B<--password> options.
   320 Your B<binddn> must have write permission to the ldap master server.
   317 Your B<binddn> must have write permission to the ldap master server.
   321 
   318 
   322 =item B<-r>|B<--refresh>
   319 =item B<-r>|B<--refresh>
   323 
   320 
   385 
   382 
   386 This plugin checks if the ldap replication works correctly.
   383 This plugin checks if the ldap replication works correctly.
   387 
   384 
   388 =head1 VERSION
   385 =head1 VERSION
   389 
   386 
   390 This man page is current for version 0.1 of B<check_ldap_repl>.
   387 This man page is current for version 0.2 of B<check_ldap_repl>.
   391 
   388 
   392 =head1 AUTHOR
   389 =head1 AUTHOR
   393 
   390 
   394 Written by Christian Arnold L<arnold@schlittermann.de>
   391 Written by Christian Arnold L<arnold@schlittermann.de>
   395 
   392