本文为苏尚武老师运维安全课程课程笔记
- nginx
禁止显示当前版本
配置文件server_tokens off;
编译安装时注释掉/src/core/nginx.h内NGINX_VERSION和NGINX_VER
禁止上传目录禁止的php文件
单个目录
location ~ /upload/.*\.(php|php5)?${
deny all;
}
多个目录
location ~* ^/(administartor|upload)/.*\.(php)?${
deny all;
}
禁止访问所有目录下的敏感文件
location ~. *\.(sql|log|txt|rar|zip|sh|py|svn|git)
{
deny all;
}
禁止不必要的http请求方式
if($request_method !~ ^(GET|HEAD|POST)$)
{
return 405;
}
设置nginx和php-fpm为nobody
- tomcat
tomcat弱口令零进入后台
补丁和漏洞管理
设置最小权限运行tomcat
创建不可登录用户 useradd /sbin/nologin tomcat
删掉管理界面
网络级限制限制只有本机能访问
隐藏tomcat版本号修改$CATALINNA_HOME/conf/server.xml
connector子添加server字段等于WAF2.0
关闭自动部署
同上文件,
session设置超时
修改conf/web.xml
20
启动用cookie的HttpOnly属性
conf.context.xml
<Context userHttpOnly=‘true’ …/>