Update ModSecurity running CWP and Apache on AlmaLinux 8 / 9


INTRODUCTION

Control Web Panel (CWP) default installed version of ModSecurity is 2.9.1.

ModSecurity 2.9.6 and below can not use OWASP Rulesets 3.x and above.

In this article, we will cover how to update ModSecurity for Apache on a AlmaLinux 8 or 9 Server running CWP.


READ ME FIRST

This article is provided as a courtesy.
Installing, configuring, and troubleshooting third-party applications is outside the scope of basic support provided by Starburst Services.

We are not liable for any damages and/or data loss.

AS ALWAYS, BEFORE MAKING ANY CRITICAL CHANGE, MAKE A BACKUP OR SNAPSHOT OF THE SERVER


REQUIRMENTS

  • SSH Client (e.g. Bitvise)
  • SSH credentials to login as Root
  • Working CWP Installation
  • Text editor of your choice. (The example uses nano)

PROCEDURE

Install ModSecurity in CWP, if not already installed.

The below screens are from the current version (0.9.8.1190) at the writing of this article.


Log into your admin panel.

e.g. https://yourserver.name:2031


Using the left side menu, select Security


Now from the open pulldown menu, select Mod Security


Then click on the BlueInstall Mod Security Now button‘.


You will see a install screen like below:


After installation, it will bring you to a screen like below.
You should see under ‘Quick Actions’ it show:

ModSec is installed

If when you Reload and Restart Apache, it gives you an error.

See the fix at: Apache Won’t Start After Enabling ModSecurity before proceeding further.


OK, we are done with the CWP GUI, now for some CLI.

Let’s create a work directory:

cd /usr/src

Download ModSecurity (as of the writing of this article, the latest version that works with Apache is 2.9.8):

wget https://github.com/owasp-modsecurity/ModSecurity/releases/download/v2.9.8/modsecurity-v2.9.8.tar.gz
tar xzf modsecurity-v2.9.8.tar.gz
cd modsecurity-v2.9.8
./configure --with-apxs=/usr/local/apache/bin/apxs
make && make install

Now we restart Apache (httpd):

systemctl restart httpd

Now we can verify the updated version of ModSecurity is installed, either from the CLI using the command below, or via the CWP GUI using the step above, and then selecting the Logs tab.

cat /usr/local/apache/logs/error_log

One of the lines will end with:

ModSecurity for Apache/2.9.8 (http://www.modsecurity.org/) configured.


Now the server is ready to run OWASP rulesets above 3.x

How to install the OWASP latest ruleset is covered in the KB article:

Update to OWASP CRS Ruleset running CWP and Apache on AlmaLinux 8 / 9 – Starburst Services Knowledge Base


Thanks for learning with Starburst Services.

Learn more about our services


Did you found this Knowledge Base Article useful?

Please considering thanking our SysOp Team.


KB Article Written: 2025-01-31

people found this article helpful. What about you?