Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Install Mod_Security On Apache2.4 (Ubuntu 14.04)

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

1.Installing Apache,PHP

Press ctrl+alt+T to to open terminal

Enter the following command

Sudo apt-get update

Sudo apt-get install apache2

Sudo apt-get install php5

Sudo / etc/init.d/apache2 restart

2.Installing Mod Security on Apache

Commands for installing dependency packages

Sudo apt-get install libxml2 libxml2-devlibxml2-utils

Sudo apt-get install libaprutil1libaprutil1-dev

64-bit Ubuntu runs the following command

Sudo ln-s/usr/lib/x86_64-linux-gnu/libxml2.so.2 / usr/lib/libxml2.so.2

Install mod security's command

Sudo apt-get install libapache-mod-security

3.Configuring ModSecurity Rules

Sudo mv/etc/modsecurity/modsecurity.conf-recommended / etc/modsecurity/modsecurity.conf

Start configuration

Sudo gedit/etc/modsecurity/modsecurity.conf

Find SecRuleEngine

Set SecRuleEngine to On.

SecRuleEngine On

4.Install the latest OWASP Rule Set

Cd / tmp

Sudo wget https://github.com/root25/MODSEC/raw/master/modsecurity-crs_2.2.5.tar.gz

Sudo tar-zxvf modsecurity-crs_2.2.5.tar.gz

Sudo cp-R modsecurity-crs_2.2.5/* / usr/share/modsecurity-crs/

Sudo rm modsecurity-crs_2.2.5.tar.gz

Sudo rm-R modsecurity-crs_2.2.5

Sudo mv / usr/share/modsecurity-crs/modsecurity_crs_10_setup.conf.example / usr/share/modsecurity-crs/modsecurity_crs_10_setup.conf

Add a rule set to an active rule set

Cd / usr/share/modsecurity-crs/base_rules

For f in *; do sudo ln-s / usr/share/modsecurity-crs/base_rules/$f/usr/share/modsecurity-crs/activated_rules/$f; done

Cd / usr/share/modsecurity-crs/optional_rules

For f in *; do sudo ln-s / usr/share/modsecurity-crs/optional_rules/$f/usr/share/modsecurity-crs/activated_rules/$f; done

Add it to apache mods:

Sudo gedit / etc/apache2/mods-available/security2.conf

Before joining, save and exit

Include "/ usr/share/modsecurity-crs/activated_rules/*.conf"

IncludeOptional / etc/modsecurity/*.conf

# IncludeOptional/usr/share/modsecurity-crs/*.conf

# IncludeOptional/usr/share/modsecurity-crs/activated_rules/*.conf

Use headers module:

Sudo a2enmod headers

5.Final

Test whether mod_decurity is in normal use

Sudo a2enmod mod-security

Restart spache2

Sudo / etc/init.d/apache2 restart

6.testing

Visit URL: http://192.168.123.137:8080/?id=23' or '1subscription 1

7.Checking the Log

Detect mod_security log

Cd / var/log/apache2/

Sudo less modsec_audit.log

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report