前置条件
1)安装git
yum install git -y
2)安装readline
yum -y install readline-devel ncurses-devel
3)安装lua
wget -c http://www.lua.org/ftp/lua-5.2.0.tar.gz
tar zxvf lua-5.2.0.tar.gz
cd lua-5.2.0
make Linux
make install
4)建立软连接
ln -s /usr/lib/libreadline.so libreadline.so
ln -s /usr/lib/libreadline.so libreadline.so.6
cd ../
安装OWASP
1)git clone https://github.com/SpiderLabs/owasp-modsecurity-crs.git
2)mv owasp-modsecurity-crs modsecurity-crs
3)cd modsecurity-crs
4)mv crs-setup.conf.example crs-setup.conf
5)mv /usr/local/src/modsecurity-crs /etc/httpd/modsecurity-crs
6)cd /etc/httpd
7)vi /etc/httpd/conf/httpd.conf
在末尾加上
<IfModule security2_module>
Include modsecurity-crs/crs-setup.conf
Include modsecurity-crs/rules/*.conf
</IfModule>
8)检查apacher配置文件
service httpd configtest
9)重启apacher
service httpd restart
10)配置白名单
modsecuirty.d
vi /etc/httpd/modsecuirty.d/whitelist.conf
写入
#Whitelist file to control ModSec
<IfModule mod_security2.c>
SecRuleEngine On
SecRequestBodyAccess On
SecResponseBodyAccess On
SecDataDir /tmp
</IfModule>
11)重启apacher
service httpd restart
12)验证安装
登录本机的web,执行些操作,然后输入
tail -f /var/log/httpd/error_log
可以看到
[Wed Mar 15 16:44:24 2017] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed.
[Wed Mar 15 16:44:24 2017] [error] [client 172.26.18.108] PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead in /usr/local/centreon/www/class/centreonGMT.class.php on line 141, referer: http://172.27.206.7/centreon/main.php?p=60801&o=c&command_id=97&type=2%20and%201=1
[Wed Mar 15 16:44:24 2017] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed.
里面有ModSecurity,并且已经记录了访问日志。
ModSecurity核心规则集(CRS)提供以下类别的保户来防止攻击
?HTTP Protection (HTTP防御) - HTTP协议和本地定义使用的detectsviolations策略。
?Real-time Blacklist Lookups(实时黑名单查询) -利用第三方IP信誉。
?HTTP Denial of Service Protections(HTTP的拒绝服务保护) -防御HTTP的洪水攻击和HTTP
Dos 攻击。
?Common Web Attacks Protection(常见的Web攻击防护) -检测常见的Web应用程序的安全攻击。
?Automation Detection(自动化检测) -检测机器人,爬虫,扫描仪和其他表面恶意活动。
?Integration with AV Scanning for File Uploads(文件上传防病毒扫描) -检测通过Web应用程序上传的恶意文件。
?Tracking Sensitive Data(跟踪敏感数据) -信用卡通道的使用,并阻止泄漏。
?Trojan Protection(木马防护) -检测访问木马。
?Identification of Application Defects (应用程序缺陷的鉴定)-应用程序的错误配置警报。
?Error Detection and Hiding(错误检测和隐藏) -伪装服务器发送错误消息。
1)安装git
yum install git -y
2)安装readline
yum -y install readline-devel ncurses-devel
3)安装lua
wget -c http://www.lua.org/ftp/lua-5.2.0.tar.gz
tar zxvf lua-5.2.0.tar.gz
cd lua-5.2.0
make Linux
make install
4)建立软连接
ln -s /usr/lib/libreadline.so libreadline.so
ln -s /usr/lib/libreadline.so libreadline.so.6
cd ../
安装OWASP
1)git clone https://github.com/SpiderLabs/owasp-modsecurity-crs.git
2)mv owasp-modsecurity-crs modsecurity-crs
3)cd modsecurity-crs
4)mv crs-setup.conf.example crs-setup.conf
5)mv /usr/local/src/modsecurity-crs /etc/httpd/modsecurity-crs
6)cd /etc/httpd
7)vi /etc/httpd/conf/httpd.conf
在末尾加上
<IfModule security2_module>
Include modsecurity-crs/crs-setup.conf
Include modsecurity-crs/rules/*.conf
</IfModule>
8)检查apacher配置文件
service httpd configtest
9)重启apacher
service httpd restart
10)配置白名单
modsecuirty.d
vi /etc/httpd/modsecuirty.d/whitelist.conf
写入
#Whitelist file to control ModSec
<IfModule mod_security2.c>
SecRuleEngine On
SecRequestBodyAccess On
SecResponseBodyAccess On
SecDataDir /tmp
</IfModule>
11)重启apacher
service httpd restart
12)验证安装
登录本机的web,执行些操作,然后输入
tail -f /var/log/httpd/error_log
可以看到
[Wed Mar 15 16:44:24 2017] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed.
[Wed Mar 15 16:44:24 2017] [error] [client 172.26.18.108] PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead in /usr/local/centreon/www/class/centreonGMT.class.php on line 141, referer: http://172.27.206.7/centreon/main.php?p=60801&o=c&command_id=97&type=2%20and%201=1
[Wed Mar 15 16:44:24 2017] [error] ModSecurity: ModSecurity requires mod_unique_id to be installed.
里面有ModSecurity,并且已经记录了访问日志。
ModSecurity核心规则集(CRS)提供以下类别的保户来防止攻击
?HTTP Protection (HTTP防御) - HTTP协议和本地定义使用的detectsviolations策略。
?Real-time Blacklist Lookups(实时黑名单查询) -利用第三方IP信誉。
?HTTP Denial of Service Protections(HTTP的拒绝服务保护) -防御HTTP的洪水攻击和HTTP
Dos 攻击。
?Common Web Attacks Protection(常见的Web攻击防护) -检测常见的Web应用程序的安全攻击。
?Automation Detection(自动化检测) -检测机器人,爬虫,扫描仪和其他表面恶意活动。
?Integration with AV Scanning for File Uploads(文件上传防病毒扫描) -检测通过Web应用程序上传的恶意文件。
?Tracking Sensitive Data(跟踪敏感数据) -信用卡通道的使用,并阻止泄漏。
?Trojan Protection(木马防护) -检测访问木马。
?Identification of Application Defects (应用程序缺陷的鉴定)-应用程序的错误配置警报。
?Error Detection and Hiding(错误检测和隐藏) -伪装服务器发送错误消息。