2

So I installed mod_auth_mysql via the following:

sudo apt-get install libapache2-mod-auth-mysql 
sudo a2enmod auth_mysql 
sudo /etc/init.d/apache2 restart

I updated my .htaccess file to make it connect to the DB as well but it's not working. Here's what I'm getting in the error logs:

[Wed Aug 07 16:35:23 2013] [error] [client xxx.xxx.xxx.xxx] user username not found: /admin/, referer: https://www.domain.tld/

The username very definitely does exist. If I do SELECT * FROM userTable WHERE userName = 'username' it comes up. So I'm at a bit of a loss.

Is there a way I could see the SQL mod_auth_mysql is generating?

From my .htaccess file...

AuthBasicAuthoritative Off
AuthUserFile /dev/null
Auth_MYSQL On
Auth_MySQL_Host localhost
Auth_MySQL_User username
Auth_MySQL_Password password
Auth_MySQL_Authoritative On
Auth_MySQL_DB "dbname"
Auth_MySQL_Password_Table "apache_auth"
Auth_MySQL_Username_Field username
Auth_MySQL_Password_Field password
Auth_MySQL_Group_Field group
Auth_MySQL_Encryption_Types Plaintext

Any ideas?

0

To see what queries are produced by auth_mysql, it is best to log queries via mysql query log and inspect there what exactly is going on.

I had similar problems, finnaly got auth_mysql working up using this configuration:

AuthType                        Basic
AuthName                        "Access Authorization"
AuthUserFile                    /dev/null
AuthGroupFile                   /dev/null
AuthBasicAuthoritative          Off
AuthMYSQL                       On
AuthMySQL_Authoritative         On
AuthMySQL_Non_Persistent        On
AuthMySQL_Socket                /var/run/mysqld/mysqld.sock
AuthMySQL_DB                    my_database_name
AuthMySQL_User                  my_database_user_name
AuthMySQL_Password              my_database_user_pass
AuthMySQL_Group_Table           groups
AuthMySQL_Group_User_Field      user
AuthMySQL_Group_Field           project_group
AuthMySQL_Password_Table        users
AuthMySQL_Username_Field        name
AuthMySQL_Password_Field        pass
AuthMySQL_Empty_Passwords       off
AuthMySQL_Encryption_Types      Crypt_DES

require group admin #requirement on group, valid_user,...

and mysql tables:

CREATE TABLE `groups` (
 `user` varchar(48) NOT NULL,
 `project_group` varchar(255) NOT NULL,
 KEY `group` (`project_group`),
 KEY `user` (`user`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE `users` (
 `name` varchar(48) NOT NULL,
 `pass` varchar(255) NOT NULL COMMENT 'Crypt_DES',
 `email` varchar(255) NOT NULL,
 `country_limits` varchar(255) DEFAULT NULL,
 PRIMARY KEY (`name`),
 KEY `pass` (`pass`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

Hope this will help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.