/usr/bin/ldappasswd2 is in debian-edu-config 1.702.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #!/usr/bin/perl
#
# Tool to set a new admin password in LDAP. Written by Torstein
# Svendsen.
#
# If the LDAP admin password is lost, use rootdn and rootpw in
# /etc/ldap/slapd.conf to get an override password able to set a new
# password.
#
# Check out ldappasswd from ldap-utils to see if it can replace this
# program.
use strict;
use warnings;
use Net::LDAP;
use vars qw($dn $password $md4password $ldaphost);
$ldaphost = 'ldap';
$dn = 'cn=admin,ou=ldap-access,dc=skole,dc=skolelinux,dc=no';
$password = 'secret'; # Current passord in clear text
$md5password = '$1$ubzu8/wx$KuUO3OtpjbXu74d67vqyI/'; # new password hash
my $ldap = new Net::LDAP($ldaphost);
my $mesg = $ldap->bind(
'dn' => $dn,
'password' => $password
);
die("Wrong password!") unless ( 0 == $mesg->code );
my $md5 = '{crypt}'. $md5password;
$ldap->modify(
$dn,
'replace' => {
'userPassword' => $md5,
}
);
|