Hello.
I am trying to enable mod_auth_mysql for a while but it doesn't work. I looked at all examples, that I could find but they just don't work for me.
Apache version: Apache/2.0.54 (Debian GNU/Linux)
Mysql version: mysql Ver 12.22 Distrib 4.0.24, for pc-linux-gnu (i386)
Steps:
1. I installed mod_auth_mysql
$ apt-get install libapache2-mod-auth-mysql
$ cd /etc/apache2/mods-enabled/
$ ln -s /etc/apache2/mods-available/auth_mysql.load .
2. mod_auth_mysql is successfully installed:
Among modules I can see
Module Name: mod_auth_mysql.c
Content handlers: none
Configuration Phase Participation: Create Directory Config
Request Phase Participation: Verify User ID, Verify User Access
Module Directives:
...
3. I created mysql table with auth data:
I already have user bugs:bugs for bugzilla account
$ mysql -u root -p
mysql> grant all on auth.* to bugs@localhost;
mysql> flush privileges;
mysql> create database auth;
mysql> use auth;
mysql>CREATE TABLE `clients` (
`username` varchar(25) NOT NULL default '',
`passwd` varchar(25) NOT NULL default '',
`groups` varchar(25) NOT NULL default '',
PRIMARY KEY (`username`),
KEY `groups` (`groups`)
) ENGINE=MyISAM;
mysql> INSERT INTO `clients` VALUES ('username1', 'password1', 'group1');
4. I added https directory to apache conf
Alias /http/ "/home/user/http/"
<Directory "/home/user/http/">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
AuthType Basic
AuthName "Test http dir"
AuthUserFile /home/user/http/.mysql.passwd
Require valid-user
</Directory>
5. I created file /home/user/http/.mysql.passwd (root:root, permissions 644)
AuthMySQL on
AuthMySQL_Authoritative on
AuthMySQL_Host localhost
AuthMySQL_User bugs
AuthMySQL_Password bugs
AuthMySQL_DB auth
AuthMySQL_Password_Table clients
AuthMySQL_Group_Table clients
AuthMySQL_Empty_Passwords off
AuthMySQL_Encryption_Types Plaintext Crypt_DES
6. restart apache2
/etc/init.d/apache2 restart
When I try to open I get username, password dialog. I enter username: username1 and password: password1.
It doesn't work. Log file /var/log/apache2 has following entry:
[Wed May 10 11:19:34 2006] [error] [client 10.110.10.124] user username1 not found: /http/
If I change contents in .mysql.passwd with htpasswd2 entry (htpasswd -c .mysql.passwd <username>) for username and password authentication is sucessful. So obviously there should be no troubles with reading of mysql configuration in file.
I also don't know where could I get more detailed error log. Error log from /var/log/apach2/error.log just doesn't provide enough information.
I actualy need authentication for svn and bugzilla integration but when I couldn't get it to work I tried with simple directory and my own table but here the problem was the same.
Thanks
I am trying to enable mod_auth_mysql for a while but it doesn't work. I looked at all examples, that I could find but they just don't work for me.
Apache version: Apache/2.0.54 (Debian GNU/Linux)
Mysql version: mysql Ver 12.22 Distrib 4.0.24, for pc-linux-gnu (i386)
Steps:
1. I installed mod_auth_mysql
$ apt-get install libapache2-mod-auth-mysql
$ cd /etc/apache2/mods-enabled/
$ ln -s /etc/apache2/mods-available/auth_mysql.load .
2. mod_auth_mysql is successfully installed:
Among modules I can see
Module Name: mod_auth_mysql.c
Content handlers: none
Configuration Phase Participation: Create Directory Config
Request Phase Participation: Verify User ID, Verify User Access
Module Directives:
...
3. I created mysql table with auth data:
I already have user bugs:bugs for bugzilla account
$ mysql -u root -p
mysql> grant all on auth.* to bugs@localhost;
mysql> flush privileges;
mysql> create database auth;
mysql> use auth;
mysql>CREATE TABLE `clients` (
`username` varchar(25) NOT NULL default '',
`passwd` varchar(25) NOT NULL default '',
`groups` varchar(25) NOT NULL default '',
PRIMARY KEY (`username`),
KEY `groups` (`groups`)
) ENGINE=MyISAM;
mysql> INSERT INTO `clients` VALUES ('username1', 'password1', 'group1');
4. I added https directory to apache conf
Alias /http/ "/home/user/http/"
<Directory "/home/user/http/">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
AuthType Basic
AuthName "Test http dir"
AuthUserFile /home/user/http/.mysql.passwd
Require valid-user
</Directory>
5. I created file /home/user/http/.mysql.passwd (root:root, permissions 644)
AuthMySQL on
AuthMySQL_Authoritative on
AuthMySQL_Host localhost
AuthMySQL_User bugs
AuthMySQL_Password bugs
AuthMySQL_DB auth
AuthMySQL_Password_Table clients
AuthMySQL_Group_Table clients
AuthMySQL_Empty_Passwords off
AuthMySQL_Encryption_Types Plaintext Crypt_DES
6. restart apache2
/etc/init.d/apache2 restart
When I try to open I get username, password dialog. I enter username: username1 and password: password1.
It doesn't work. Log file /var/log/apache2 has following entry:
[Wed May 10 11:19:34 2006] [error] [client 10.110.10.124] user username1 not found: /http/
If I change contents in .mysql.passwd with htpasswd2 entry (htpasswd -c .mysql.passwd <username>) for username and password authentication is sucessful. So obviously there should be no troubles with reading of mysql configuration in file.
I also don't know where could I get more detailed error log. Error log from /var/log/apach2/error.log just doesn't provide enough information.
I actualy need authentication for svn and bugzilla integration but when I couldn't get it to work I tried with simple directory and my own table but here the problem was the same.
Thanks