{"id":5,"date":"2008-03-24T10:10:06","date_gmt":"2008-03-24T16:10:06","guid":{"rendered":"http:\/\/xux.in\/blog\/post\/mod_security2-for-ensim-x-centos-46\/"},"modified":"2008-09-29T10:56:38","modified_gmt":"2008-09-29T15:56:38","slug":"mod_security2-for-ensim-x-centos-46","status":"publish","type":"post","link":"http:\/\/xux.in\/blog\/post\/mod_security2-for-ensim-x-centos-46\/","title":{"rendered":"mod_security 2 for Ensim X CentOs 4.6"},"content":{"rendered":"<p>ModSecurity is a great application which will help you to prevent attacks (including injections) to your webserver. On this article I&#8217;ll cover the installation of <a href=\"http:\/\/www.modsecurity.org\">ModSecurity<\/a> 2.5.1 on <a href=\"http:\/\/www.centos.org\">CentOS<\/a> 4.6 with <a href=\"http:\/\/www.apache.org\">Apache2<\/a> running <a href=\"http:\/\/www.swsoft.com\">Ensim X<\/a>.<\/p>\n<p>First you need to meet the requirements:<\/p>\n<ul>\n<li> libxml2<\/li>\n<li>libxml2-devel<\/li>\n<li>httpd-devel<\/li>\n<li>apr-devel<\/li>\n<li>apr-util-devel<\/li>\n<li>pcre-devel<\/li>\n<\/ul>\n<p>You can use yum in order to install\/upgrade the mentioned packages.<\/p>\n<p>Once you met the requirements you can go and download mod_security from <a href=\"http:\/\/www.modsecurity.org\/download\/modsecurity-apache_2.5.1.tar.gz\" title=\"mod_security\">here<\/a>.<\/p>\n<pre lang=\"bash\">wget http:\/\/www.modsecurity.org\/download\/modsecurity-apache_2.5.1.tar.gz\r\ntar -zxvf modsecurity-apache_2.5.1.tar.gz\r\ncd modsecurity-apache_2.5.1\/apache2\r\n.\/configure\r\nmake\r\nmake install<\/pre>\n<p>By now mod_security  should be installed on your system and we are just 1 step away from glory. You need to modify your apache config&#8217;s file \/etc\/httpd\/conf\/httpd.conf (backup your config first!!!).<\/p>\n<p>Edit your \/etc\/httpd\/conf\/httpd.conf file and locate the LoadModule&#8217;s section (DSO) and at the following lines:<\/p>\n<pre lang=\"apache\"># load libxml2.so before any other module\r\nLoadFile \/usr\/lib\/libxml2.so\r\n# here goes the rest of the default modules, I'm only pasting a few as an example\r\nLoadModule access_module modules\/mod_access.so\r\nLoadModule auth_module modules\/mod_auth.so .........\r\n# and at the end add the lines needed for mod_security\r\nLoadModule unique_id_module modules\/mod_unique_id.so\r\nLoadModule security2_module modules\/mod_security2.so\r\nInclude conf\/modsecurity\/*.conf<\/pre>\n<p>We are almost done, we have mod_security installed and Apache configured to load mod_security. If you noticed, the last line we added (Include conf\/modsecurity\/*.conf) makes reference to the default rules mod_security includes in another file <a href=\"http:\/\/www.modsecurity.org\/download\/modsecurity-core-rules_2.5-1.6.0.tar.gz\">modsecurity-core-rules_2.5-1.6.0.tar.gz<\/a><\/p>\n<pre lang=\"bash\">cd \/usr\/local\/src\r\nwget http:\/\/www.modsecurity.org\/download\/modsecurity-core-rules_2.5-1.6.0.tar.gz\r\nmkdir \/etc\/httpd\/conf\/modsecurity\r\ncd \/etc\/httpd\/conf\/modsecurity\r\ntar -zxvf \/usr\/local\/src\/modsecurity-core-rules_2.5-1.6.0.tar.gz\r\nservice httpd restart<\/pre>\n<p>If you didn&#8217;t get any error\/warning check your logs just to make sure apache restarted without issues. If no errors then that means you&#8217;ve succesfully installed mod_security on your server hurray! \ud83d\ude42<\/p>\n<p>Take note that mod_security 2 has it&#8217;s default rules which are completely different than mod_security 1, you are free to go to \/etc\/httpd\/conf\/modsecurity and change\/add rules according to your needs, and I highly recommend you to read <a href=\"http:\/\/www.modsecurity.org\/documentation\/index.html\">ModSecurity documentation<\/a> before doing that.<\/p>\n<p>I took the best of the following sites to bring you this small HOWTO:<\/p>\n<p><a href=\"http:\/\/www.eth0.us\/mod_security\">http:\/\/www.eth0.us\/mod_security<\/a><br \/>\n<a href=\"http:\/\/carrero.es\/instalar-modsecurity-2-en-plesk\/1374\">http:\/\/carrero.es\/instalar-modsecurity-2-en-plesk\/1374<\/a><\/p>\n<p>That&#8217;s all for today, I&#8217;m outta here \ud83d\ude09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ModSecurity is a great application which will help you to prevent attacks (including injections) to your webserver. On this article I&#8217;ll cover the installation of ModSecurity 2.5.1 on CentOS 4.6 with Apache2 running Ensim X. First you need to meet the requirements: libxml2 libxml2-devel httpd-devel apr-devel apr-util-devel pcre-devel You can use yum in order to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31,10,8,5],"tags":[14,13,33,12,20],"class_list":["post-5","post","type-post","status-publish","format-standard","hentry","category-code","category-ensim","category-linux","category-software","tag-apache","tag-centos","tag-linux","tag-mod_security","tag-rhel"],"_links":{"self":[{"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/posts\/5","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/comments?post=5"}],"version-history":[{"count":3,"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/posts\/5\/revisions"}],"predecessor-version":[{"id":43,"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/posts\/5\/revisions\/43"}],"wp:attachment":[{"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/media?parent=5"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/categories?post=5"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/xux.in\/blog\/wp-json\/wp\/v2\/tags?post=5"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}