quirky problem with mod_authn_dbd. urgent!

Discussion in 'Apache' started by php6, Jul 18, 2010.

  1. #1
    Hello,
    I am having somewhat of an odd problem.

    Lets start off with some reference.

    The httpd version:

    [root@chorme ~]# httpd -v
    Server version: Apache/2.2.8 (Unix)
    Server built:   Sep 15 2008 20:14:32
    Code (markup):
    My authn modules:

    LoadModule authn_dbd_module modules/mod_authn_dbd.so
    LoadModule auth_basic_module modules/mod_auth_basic.so
    LoadModule auth_digest_module modules/mod_auth_digest.so
    LoadModule authn_file_module modules/mod_authn_file.so
    LoadModule authn_alias_module modules/mod_authn_alias.so
    LoadModule authn_anon_module modules/mod_authn_anon.so
    LoadModule authn_dbm_module modules/mod_authn_dbm.so
    LoadModule authn_default_module modules/mod_authn_default.so
    Code (markup):
    Located in my httpd.conf:

    DBDriver        mysql
    DBDParams       "host=4.3.2.1 user=htpw_user pass=htpw_pass dbname=htpw_db"
    DBDMin          10
    DBDKeep         10
    DBDMax          10
    DBDExptime      300
    Code (markup):
    Located in my virtual host config:

    <VirtualHost 4.3.2.1:80>
        ServerName xyz.com
        ServerAlias www.xyz.com
        ServerAdmin webmaster@xyz.com
        DocumentRoot /home/xyz-com/public_html/members
        ScriptAlias /cgi-bin/ /home/xyz-com/public_html/cgi-bin/
    </VirtualHost>
    
    <Directory /home/xyz-com/public_html/members>
            AuthType Basic
            AuthName "Members"
            AuthBasicProvider dbd
            AuthDBDUserPWQuery "SELECT `ht_password` FROM `htpw` WHERE `ht_username` = %s"
            Require valid-user
    </Directory>
    Code (markup):
    When I visit http://xyz.com/members I am prompted with the familiar authentication popup. It will work for the first couple of times, however after some time (around 10 minutes) my username, "user1" and others will become unable to log in. This is what is happening in my error_log:

    NOTE: The authentication works 100% perfect after a fresh restart of httpd. Once it starts acting up, I have to restart httpd for it to work again.

    [Sat Jul 18 20:05:30 2010] [error] [client 1.2.3.4] Error looking up user1 in database, referer: http://xyz.com/
    [Sat Jul 18 20:05:30 2010] [error] [client 1.2.3.4] Error looking up user1 in database
    Code (markup):
    And this is what I see when I log in: http://imgyes.com/images/sd.jpg

    I am not sure what causes this to happen over time and I have found zero documentation relating to my problem.

    Can anyone provide some insight as to what is going on? This is an urgent matter and if someone is willing to help me one on one, I am willing to pay.

    If you need any more details about my server, please ask.

    ---------

    I also have one other question about mod_authn_dbd.

    What happens when I have to use different mysql databases for websites. I am not allowed to put the directives specifying which database to use in virtual host configuration. They are only allowed in global. Any ideas on this?
     
    php6, Jul 18, 2010 IP
  2. madaboutlinux

    madaboutlinux Member

    Messages:
    250
    Likes Received:
    7
    Best Answers:
    2
    Trophy Points:
    43
    #2
    Do you mean every user cannot login in from the 10 minutes of his own login time? And you need to restart the Apache service to make it work?

    Do you receive any Mysql errors in the mysql logs? The log file by default is under /var/lib/mysql/ directory.

    And why don't you use 'localhost' instead of the server IP in "DBDParams" directive?
     
    madaboutlinux, Jul 18, 2010 IP
  3. php6

    php6 Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    After ~10 minutes of a fresh httpd restart, the module completely stops working.

    There are no mysql errors thrown.

    I cannot use localhost since we use an external mysql server configuration. Sorry I have the IPs the same in my example.
     
    php6, Jul 18, 2010 IP
  4. php6

    php6 Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    urgent bump
     
    php6, Jul 20, 2010 IP
  5. madaboutlinux

    madaboutlinux Member

    Messages:
    250
    Likes Received:
    7
    Best Answers:
    2
    Trophy Points:
    43
    #5
    Have someone look into your server as it is pretty difficult to guess where the problem is.
     
    madaboutlinux, Jul 20, 2010 IP