Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I believe it's possible to configure Apache to use SQL Server for authentication. You supply the DB connection parameters and a query to run. I suppose the contract is something like:

If the query returns something the user is authenticated, and if the query results are empty, the user is unkown.

Does anyone know how I can configure this?

share|improve this question

2 Answers 2

I just figured this out for Apache 2.4 on Windows 2012. I think the changes would be minor for Apache 2.2.

Uncomment the necessary LoadModule lines in httpd.conf:

  • authn_dbd_module
  • authn_dbm_module
  • dbd_module

Make an ODBC connection to the SQL Server:
ODBC Data Source Administrator, System DNS, Add..., Fill in your specific information, and remember the "Name" for later.

Configure authentication in Apache:

DBDriver odbc
DBDParams "datasource=<Name here>,user=...,password=..."

<Location /secure>
   AuthType Basic 
   AuthName "Secure Area" 
   AuthBasicProvider dbd
   Require valid-user
   AuthDBDUserPWQuery "SELECT '$apr1$' + PasswordSalt + '$' + Password FROM <your table> WHERE UserName = %s"
</Location>

Hope it gets you going in the right direction.

share|improve this answer

I don't know if mssql is supported. Maybe if you add it to pam and then go through that. mod_auth_mysql is for mysql, mod_auth_pgsql for postgresql and mod_auth_dbi for generic db intefrace.

share|improve this answer
    
what's the pam ? –  Dónal Dec 20 '10 at 16:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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