General
cancel
Showing results for 
Search instead for 
Did you mean: 

MySQL, Apache authentication

Nico van Royen
Frequent Advisor

MySQL, Apache authentication

Hey there.
I'm getting some difficulties getting apache to authenticate users through mod_auth_mysql.
I'm running own-build apache 2 (2.0.43) with build mod_auth_mysql. Thinking that all is installed ok, compiling went ok.. but....

using the .htaccess listed here:
-- .htaccess
AuthName "My Authorization"
AuthType Basic
AuthMySQLHost localhost
AuthMySQLDB auth_db
AuthMySQLUser sql_user
AuthGroupFile /dev/null
AuthMySQLPassword auth_pw
AuthMySQLUserTable auth_users
AuthMySQLNameField uname
AuthMySQLPasswordField pass
AuthMySQLGroupField user_level
AuthMySQLAuthoritative On
AuthMySQLCryptedPasswords on
AuthUserFile /dev/null
require group 1
---

The 'AuthUserFile' (according to many samples/examples/docs I've seen) should not need to be there, but...

without that line I get a:
Internal error: pcfg_openfile() called with NULL filename
[client 145.7.200.27] (9)Bad file descriptor: Could not open password file: (null)
(a server error 500)

and WITH the line it just doesn't find the user (the window asking for username/passwd comes up), but it probably looks inside the AuthUserFile (/dev/null doesn't contain it.. duh).

is there anything I'm missing ? thanks..

-NvR
If all else fails, try reading the manual...
2 REPLIES
Stuart Browne
Honored Contributor

Re: MySQL, Apache authentication

What have you got in your Apache configuration for 'mod_auth_mysql' ?

Check the log files to make sure the module it's self is getting intilised properly.
One long-haired git at your service...
Nico van Royen
Frequent Advisor

Re: MySQL, Apache authentication

Inside the apache config I have:

LoadModule mysql_auth_module modules/mod_auth_mysql.so

The module is loaded ok (afaik).. with the apache handler 'server-info' this is displayed (amongst other things...):
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:
AuthMySQLHost - mysql server host name
AuthMySQLUser - mysql server user name
AuthMySQLPassword - mysql server user password
AuthMySQLDB - mysql database name
AuthMySQLUserTable - mysql user table name
AuthMySQLGroupTable - mysql group table name
AuthMySQLNameField - mysql User ID field name within table
AuthMySQLGroupField - mysql Group field name within table
AuthMySQLPasswordField - mysql Password field name within table
AuthMySQLCryptedPasswords - mysql passwords are stored encrypted if On
AuthMySQLScrambledPasswords - mysql passwords are stored scrambled if On
AuthMySQLKeepAlive - mysql connection kept open across requests if On
AuthMySQLAuthoritative - mysql lookup is authoritative if On
AuthMySQLNoPasswd - If On, only check if user exists; ignore password
AuthMySQLUserCondition - condition to add to user where-clause
AuthMySQLGroupCondition - condition to add to group where-clause
Current Configuration:
--
If all else fails, try reading the manual...