{"id":382,"date":"2012-02-10T12:14:03","date_gmt":"2012-02-10T12:14:03","guid":{"rendered":""},"modified":"2013-02-07T12:10:28","modified_gmt":"2013-02-07T04:10:28","slug":"install-mod_security2-on-centos-redhat","status":"publish","type":"post","link":"https:\/\/dingxuan.info\/wp\/?p=382","title":{"rendered":"install mod_security2 on centos \/ redhat"},"content":{"rendered":"<p>This article assumes that you have installed a RedHat Enterprise or CentOS and not guaranteed to work, although we have tested on several CentOS 4.5 with success.<span id=\"more-311\"><\/span>\n<br \/>The first thing is make sure we have installed the <em>libxml2<\/em> library, for it only have to do a search on our system, if installed normally. <strong>(XPC Note: Try &#8220;yum install libxml2-devel&#8221;)<\/strong><!--more--><br \/>You can check if it is installed with the command:<br \/>rpm -q libxml2<br \/>To compile <strong>ModSecurity<\/strong> install and need some additional packages, then you can uninstall it because it is not necessary.<br \/>The packages needed are:<br \/><em>httpd-devel<\/em> <em>httpd-devel<\/em> <em><\/em>\n<br \/><em><\/em> <em>apr-devel<\/em> <em>apr-devel<\/em> <em><\/em>\n<br \/><em><\/em> <em>apr-util-devel<\/em> <em>apr-util-devel<\/em> <em><\/em>\n<br \/><em><\/em> <em>pcre-devel<\/em> <em>pcre-devel<\/em>\n<br \/>In case you miss some package for CentOS can install as follows:<br \/>yum install libxml2<br \/>yum install httpd-devel<br \/>Now go on the mod_security, for this visit the <a href=\"http:\/\/www.modsecurity.org\/\">official website ModSecurity<\/a> to download the latest version. The example shows the version available today, we have to unzip, I recommend downloading everything in <em>\/ usr \/ local \/ share \/,<\/em> for example:<br \/><span style=\"color: red\">C.D<\/span> \/usr\/local\/share\/<br \/><span style=\"color: red\">W.G.E.T<\/span> <a href=\"http:\/\/www.modsecurity.org\/download\/modsecurity-apache_2.1.3.tar.gz\">http:\/\/www.modsecurity.org\/download\/modsecurity-apache_2.1.3.tar.gz<\/a><br \/>tar zxf modsecurity-apache_2.1.3.tar.gz<br \/>Now we have once unzipped edit the <em>Makefile<\/em> in the directory will be apache2 file just unzip.<\/blockquote>\n<br \/><strong>(XPC Note: After unzipping go to \/apache2 and follow the instructions &#8220;<a href=\"http:\/\/www.modsecurity.org\/documentation\/modsecurity-apache\/2.5.9\/html-multipage\/installation.html\">Run the configure script to generate a Makefile.<\/a>&#8221; on the ModSecurity documentation.<\/strong>\n<br \/><blockquote>In this file we must change the line to tell where we have indicated the Apache installed with the development package <em>(httpd-devel)<\/em> installed before.<br \/>top_dir = \/usr\/lib\/httpd<br \/>We are now ready to compile and install ModSecurity with the following commands<br \/>make<br \/>service httpd stop<br \/>make install<br \/>now in the Apache configuration in <em>\/ etc \/ httpd \/ conf \/ editing httpd.conf<\/em> with your favorite editor, I would do this:<br \/>joe \/etc\/httpd\/conf\/httpd.conf<br \/>and look for the module loading area, looking for <em>&#8220;LoadModule&#8221;<\/em> (Control + K + F <em>joe).<\/em>\n<br \/>At the beginning of this section adds:<br \/>LoadFile \/usr\/lib\/libxml2.so<br \/>And then at the end of this section of apache module loading added:<br \/>LoadModule security2_module modules\/mod_security2.so<br \/>Include conf\/modsecurity\/*.conf<br \/>and immediately made this policy must be updated by doing the following configuration:<br \/><span style=\"color: red\">M.K.D.I.R<\/span> \/etc\/httpd\/conf\/modsecurity;<span style=\"color: red\">C.D<\/span> \/etc\/httpd\/conf\/modsecurity<br \/><span style=\"color: red\">W.G.E.T<\/span> <a href=\"http:\/\/www.modsecurity.org\/download\/modsecurity-core-rules_2.1-1.4.3.tar.gz\">http:\/\/www.modsecurity.org\/download\/modsecurity-core-rules_2.1-1.4.3.tar.gz<\/a><br \/>tar zxf modsecurity-core-rules_2.1-1.4.3.tar.gz<br \/>rm -f modsecurity-core-rules_2.1-1.4.3.tar.gz<br \/>And now you have the default policies, remember&nbsp;&nbsp;that you can adapt them by editing the configuration files you&nbsp;&nbsp;installed for ModSecurity.<br \/>Do not forget to restart apache with:<br \/>service httpd restart<br \/>and of course remove the package that may no longer need to:<br \/>rpm -e httpd-devel<br \/>rpm -e apr-util-devel<br \/>rpm -e apr-devel<br \/>rpm -e pcre-devel<br \/>Congratulations, now you have <em><strong>mod_security<\/strong><\/em> installed on your Apache2 server with CentOS and Plesk panel.<br \/><strong>VERY IMPORTANT:<\/strong> If you do not know please delegate this task to your provider or system administrator preferred.<br \/><br \/>Source: <a href=\"http:\/\/carrero.es\/instalar-modsecurity-2-en-plesk\/1374\">carrero.es<\/a> (Translated from Spanish to English with Google)<br \/>Source\uff1a <a href=\"http:\/\/www.xpcdesign.com\/2009\/08\/install-mod_security-2-on-centosredhat\/\">http:\/\/www.xpcdesign.com\/2009\/08\/install-mod_security-2-on-centosredhat\/<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>This article assumes that you have installed a RedHat E &hellip; <a href=\"https:\/\/dingxuan.info\/wp\/?p=382\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">install mod_security2 on centos \/ redhat<\/span><\/a><\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[117],"tags":[93,78,100],"class_list":["post-382","post","type-post","status-publish","format-standard","hentry","category-network","tag-apache","tag-linux","tag-security"],"_links":{"self":[{"href":"https:\/\/dingxuan.info\/wp\/index.php?rest_route=\/wp\/v2\/posts\/382","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dingxuan.info\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dingxuan.info\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dingxuan.info\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dingxuan.info\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=382"}],"version-history":[{"count":0,"href":"https:\/\/dingxuan.info\/wp\/index.php?rest_route=\/wp\/v2\/posts\/382\/revisions"}],"wp:attachment":[{"href":"https:\/\/dingxuan.info\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=382"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dingxuan.info\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=382"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dingxuan.info\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=382"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}