How to reinstall ModSecurity package

Created:

2016-11-16 13:10:18 UTC

Modified:

2017-08-16 17:35:42 UTC

1

Was this article helpful?


Have more questions?

Submit a request

How to reinstall ModSecurity package

Applicable to:

  • Plesk 11.x for Linux
  • Plesk 12.0 for Linux

Question

How to reinstall ModSecurity package in Plesk?

Answer

1. Backup the following directories:

For RedHat-based operating systems:

mkdir -p backup_modsec/etc/asl && cp -a /etc/httpd/modsecurity.d/* backup_modsec && cp -a /etc/httpd/conf/modsecurity.d/* backup_modsec && cp -a /etc/asl/* backup_modsec/etc/asl && cp -a /etc/httpd/conf.d/00_mod_security.conf backup_modsec
mkdir -p backup_modsec/var/asl && cp -a /var/asl/* backup_modsec/var/asl

For Debian-based operating systems:

mkdir -p backup_modsec/etc/asl && cp -a /etc/apache2/modsecurity.d/* backup_modsec && cp -a /etc/asl/* backup_modsec/etc/asl && cp -a /etc/apache2/conf-enabled/00_mod_security.conf backup_modsec
mkdir -p backup_modsec/var/asl && cp -a /var/asl/* backup_modsec/var/asl

2. Remove ModSecurity using Plesk installer

3. Remove the contents from the following directories:

For RedHat-based operating systems:

 rm -rf /etc/asl/* 
rm -rf /var/asl/*
rm -rf /etc/httpd/modsecurity.d/*

rm -rf /etc/httpd/conf/modsecurity.d/*
rm -rf /etc/httpd/conf.d/00_mod_security.conf

For Debian-based operating systems:

rm -rf /etc/asl/*
rm -rf /var/asl/*
rm -rf /etc/apache2/modsecurity.d/*
rm -rf /etc/apache2/conf-enabled/00_mod_security.conf

4. Check if ModSecurity packages remained in the system:

For RedHat-based operating systems:

# rpm --query --all | grep security

For Debian-based operating systems:

# dpkg --list *modsecurity*

5. Remove the existing packages.

For RedHat-based operating systems:

# rpm --erase mod_security-2.8.0-14080716.x86_64 plesk-modsecurity-configurator-12.0.18-cos7.build1200140811.16.noarch plesk-modsecurity-crs-12.0.18-14070712.x86_64

For Debian-based operating systems:

# dpkg --remove libapache2-modsecurity plesk-modsecurity-configurator plesk-modsecurity-crs

6. Check if aum package is still present and remove it if it is still installed:

For RedHat-based operating systems:

# rpm --query --all | grep aum
# rpm --erase
aum

For Debian-based operating systems:

# dpkg --list *aum*
# dpkg --remove aum && dpkg --purge aum

7. Install ModSecurity using Plesk autoinstaller

Additional information

  • In case there is an issue with reinstallation, visit:
    #214028789 Failed to update the ModSecurity rule set: Authorization failed attempting to download an update
  • If you do not want to remove aum package, it is also possible to exclude mod_security package installation from Atomic repository. In this case at step 6 add the following directives in /etc/yum.repos.d/atomic.repo:
    
    [atomic]
    name = CentOS / Red Hat Enterprise Linux $releasever - atomic
    ...
    exclude=*mod_security*
    [atomic-testing]
    ...
    exclude=*mod_security*

Have more questions? Submit a request
Please sign in to leave a comment.