[Date Prev][Date Next] [Chronological] [Thread] [Top]

RE : how to generate passwords?



Well here is the script I made, don't laugh I'm not a good programmer
and I just made that in like a few minutes. I don't think it's secure or
anything like that but at least it works and that's what I needed for
now.

Thanks to all who helped me.

Jean-Rene Cormier



<?php
$ds=ldap_connect("localhost");

if ($ds) {
 
$r=ldap_bind($ds,"uid=$username,ou=People,dc=yourdomain,dc=com","$oldpas
s");

if ($r == 1) {
if ($newpass1 == $newpass2) {
if ($newpass1 != $null) {
$info["userPassword"] = rtrim(shell_exec("/usr/sbin/slappasswd -h
{crypt} -s $newpass1"));
$info["lmPassword"] = rtrim(shell_exec("/usr/bin/mkntpwd -L
$newpass1"));
$info["ntPassword"] = rtrim(shell_exec("/usr/bin/mkntpwd -N
$newpass1"));

$mod_r =
ldap_mod_replace($ds,"uid=$username,ou=People,dc=yourdomain,dc=com",
$info);
 
echo "You password has been changed";
} else {
echo "You need to place a new password";
}
} else {
echo "The password doesn't match";
}
} else {
echo "Password is incorrect";
}
ldap_close($ds);
} else {
echo "Can't connect to LDAP server.";
}
?>







-----Message d'origine-----
De : owner-openldap-software@OpenLDAP.org
[mailto:owner-openldap-software@OpenLDAP.org] De la part de tarjei@nu.no
Envoyé : 20 mars, 2002 09:24
À : openldap-software@OpenLDAP.org
Objet : Re: how to generate passwords?

You may also take a look at the mkntpass program. I think it's fairly 
easy to find if you read any of the samba-tng w/ldap howtos.

PS: I would apreciate if the finished phpscript would be made available 
to me (and the general public).


Yours,

Tarjei Huse

ivan wrote:

>On Tue, 19 Mar 2002, Jean-Rene Cormier wrote:
>
>I do not know much about PHP, but if you running linux (e.g RH 7.2 you
can 
>use mkpasswd to get a random string and pass it crypt to generate
encrypted 
>password.
>
>
>
>>I've set up OpenLDAP to do user authentication for a server and now
I'm
>>trying to make a script so user could change their password from the
web
>>in PHP but I can generate the password using the crypt function in PHP
>>and putting {crypt}whateverpassword  in the userPassword attribute and
I
>>can log in using SSH but I can't bind using the script I made anymore.
>>Anybody could help me with a way to generate passwords in PHP? And
also
>>how do you generate password for the lmPassword and ntPassword? Thanks
>>
>> 
>>
>>Jean-Rene Cormier
>>
>>
>