NATS4 mod authn dbd
Apache Module mod_authn_dbd allows you to authenticate members against the NATS database.
This has been tested with Apache 2.4
Setting up mod_authn_dbd
Have your host install the apache module mod_authn_dbd on your server if not installed already.
To authenticate using mod_authn_dbd and the NATS database, you or your host would need to adjust the mod_authn_dbd configuraction file(dbd_mysql.conf). The following code consists of specific configuration settings for this module:
DBDriver mysql DBDParams "host=127.0.0.1 port=3306 user=xxUSERxx pass=xxPASSxx dbname=xxDBNAMExx" DBDMin 2 DBDKeep 4 DBDMax 10 DBDExptime 300
Replace "xxUSERxx", "xxPASSxx", and "xxDBNAMExx" with your NATS database username, password, and database name.
Note: For additional security, we suggest creating a separate db user with only the SELECT privilege to the member_auth table.
Turning on mod_authn_dbd
Have your host run the following commands which will activate this module:
a2enmod dbd a2enmod authn_dbd a2enconf dbd_mysql
Adjust Apache Site Configuration file
Once installed and configured, the next step would be to adjust the Apache Site configuration for the site in question. The following code consists of an example providing specific configuration settings for this module for a site:
<Directory /path/to/the/members/section> AuthName "You Must Login" AuthType Basic AuthBasicProvider dbd AuthDBDUserPWQuery "SELECT cryptpass FROM member_auth WHERE username = %s AND siteid = xxSiteidxx" Require valid-user </Directory>
Replace X in "siteid=xxSiteidxx" with the ID number of the site you would like to affect. If you would like to use a single member's area for all of your sites, simply remove "AND siteid=xxSiteidxx" from the line. For more options and information, please see our Multisite Access article.