【运维日记3-15】modsecurity安装OWASP步骤验证

本文档详细介绍了在CentOS系统中安装ModSecurity Web应用防火墙并集成OWASP核心规则集(CRS)的步骤,包括前置条件、安装git、readline、lua,以及OWASP CRS的配置、白名单设置和验证安装过程。安装完成后,ModSecurity将提供HTTP防御、实时黑名单查询、DoS防护等多重安全保护。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

前置条件
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(错误检测和隐藏) -伪装服务器发送错误消息。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值