Apache2Triad Help, Support and Development Forum Index Apache2Triad Help, Support and Development
The apache2triad help , support and development forums

Click here to go to the original topic

       Apache2Triad Help, Support and Development Forum Index -> Apache
View previous topic :: View next topic  
Author Message

Joined: 11 Dec 2003
Posts: 17

Posted: Mon Jul 26, 2004 5:25 am    Post subject: mod_auth_digest  

mancini, does using mod_auth_digest help me any in my efforts to automate creation of the .htpasswd ? meaning I last posted that I was attempting to use perl or php scripts to automatically add username/pass from a webpage, it appends everything ok to the .htaccess/.htpasswd files no problem, problem was when I tried the password, wouldnt work, unless i wiped out the "encrypted" password from the .htaccess file and typed it in clear text (which is not what i want to do) - running win2k box.

Cant boast enough about you here... :-P wish I had you as a neighbor !!
Back to top  

Joined: 14 Jul 2004
Posts: 27
Location: Good `ol Georgia

Posted: Mon Jul 26, 2004 4:19 pm    Post subject:  

I know this was direct to marchi(sorry if i misspelled). did you make sure the hashing is correct when you entered the password i know you said it inserted it. But from what i understand is if your program doesnt use the right type of crypt key the program that will be using it wont know what it is/understand/decrypt it.
any way im just trying to help so if im wrong sorry but thats how i understood it. (also if i am can you post what i am suppoced to do 8) ) i like to know things.
Back to top  

Joined: 11 Dec 2003
Posts: 17

Posted: Mon Jul 26, 2004 10:38 pm    Post subject:  

ok, here is my php files in zip format

my path to multiple domains is:

c:/apache2traid/htdocs/domains (this dir contains tester.com as test domain)


Back to top  
Vlad Alexa Mancini

Joined: 07 Jul 2003
Posts: 1539

Posted: Tue Jul 27, 2004 6:11 am    Post subject:  

the problem with your script is that you don't understand how to use crypt() to generate a htpasswd hash

you use : $pwd=crypt($par[password1]);

according to http://php.net/crypt for the generated password to be the same as the output of
Quote: htpasswd_exe -b htpasswd_file user password
apache htpasswd file, you'll need to use the first two letters of the password as the salt.

should use :
Code: <?php
$pwd = crypt($password, substr($password, 0, 2));

and this is in theory

the actual fact is that the format of the htpassswd output is furthermore different and that is why we use in our scripts

Quote: system("$htpasswd_exe -b $htpasswd_file root $hpassword");

and that is what i recomend

other than that feel free to use mod_auth_digest in exchange for this , but it might be a little more complicated
Back to top  
       Apache2Triad Help, Support and Development Forum Index -> Apache
Page 1 of 1

Powered by phpBB Search Engine Indexer
Powered by phpBB 2.0.13 © 2001, 2002 phpBB Group