Mod_auth_mysql Installation on Centos 7 and Apache

0
44
How to install mod_auth_mysql

What Is Mod_Auth_Mysql?mod_auth_mysql is an Apache module used for authenticating users against a MySQL database. It is commonly used to protect items on a website via a user login prompt. The module is able to authenticate against a  MySQL database to check for a valid username and password, it supports various encryption methods. You can view more about it on the project page.This guide assumes you already have a working MySQL installation and Apache is already installed.  If you do not have Apache installed please see our guide on How To Install ApacheInstall mod_auth_mysqlThe last version of the module was created was designed for Apache 2.0 (we will show you how to patch it for 2.2 and 2.4 as well) First change to a download directorycd /usr/srcGet the packagewget https://github.com/linuxadminio/mod_auth_mysql/raw/master/mod_auth_mysql-3.0.0.tar.gzExtract the packagetar xfvz mod_auth_mysql-3.0.0.tar.gzGo into the directorycd mod_auth_mysql-3.0.0If you only have Apache 2.0 you can skip the next few steps, if you have 2.2 or 2.4 get the patchhttps://raw.githubusercontent.com/linuxadminio/mod_auth_mysql/master/mod_auth_mysql-300-apache-22.patchPatch mod_auth_mysql for Apache 2.2patch < mod_auth_mysql-300-apache-22.patchIf you have Apache 2.4, you will need to perform one more step. Open up mod_auth_mysql.cnano mod_auth_mysql.cChange the following linesline 908 fromreturn r->connection->remote_ip;Toreturn r->connection->client_ip;Line 1273  from:const apr_array_header_t *reqs_arr = ap_requires(r);To:const apr_array_header_t *reqs_arr = NULL;Line 1275 from:const array_header *reqs_arr = ap_requires(r);To:const array_header *reqs_arr = NULL;Go ahead and compile itapxs -c -L/usr/lib/mysql -I/usr/include/mysql -lmysqlclient -lm -lz mod_auth_mysql.cYou should now be able to load the module in your httpd.confnano /etc/httpd/conf/httpd.confand add the following lineLoadModule mysql_auth_module modules/mod_auth_mysql.soGo ahead and restart apacheservice httpd restartIt should restart successfully and you should be able to use mod_auth_mysql to authenticate now.  Aug 17, 2017LinuxAdmin.io 3.5 2 votesArticle Rating

LEAVE A REPLY

Please enter your comment!
Please enter your name here