然后我们删除多余的数据库并去掉匿名帐号
[root@debian ~]mysql -u root -p
Enter password:XXXXXX
mysql> drop database test;
mysql> use mysql;
mysql> delete from db;
mysql> delete from user where not (host="localhost" and user="root");
mysql> flush privileges;
然后修改默认的治理员帐号root为你喜欢的,我这里改成fatb
mysql> update user set user="fatb" where user="root";
mysql> flush privileges;
以后我们就得通过fatb帐号访问mysql数据库了
[root@debian ~]mysql -u root -p
Enter password:
ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)
[root@debian ~]mysql -u fatb -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 14 to server version: 4.0.13-log
到这里,mysql的安全设置基本上完毕了
现在我们安装mod-security,debian下同样很简单,并且自动把模块加到httpd.conf里
[root@debian /]apt-get install libapache-mod-security
默认这个模块是没激活的,编辑一下httpd.conf文件并去掉下面这行的注释
LoadModule security_module /usr/lib/apache/1.3/mod_security.so
接着在httpd.conf的末尾加上
# 打开或者关闭过滤引擎
SecFilterEngine On
# 设置缺省的动作
SecFilterDefaultAction "deny,log,status:404"
# 把设置传递给字目录
SecFilterInheritance Off
# 检测URL编码是否正确
SecFilterCheckURLEncoding On
# 检测内容长度以避免堆溢出攻击
SecFilterForceByteRange 32 126
# 日志文件的位置和名字
SecAuditLog logs/audit_log
# debug设置
SecFilterDebugLog logs/modsec_debug_log
SecFilterDebugLevel 0
# 检测POST数据
SecFilterScanPOST On
# 当匹配sh的时候,重新定向到一个非凡的页面,让攻击者知难而退
SecFilter sh redirect:http://secu.zzu.edu.cn/hack/fu.htm
# Only check the body of the POST request
#过滤一些敏感的东西,我们使用*是为了攻击者使用/etc/./passwd来绕开检测
SecFilter /etc/*passwd
SecFilter /bin/*sh
# 防止double dot攻击,也就是类似
评论加载中…
![]() |