how to install Mod_Security

Discussion in 'General' started by Cyber-DL, Jul 1, 2009.

  1. Cyber-DL

    Cyber-DL New Member

    Hi everyone ,

    i'm installed Trial Version OF LiteSpeed Enterprise Edition and i want install Mod_security 2.5.x , it's important for me to install Mod_security ,

    is this possible ? if yes i'll buy a License !

    Best Regards
  2. -KaaL-

    -KaaL- New Member

    I think you are on DA ..

    Try searching for "update.script" by HOWTO on directadmin.com site.
    You should be fine :)

    However you will get some errors. Post them here, i'll let you know how to correct them.
  3. Cyber-DL

    Cyber-DL New Member

    Yes, i'm using DA , but before i install LiteSpeed i Used Apache & i installed Mod_Security by Update.Script , BUT now in php.ini i can't see Mod_security, so i think it needed FreshInstall & Compiled with LiteSpeed !

    Note : i didn't found php.ini IN /usr/local/lsws/lsphp5/lib , so i was copy php.ini that located in /usr/local/lib/php.ini to /usr/local/lsws/lsphp5/lib !

    is this correct ?!

    Best Regards
  4. -KaaL-

    -KaaL- New Member

    At the time of Compiling PHP,

    in "Install Path Prefix" put >> /usr/local/lsws/lsphp5

    now put the php.ini file from your apache into this folder >> /usr/local/lsws/lsphp5

    Start compiling PHP... you should be fine..
  5. Cyber-DL

    Cyber-DL New Member

    and for installing Mod_security , how i do it ? i think mod_sec installed when i see it in PHPINFO.php ! ??? is this work!?
  6. -KaaL-

    -KaaL- New Member

    Have you successfully installed mod_sec in your APACHE ?

    If yes, then if you copy the APACHE php.ini file to the folder i told you above, simply compile php and Mod_sec should also work with litespeed.
  7. Cyber-DL

    Cyber-DL New Member

    thank's Kaal ,

    yes i installed successfully mod_sec in APACHE , for installing i used Update.Script ,

    now what's commands of Compile MOd_sec !?

    can you tell which commands needed ? i don't know how can i compile & install Mod_sec!
  8. -KaaL-

    -KaaL- New Member

    No command
    Just use the Compile PHP thing provided by LiteSpeed
  9. anewday

    anewday Moderator

    Is mod security loaded in the httpd.conf file?
  10. Cyber-DL

    Cyber-DL New Member

    i said i installed Mod_Sec by Update.Scrip , so mod_Sec file loaded in
    Code:
    nano -w /etc/httpd/conf/extra/httpd-includes.conf
    
    this is installation steps :

    Code:
    nano -w /etc/httpd/conf/extra/httpd-includes.conf
    
    64bit :
    LoadFile /usr/lib64/libxml2.so
    LoadModule security2_module     /usr/lib/apache/mod_security2.so
    <IfModule mod_security2.c>
    # ModSecurity2 ONLY
    # Do not change anything in included files
    #
    Include /etc/modsecurity2/modsecurity-rules-selected-by-web4host.net.conf
    IfModule>
    
    /sbin/service httpd restart
    
    So is this necessarily load in httpd.conf ? and after i if loaded in httpd.conf i must Restart Httpd ?! i hate httpd and apache :((


    Note : i want use LiteSpeed Only , not both of apache & LiteSpeed , !and i used CentOS x64 ( x86_64 )
  11. -KaaL-

    -KaaL- New Member

    You have to load that in /etc/httpd/conf/extra/httpd-includes.conf

    LiteSpeed will be with mod_Sec so dont worry.
    Yes you restart httpd.
  12. Cyber-DL

    Cyber-DL New Member

    Open this Page :

    Code:
    http://heshmati.us/zs.php
    
    i compiled php with that you told me ,

    now i've 3 problem in phpinfo page ,


    Configuration File (php.ini) Path = /usr/local/lsws/lsphp5/lib | Correct
    Loaded Configuration File : (none) | InCorrect
    Scan this dir for additional .ini files : (none) | InCorrect

    what's happend ? what's wrong with me ?
    why Mod_Security2 didn't found in PHPINFO PAGE ?
    why Zend Optimizer didn't find in PHPINFO page ,?
    why eAccelerator didn't find in PHPINFO page ?


    dear admins please follow this Topic !
    i want buy License but i got this problems , please help me
    Best Regards
  13. -KaaL-

    -KaaL- New Member

    you need to put the php.ini file in /usr/local/lsws/lsphp5/
    then recompile

    check if all the path to mod_sec, zend optimizer, etc are proper in php.ini file.
    Last edited: Jul 9, 2009
  14. grniyce

    grniyce New Member

    Look for the include /usr/local/apache/mod_sec_user.conf in the httpd.conf file. If that is not in there, then you will need to determine where your user.conf file is, and add that lincludes line.

    For example: mine is located in multiple locations because I have multiple mod_security rulesets, however the default rulesets that come with installing mod_security would suggest you enter the following line somewhere in httpd.conf (if it is not already there)

    Include usr/local/apache/modsecurity/*.conf
    Last edited: Jul 7, 2009
  15. Cyber-DL

    Cyber-DL New Member

    i installed Mod_security 2 , but i want know whereIs Mod_Security Logs ? to know which Scripts blocked by Mod_security and why blocked , by which Line of rules ,

    note : now i'm using LiteSpeed Enterprise
  16. mistwang

    mistwang LiteSpeed Staff

    If you configured audit log, you can check the log file.
  17. Cyber-DL

    Cyber-DL New Member

    whereIs audit log ? how can i configed it ?! can you tell me more ?
  18. anewday

    anewday Moderator

    Add this to to the mod security rules file.

    SecAuditLog logs/audit_log
  19. Cyber-DL

    Cyber-DL New Member

    i typed SecAuditLog logs/audit_log at the bottom in rules , now whereis logs/audit_log ? it's in /var/logs/audit_log Or in /etc/modsecurity or another path ?

    i'm so sorry for my cheap questions,
    Best Regards
  20. mistwang

    mistwang LiteSpeed Staff

    If you use cPanel, you just enable mod_security for cPanel, if you manage Apache httpd.conf yourself, you can check modsecurity documentation for configuration directives.

Share This Page