{"id":534,"date":"2021-07-23T12:32:18","date_gmt":"2021-07-23T12:32:18","guid":{"rendered":"https:\/\/ssdsunucum.com\/blog\/modsecurity-3\/"},"modified":"2021-07-23T12:32:18","modified_gmt":"2021-07-23T12:32:18","slug":"modsecurity-3","status":"publish","type":"post","link":"https:\/\/ssdsunucum.com\/blog\/modsecurity-3\/","title":{"rendered":"ModSecurity\u00ae 3"},"content":{"rendered":"<\/p>\n<div class=\"col-md-9\">\n<div class=\"flex-column flex-md-row article-header\">\n<div id=\"versioned-article-header\">\n<p class=\"valid-version-info\"><em>Valid for versions 92 through the latest version<\/em><\/p>\n<\/div>\n<div id=\"version-select-group\" aria-label=\"select versions\">\n<h4>Version:<\/h4>\n<h4>92<\/h4>\n<\/div><\/div>\n<hr>\n<h2 id=\"overview\">Overview<\/h2>\n<p>ModSecurity 3 is a web application firewall. You can use ModSecurity on systems that run Apache and NGINX\u00ae. ModSecurity 3 is now a library, and you must install a connector for your web server in order for it to function.<\/p>\n<h2 id=\"compatibility\">Compatibility<\/h2>\n<p>ModSecurity 3 is compatible with systems that run both Apache and NGINX.<\/p>\n<p>ModSecurity 3 is <strong>only<\/strong> compatible with CentOS 7 on systems that run NGINX.<\/p>\n<div class=\"callout callout-danger\">\n<div class=\"callout-heading\">Warning:<\/div>\n<div class=\"callout-content\">\n<p>ModSecurity 3 is <strong>experimental<\/strong>. You <strong>must<\/strong> install the Experimental Repository to use it.<\/p>\n<\/p><\/div>\n<\/div>\n<h2 id=\"install-modsecurity-3\">Install ModSecurity 3<\/h2>\n<p>You can install ModSecurity 3 in two ways.<\/p>\n<h4 id=\"in-the-interface\">In the interface<\/h4>\n<p>Use the <em>EasyApache 4<\/em> interface (<em>WHM &gt; Home &gt; Software &gt;&gt; EasyApache 4<\/em>) to install the following packages:<\/p>\n<ol>\n<li>\n<p>Install one of the following connectors:<\/p>\n<ul>\n<li><code>ea-modsec30-connector-nginx<\/code> \u2014 Install  this package if your system runs NGINX.<\/li>\n<li><code>ea-modsec30-connector-apache24<\/code> \u2014 Install  this package if your system runs Apache.<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>Install the <code>ea-modsec30-rules-owasp-crs<\/code> package \u2014 This installs the OWASP rule set for ModSecurity 3.<\/p>\n<\/li>\n<\/ol>\n<h4 id=\"on-the-command-line\">On the command line<\/h4>\n<p>Run the following commands to install ModSecurity 3 on the command line:<\/p>\n<ol>\n<li>\n<p>Install one of the following connectors:<\/p>\n<ul>\n<li>If your system runs NGINX, install the NGINX connector with the following command:\n<div class=\"highlight\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-bash\" data-lang=\"bash\">\tyum install ea-modsec30-connector-nginx<\/code><\/pre>\n<\/div>\n<\/li>\n<li>If your system runs Apache, install the Apache connector with the following command:\n<div class=\"highlight\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-bash\" data-lang=\"bash\">\tyum install ea-modsec30-connector-apache24<\/code><\/pre>\n<\/div>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>Run the following command to install the OWASP rule set:\n<\/p>\n<div class=\"highlight\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-bash\" data-lang=\"bash\">yum install ea-modsec30-rules-owasp-crs<\/code><\/pre>\n<\/div>\n<\/li>\n<\/ol>\n<h2 id=\"configuration-files\">Configuration files<\/h2>\n<p>Depending on which ModSecurity connector you use, the system uses different configuration file locations.<\/p>\n<h4 id=\"nginx\">NGINX<\/h4>\n<p>If you install the NGINX connector, ModSecurity uses the following configuration files:<\/p>\n<table>\n<thead>\n<tr>\n<th align=\"left\">Path<\/th>\n<th align=\"left\">Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td align=\"left\"><code>\/etc\/nginx\/conf.d\/modsec30.conf<\/code><\/td>\n<td align=\"left\">This file contains your ModSecurity default configuration and <code>Include<\/code> directives for the following <code>modsec30.cpanel.conf<\/code> and <code>modsec30.user.conf<\/code> files.<\/td>\n<\/tr>\n<tr>\n<td align=\"left\"><code>\/etc\/nginx\/conf.d\/modsec\/modsec30.cpanel.conf<\/code><\/td>\n<td align=\"left\">This file contains the custom configurations and rules you defined in the cPanel &#038; WHM user interface.<\/td>\n<\/tr>\n<tr>\n<td align=\"left\"><code>\/etc\/nginx\/conf.d\/modsec\/modsec30.user.conf<\/code><\/td>\n<td align=\"left\">This file contains any ModSecurity settings that you cannot set via cPanel &#038; WHM. You must edit this file manually if you wish to use it.<\/p>\n<div class=\"callout callout-warning\">\n<div class=\"callout-heading\">Important:<\/div>\n<div class=\"callout-content\">\n        Use caution when you edit the <code>modsec30.user.conf<\/code> file, as unexpected results may occur.\n    <\/div>\n<\/div>\n<\/td>\n<\/tr>\n<tr>\n<td align=\"left\"><code>\/etc\/nginx\/conf.d\/modsec_vendor_configs\/<\/code><\/td>\n<td align=\"left\">This directory contains your ModSecurity vendor configurations.<\/td>\n<\/tr>\n<tr>\n<td align=\"left\"><code>\/var\/log\/nginx\/modsec30_audit\/<\/code><\/td>\n<td align=\"left\">This directory contains the ModSecurity log files.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"callout callout-info\">\n<div class=\"callout-heading\">Note:<\/div>\n<div class=\"callout-content\">\n<p>ModSecurity uses concurrent logging with NGINX.<\/p>\n<\/p><\/div>\n<\/div>\n<h4 id=\"apache\">Apache<\/h4>\n<p>If you install the Apache connector, ModSecurity uses the following configuration files:<\/p>\n<table>\n<thead>\n<tr>\n<th align=\"left\">Path<\/th>\n<th align=\"left\">Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td align=\"left\"><code>\/etc\/apache24\/conf.d\/modsec30.conf<\/code><\/td>\n<td align=\"left\">This file contains your ModSecurity default configuration and <code>Include<\/code> directives for the following <code>modsec2.cpanel.conf<\/code> and <code>modsec2.user.conf<\/code> files.<\/td>\n<\/tr>\n<tr>\n<td align=\"left\"><code>\/etc\/apache2\/conf.d\/modsec2.cpanel.conf<\/code><\/td>\n<td align=\"left\">This file contains the custom configurations and rules you defined in the cPanel &#038; WHM user interface.<\/td>\n<\/tr>\n<tr>\n<td align=\"left\"><code>\/etc\/apache2\/conf.d\/modsec\/modsec2.user.conf<\/code><\/td>\n<td align=\"left\">This file contains any ModSecurity settings that you cannot set via cPanel &#038; WHM. You must edit this file manually if you wish to use it.<\/p>\n<div class=\"callout callout-warning\">\n<div class=\"callout-heading\">Important:<\/div>\n<div class=\"callout-content\">\n        Use caution when you edit the <code>modsec2.user.conf<\/code> file, as unexpected results may occur.\n    <\/div>\n<\/div>\n<\/td>\n<\/tr>\n<tr>\n<td align=\"left\"><code>\/etc\/apache2\/logs\/modsec_audit\/<\/code><\/td>\n<td align=\"left\">This directory contains the ModSecurity log files.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"callout callout-info\">\n<div class=\"callout-heading\">Note:<\/div>\n<div class=\"callout-content\">\n<ul>\n<li>The Apache configuration file paths use <code>modsec2<\/code> in their naming convention due to limitations on the system.<\/li>\n<li>ModSecurity logs events concurrently in Apache when <code>mod_ruid2<\/code> or <code>mod_mpm_itk<\/code> are installed. If they are not installed, it uses serial logging.<\/li>\n<\/ul><\/div>\n<\/div>\n<h2 id=\"modsecurity-rules\">ModSecurity Rules<\/h2>\n<p>We provide  the OWASP\u00ae ModSecurity core rule set for ModSecurity 3 rules via RPM. You must install the <code>ea-modsec30-rules-owasp-crs<\/code> RPM to use it.<\/p>\n<h4 id=\"third-party-rule-sets\">Third party rule sets<\/h4>\n<p>You can <strong>only<\/strong> install a third-party rule set if that rule set supports ModSecurity 3.<\/p>\n<p>If you attempt to install an unsupported rule set in WHM\u2019s <em>ModSecurity\u00ae Vendors<\/em> interface (<em>WHM &gt;&gt; Home &gt;&gt; Security Center &gt;&gt; ModSecurity\u00ae Vendors<\/em>) with ModSecurity 3 installed, the system will disable the rule set and return an error in the interface.<\/p>\n<h4 id=\"rules-format\">Rules format<\/h4>\n<p>ModSecurity 3 formats its rules differently than ModSecurity 2.<\/p>\n<h2 id=\"differences-between-modsecurity-2-and-modsecurity-3\">Differences between ModSecurity 2 and ModSecurity 3<\/h2>\n<p>There are several behavior differences between ModSecurity 2 and ModSecurity 3.<\/p>\n<div class=\"callout callout-warning\">\n<div class=\"callout-heading\">Important:<\/div>\n<div class=\"callout-content\">\n<p>This list is <strong>not<\/strong> comprehensive.<\/p>\n<\/p><\/div>\n<\/div>\n<h4 id=\"directives\">Directives<\/h4>\n<p>ModSecurity 3 does <strong>not<\/strong> support the <code>SecDataDir<\/code> directive.<\/p>\n<p>ModSecurity 3 with NGINX does <strong>not<\/strong> support the following directives:<\/p>\n<ul>\n<li><code>SecConnEngine<\/code><\/li>\n<li><code>SecDisableBackendCompression<\/code><\/li>\n<li><code>SecDataDir<\/code><\/li>\n<li><code>SecGsbLookupDb<\/code><\/li>\n<li><code>SecGuardianLog<\/code><\/li>\n<\/ul>\n<h4 id=\"response-codes\">Response codes<\/h4>\n<p>ModSecurity 3 with NGINX may return a 406 response code in situations where ModSecurity 2.9 would return a 403 response code.<\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Valid for versions 92 through the latest version Version: 92 Overview ModSecurity 3 is a web application firewall. You can use ModSecurity on systems that run Apache and NGINX\u00ae. ModSecurity 3 is now a library, and you must install a connector for your web server in order for it to function. Compatibility ModSecurity 3 is &hellip;<\/p>\n","protected":false},"author":1,"featured_media":535,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/posts\/534"}],"collection":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/comments?post=534"}],"version-history":[{"count":0,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/posts\/534\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/media\/535"}],"wp:attachment":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/media?parent=534"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/categories?post=534"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/tags?post=534"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}