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

8/22/2022 - Mon
Steve Bink

@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.
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
Steve Bink

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
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.
Your help has saved me hundreds of hours of internet surfing.
fblack61