[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Creating user SHA1 passwords in ldif file
- To: openldap-software@OpenLDAP.org
- Subject: Creating user SHA1 passwords in ldif file
- From: tsg <tsg@bugalux.com>
- Date: Fri, 15 Aug 2003 15:21:11 +0200
- Content-disposition: inline
- Organization: bugalux
- User-agent: KMail/1.5.3
Hi!
I am going to populate LDAP directory with some users before first start LDAP
server, so I have prepared a ldif file:
dn: uid=admin,ou=Users,dc=example,dc=com
cn: admin
sn: admin
uid: admin
description: Server Administrator
objectClass: inetOrgPerson
userPassword: {SSHA}TZlgO8QsHJAUpEPvrA90RwAM1HJ1emhubHZ0dQ==
where I got password from perl script:
sub password_ssha {
my $pass=$_[0];
my ($hashedPasswd,$salt);
$salt = &get_salt8;
my $ctx = Digest::SHA1->new;
$ctx->add($pass);
$ctx->add($salt);
$hashedPasswd = '{SSHA}' . encode_base64($ctx->digest . $salt,'');
return($hashedPasswd);
}
sub get_salt8 {
my $salt = join '', ('a'..'z')[rand 26,rand 26,rand 26,rand 26,rand
26,rand 26,rand 26,rand 26];
return($salt);
}
Script works, if I use it to add users to working server with pwrl-ldap
package, But in this case, server does not understand password I got.
If I change password with ldappassword, things became normal.
Could you please point me where I am whong!
Sergios