Avatar of projects
projects

asked on 

mod auth mysql - syntax and config help needed

I have a table called htaccess which contains all of the username/passwords for remote access clients.
I dump the contents of this table into a .htpasswd file now and then to keep it updated.

Currently, I am using the standard .htaccess method with an .htpasswd file and it works just fine.
I want to use mysql to maintain and authenticate directly from instead of the .htpasswd file.

So far, no luck what so ever. When looking for information, it gets very confusing very quickly as results keep showing tons of useless syntax combinations which are wrong. I have yet to find the right syntax to put into my .htaccess file to make this work.

That is where I need help.

The server is Centos 6.5.
mysql-5.5.40
httpd-2.2.15
Apache Web ServerMySQL Server

Avatar of undefined
Last Comment
projects
Avatar of Steve Bink
Steve Bink
Flag of United States of America image

@other experts: there is a previous question relevant to this.

@projects: Can you post the httpd.conf and .htaccess file you are attempting to use with mod_auth_mysql?  Just the relevant <VirtualHost> container from httpd.conf will be fine, and feel free to anonymize any sensitive information.
Avatar of projects
projects

ASKER

The current VirtualHost section for this particular server is;

<VirtualHost *:80>
        ServerAdmin support@xxx.com
        DocumentRoot /var/www/vhosts/somehost/html
        ServerName somedomain.com
        ErrorLog  /var/www/vhosts/somehost/logs/error_log
        CustomLog /var/www/vhosts/somehost/logs/access_log combined
#    <Directory /var/www/vhosts/somehost/html>
#        AllowOverride AuthConfig
#    </Directory>
</VirtualHost>

<VirtualHost *:443>
            DocumentRoot "/var/www/vhosts/somehost/html"
            ServerName somedomain.com:443
            ErrorLog /var/www/vhosts/somehost/logs/ssl_error_log
            TransferLog /var/www/vhosts/somehost/logs/ssl_access_log
            LogLevel warn
            SSLEngine on
            SSLProtocol all -SSLv2
            SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW

            SSLCertificateFile /etc/pki/tls/certs/somehost.crt
            SSLCertificateKeyFile /etc/pki/tls/private/somehost.key

            SetEnvIf User-Agent ".*MSIE.*" \
            nokeepalive ssl-unclean-shutdown \
            downgrade-1.0 force-response-1.0
#    <Directory /var/www/vhosts/somehost/html>
#        AllowOverride AuthConfig
#    </Directory>
</VirtualHost>

Open in new window


The last version of .htaccess I had was;

AuthBasicAuthoritative Off
AuthUserFile /dev/null
AuthMySQL On
AuthName "Authentication required"
AuthType Basic
Auth_MySQL_Host localhost
Auth_MySQL_User someuser
Auth_MySQL_Password somepass
AuthMySQL_DB somedb
AuthMySQL_Password_Table htaccess
Auth_MySQL_Username_Field username
Auth_MySQL_Password_Field password
Auth_MySQL_Empty_Passwords Off
Auth_MySQL_Encryption_Types PHP_MD5
Auth_MySQL_Authoritative On
require valid-user

Open in new window


I tried all kinds of things I found on the net, with and without underscroes and dashes and other things including less variables and even more variables. Nothing worked after spending a couple of hours on it so I gave up.
ASKER CERTIFIED SOLUTION
Avatar of Steve Bink
Steve Bink
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of projects
projects

ASKER

Yes, I saw that also, about mod_auth_mysql no longer being supported so there is no value in doing it that way then. I would rather move on to the new accepted way.

Thanks, I guess this fully resolves this question really.
MySQL Server
MySQL Server

MySQL is an open source, relational database management system that runs as a server providing multi-user access to a number of databases. Acquired by Oracle in 2009, it is frequently used in combination with PHP installations, powering most of the WordPress installations.

49K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo