How To Install modsecurity-crs on Ubuntu 18.04

In this tutorial we learn how to install modsecurity-crs on Ubuntu 18.04. modsecurity-crs is OWASP ModSecurity Core Rule Set

Introduction

In this tutorial we learn how to install modsecurity-crs on Ubuntu 18.04.

What is modsecurity-crs

modsecurity-crs is:

modsecurity provides critical protections against attacks across most every web architecture. CRS is based on generic rules which focus on attack payload identification in order to provide protection from zero day and unknown vulnerabilities often found in web applications, which are in most cases custom coded.

Core Rules use the following techniques: HTTP request validation, HTTP protocol anomalies, Global constraints, HTTP Usage policy, Malicious client software detection, Generic Attack Detection (SQL injection, Cross Site Scripting, OS Command Injection, ColdFusion, PHP and ASP injection, etc.), Trojans & Backdoors Detection, Error Detection, XML Protection, Search Engine Monitoring.

There are three methods to install modsecurity-crs on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install modsecurity-crs Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install modsecurity-crs using apt-get by running the following command:

sudo apt-get -y install modsecurity-crs

Install modsecurity-crs Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install modsecurity-crs using apt by running the following command:

sudo apt -y install modsecurity-crs

Install modsecurity-crs Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install modsecurity-crs using aptitude by running the following command:

sudo aptitude -y install modsecurity-crs

How To Uninstall modsecurity-crs on Ubuntu 18.04

To uninstall only the modsecurity-crs package we can use the following command:

sudo apt-get remove modsecurity-crs

Uninstall modsecurity-crs And Its Dependencies

To uninstall modsecurity-crs and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove modsecurity-crs

Remove modsecurity-crs Configurations and Data

To remove modsecurity-crs configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge modsecurity-crs

Remove modsecurity-crs configuration, data, and all of its dependencies

We can use the following command to remove modsecurity-crs configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge modsecurity-crs

References

Summary

In this tutorial we learn how to install modsecurity-crs package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.