The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Mod_auth_mysql

Discussion in 'General Discussion' started by soundguy, Dec 20, 2008.

  1. soundguy

    soundguy Well-Known Member
    PartnerNOC

    Joined:
    Oct 29, 2003
    Messages:
    52
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    seattle
    Has anyone else had a problem with the new httpd.conf format created by easyapache3 with regards to running mod_auth_mysql?

    In the olden days, It was a simple installation with

    LoadModule mysql_auth_module libexec/mod_auth_mysql.so

    located at the end of the LoadModule list and then

    AddModule mod_auth_mysql.c

    Placed at the very top of the AddModule list, directly under ClearModuleList. These locations are critical if you want to use mod_auth_mysql but still retain the use of other authentication methods. If mod_auth_mysql is loaded last, it will kill all other forms of authentication.

    Unfortunately, with the new insanely disorganized and confusing httpd.conf format, I haven't got the slightest idea what's going on anymore and ClearModuleList is no longer used, so I can't correctly order the modules to make things work like they did in the past. The vast majority of the include files that are allegedly used to dynamically construct the working httpd.conf don't actually exist or are completely empty, so I don't have any reference points to work with.

    So my question is this: Is it possible to somehow control the loading order of Apache add-on modules with the new httpd.conf format? I really need to have standard .htpasswds style Basic auth as well as mysql auth working together on the same machine and the only way to accomplish that is to load mod_auth_mysql first.
     
  2. Voltar

    Voltar Well-Known Member

    Joined:
    Apr 30, 2007
    Messages:
    269
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Bakersfield, California
    You could try adding LoadModule to /usr/local/apache/conf/includes/pre_main_global.conf

    I'm not sure where you could put AddModule, I haven't used the new EasyApache setup with Apache 1.3.x.
     
  3. soundguy

    soundguy Well-Known Member
    PartnerNOC

    Joined:
    Oct 29, 2003
    Messages:
    52
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    seattle
    Well, it was a nice thought, but that file apparently still loads AFTER everything else. I need a way to load mod_auth_mysql before mod_auth and mod_auth_passthrough, which I guess are built-ins. They really screwed me when they took out ClearModuleList and the AddModule section.

    What I REALLY need is for cPanel to include mod_auth_mysql as an optional module in EasyApache as it should have been years ago. They include all kinds of experimental and completely useless crap that no one in their right mind would ever install on a production machine and yet they omit arguably the most useful and powerful authentication module available. Makes no sense to me.
     
  4. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,461
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Please investigate:

    http://easyapache.cpanel.net/custom.pl
    http://easyapache.cpanel.net/optmods/custom_opt_mod-mod_auth_mysql.tar.gz
     
  5. soundguy

    soundguy Well-Known Member
    PartnerNOC

    Joined:
    Oct 29, 2003
    Messages:
    52
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    seattle
    Well, this would be an awesome development, except for the fact that the target directory these custom mods are supposed to live in (/var/cpanel/easy/apache/custom_opt_mod) does not exist. In fact /var/cpanel does not exist.(Centos 5.1) Are we supposed to manually create this entire directory nest as part of the installation or are my servers missing some key component that needs to be installed before EasyApache can use custom mods?
     
  6. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,461
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    If the /var/cpanel directory does not exist then something is very wrong with your installation. I recommend opening a support ticket regarding this.
     
  7. C4talyst

    C4talyst Well-Known Member

    Joined:
    Jun 21, 2008
    Messages:
    56
    Likes Received:
    0
    Trophy Points:
    6
    I downloaded this, the README in it references a file called INSTALL that is not included with it.

    Anyone ever get mod_auth_mysql working?
     
  8. cPDan

    cPDan cPanel Staff
    Staff Member

    Joined:
    Mar 9, 2004
    Messages:
    711
    Likes Received:
    4
    Trophy Points:
    18
    yes, I've got it working from the cutom option module, there is no README file in the option module so maybe you've got the wrong file?
     
  9. aeroweb

    aeroweb Well-Known Member

    Joined:
    Jun 4, 2004
    Messages:
    61
    Likes Received:
    0
    Trophy Points:
    6
    I tried installing mod_auth_mysql with Apache 2.2.13 using the EasyApache Custom Modules but I ran into this problem:

    '/usr/local/apache/bin/apxs -i -a -c -I/usr/include/mysql -lmysqlclient -lm -lz mod_auth_mysql.c' failed with exit code '256'

    More details from the log below:

    Code:
    -- Begin opt 'Mod Auth MySQL (Custom Opt Mod)' --
        -- Begin step 'Compiling, installing, and activating' --
    /usr/local/apache/build/libtool --silent --mode=compile gcc -prefer-pic   -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -pthread -I/usr/local/apache/include  -I/usr/local/apache/include   -I/usr/local/apache/include   -c -o mod_auth_mysql.lo mod_auth_mysql.c && touch mod_auth_mysql.slo
    mod_auth_mysql.c:269:19: mysql.h: No such file or directory
    mod_auth_mysql.c:379: error: syntax error before "MYSQL"
    mod_auth_mysql.c:379: warning: no semicolon at end of struct or union
    mod_auth_mysql.c:384: error: syntax error before '}' token
    mod_auth_mysql.c:384: warning: data definition has no type or storage class
    mod_auth_mysql.c:386: error: syntax error before "connection"
    .
    .
    .
    mod_auth_mysql.c:1136: error: request for member `handle' in something not a structure or union
    mod_auth_mysql.c:1142: error: `MYSQL_ROW' undeclared (first use in this function)
    mod_auth_mysql.c:1142: error: syntax error before "data"
    mod_auth_mysql.c:1143: error: `data' undeclared (first use in this function)
    apxs:Error: Command failed with rc=65536
    
    !! apxs failed, Retrying with additional arguments that may help !!
    /usr/local/apache/build/libtool --silent --mode=compile gcc -prefer-pic   -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -pthread -I/usr/local/apache/include  -I/usr/local/apache/include   -I/usr/local/apache/include  -I/usr/include/mysql  -c -o mod_auth_mysql.lo mod_auth_mysql.c && touch mod_auth_mysql.slo
    mod_auth_mysql.c:591: error: syntax error before "mysql_auth_config_rec"
    mod_auth_mysql.c:591: error: initializer element is not constant
    mod_auth_mysql.c:591: error: (near initialization for `mysql_auth_cmds[0].cmd_data')
    .
    .
    .
    mod_auth_mysql.c:671: error: initializer element is not constant
    mod_auth_mysql.c:671: error: (near initialization for `mysql_auth_cmds[19]')
    mod_auth_mysql.c:675: error: initializer element is not constant
    mod_auth_mysql.c:675: error: (near initialization for `mysql_auth_cmds[20]')
    mod_auth_mysql.c: In function `format_request':
    mod_auth_mysql.c:947: warning: pointer/integer type mismatch in conditional expression
    apxs:Error: Command failed with rc=65536
    .
    !! '/usr/local/apache/bin/apxs -i -a -c -I/usr/include/mysql -lmysqlclient -lm -lz mod_auth_mysql.c' failed with exit code '256' !!
    !! Restoring original working apache !!
    
    Just in case this helps someone, I did get it working manually. Here is what I did:

    Get the latest mod_auth_mysql from sourceforge
    Code:
    wget http://downloads.sourceforge.net/project/modauthmysql/modauthmysql/3.0.0/mod_auth_mysql-3.0.0.tar.gz
    
    
    Decompress the file
    Code:
    tar xvzf mod_auth_mysql-3.0.0.tar.gz
    Change Directory
    Code:
    cd mod_auth_mysql-3.0.0
    Get the patch for Apache 2.2
    Code:
    wget http://download.nuxwin.com/apache2.2-modules/auth_mysql/patch/apache2.2.diff
    Patch the source file
    Code:
    patch -p0 < apache2.2.diff mod_auth_mysql.c
    Build and install
    Code:
    /usr/local/apache/bin/apxs -i -a -c -I/usr/include/mysql -lmysqlclient -lm -lz mod_auth_mysql.c
    For me the httpd.conf file was updated automatically. The following line was added.
    Code:
    LoadModule mysql_auth_module  modules/mod_auth_mysql.so
    Ran this just to make sure the changes stick in the httpd.conf file
    Code:
    /usr/local/cpanel/bin/apache_conf_distiller --update
     
  10. baqpad

    baqpad Registered

    Joined:
    Feb 14, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Hi all,

    I've been waitings days now for nuxwin.com but their site seems to be down. Anyone could advise me where else I can get that patch? Haven't found it anywhere else.

    Any help is very very welcome. Thanks
     
  11. cPDan

    cPDan cPanel Staff
    Staff Member

    Joined:
    Mar 9, 2004
    Messages:
    711
    Likes Received:
    4
    Trophy Points:
    18
    Not sure about their site, but will the mod_auth_mysql option module help?

    CustomMods < EasyApache3 < TWiki
     
  12. baqpad

    baqpad Registered

    Joined:
    Feb 14, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Thanks cpdan, will try that and post result here again.
     
  13. DWHS.net

    DWHS.net Well-Known Member
    PartnerNOC

    Joined:
    Jul 28, 2002
    Messages:
    1,569
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    LA, Costa RIca
    cPanel Access Level:
    Root Administrator
    Do we have a time frame when this will be included in easyapache? Custom modules are too risky to use with cpanel for me. If it's not supported we will not use it but we have been getting more and more requests for this from our customers.
     
  14. aeroweb

    aeroweb Well-Known Member

    Joined:
    Jun 4, 2004
    Messages:
    61
    Likes Received:
    0
    Trophy Points:
    6
    Since nuxwin.com is down, here is the apache2.2.diff file just in case anyone still needs it.
     

    Attached Files:

  15. cPDan

    cPDan cPanel Staff
    Staff Member

    Joined:
    Mar 9, 2004
    Messages:
    711
    Likes Received:
    4
    Trophy Points:
    18
    We currently have no plans to include any of the sample custom option modules in easyapache.
     
  16. DomineauX

    DomineauX Well-Known Member
    PartnerNOC

    Joined:
    Apr 12, 2003
    Messages:
    414
    Likes Received:
    4
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Old thread I realize but mod_auth_mysql would indeed be a worthwhile addition to easyapache. The module has been around forever and is very useful and requested. If there are still no plans to ever include it fully, I think it would be helpful to know a reason for that stance.
     
  17. aeroweb

    aeroweb Well-Known Member

    Joined:
    Jun 4, 2004
    Messages:
    61
    Likes Received:
    0
    Trophy Points:
    6
    I agree, I still have to patch all my servers that use apache 2.2 manually.
     

Share This Page