tomcat安全基线配置建议


 检查项目: tomcat进程运行权限检测
路径: /xxx/xxx/apache-tomcat-7.0.88
当前值: 0
加固建议: 请创建低权限的账号运行tomcat
检查项目: 开启用户登录失败锁定
路径: /xxx/xxx/apache-tomcat-7.0.88/conf/server.xml
当前值:
加固建议: <Realm className="org.apache.catalina.realm.LockOutRealm" failureCount="3" lockOutTime="600" cacheSize="1000" cacheRemovalWarningTime="3600">
检查项目: 限制远程管理IP
路径: /xxx/xxx/apache-tomcat-7.0.88/conf/server.xml
当前值:
加固建议: 增加<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="允许远程管理IP"/>
检查项目: 禁止显示异常调试信息
路径: /xxx/xxx/apache-tomcat-7.0.88/conf/web.xml
当前值:
加固建议: 在当前web.xml里面的web-app添加子节点:<error-page><exception-type>java.lang.Throwable</exception-type><location>/error.jsp</location></error-page>,在webapps目录下创建error.jsp,定义自定义错误信息
检查项目: 开启传输层安全属性
路径: /xxx/xxx/apache-tomcat-7.0.88/webapps/manager/WEB-INF/web.xml
当前值:
加固建议: 在当前路径的web.xml里面的web-app添加子节点:<security-constraint> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee></user-data-constraint> </security-constraint>
检查项目: 开启安全周期生命监听器
路径: /xxx/xxx/apache-tomcat-7.0.88/conf/server.xml
当前值:
加固建议: 取消 <Listener className="org.apache.catalina.security.SecurityListener" /> 注释
检查项目: 示例文件检测
路径: /xxx/xxx/apache-tomcat-7.0.88/
当前值: /xxx/xxx/apache-tomcat-7.0.88/webapps/examples
加固建议: 请删除检测出的示例文件或目录
检查项目: tomcat目录权限检测
路径: /xxx/xxx/apache-tomcat-7.0.88/
当前值: root
加固建议: 使用chown -R tomcat:tomcat "根目录"修改tomcat根目录文件所有者
检查项目: 禁止自动部署
路径: /xxx/xxx/apache-tomcat-7.0.88/conf/server.xml
当前值: Host:autoDeploy=true
加固建议: 将autoDeploy="false"
检查项目: 禁止应用运行在提权模式
路径: /xxx/xxx/apache-tomcat-7.0.88/webapps/manager/META-INF/context.xml
当前值: Context:privileged=true
加固建议: 将privileged="false"
检查项目: 禁止应用运行在提权模式
路径: /xxx/xxx/apache-tomcat-7.0.88/webapps/host-manager/META-INF/context.xml
当前值: Context:privileged=true
加固建议: 将privileged="false"
检查项目: 设置http大小
路径: /xxx/xxx/apache-tomcat-7.0.88/conf/server.xml
当前值: maxHttpHeaderSize
加固建议: 对检测出的Connector增加属性:maxHttpHeaderSize="8192"
检查项目: 设置http大小
检查项目: 监听端口业务协议配置检测
路径: /xxx/xxx/apache-tomcat-7.0.88/conf/server.xml
当前值: 10086
加固建议: 为该监听端口配置scheme="http"或"https"属性
检查项目: 监听端口业务协议配置检测
路径: /xxx/xxx/apache-tomcat-7.0.88/conf/server.xml
当前值: 8009
加固建议: 为该监听端口配置scheme="http"或"https"属性
检查项目: 使用UserDatabaseRealm检测
路径: /xxx/xxx/apache-tomcat-7.0.88/conf/server.xml
当前值: org.apache.catalina.realm.UserDatabaseRealm
加固建议: 建议关闭UserDatabaseRealm使用

对应以上项目要做的修改:

1.添加用户tomcat,密码tomcat_2019
useradd tomcat
passwd tomcat 
pwd: tomcat_2019
chown tomcat /data/tomcat -R
chgrp tomcat /data/tomcat -R
2.sudo vi conf/server.xml
<Realm className="org.apache.catalina.realm.LockOutRealm" failureCount="3" lockOutTime="600" cacheSize="1000" cacheRemovalWarningTime="3600">
<Listener className="org.apache.catalina.security.SecurityListener" />
autoDeploy="false"
scheme="http" maxHttpHeaderSize="8192" 10086
scheme="http" maxHttpHeaderSize="8192" 8009
把org.apache.catalina.realm.UserDatabaseRealm注释

3.sudo chown -R tomcat:tomcat /data/logs/crm 这是我自己的应用可能使用到的路径
4.sudo vi conf/web.xml
<error-page>
    <exception-type>java.lang.Throwable</exception-type>
    <location>/error.jsp</location>
</error-page>
5.sudo vi webapps/manager/WEB-INF/web.xml
<security-constraint>
  <user-data-constraint>
      <transport-guarantee>CONFIDENTIAL</transport-guarantee>
  </user-data-constraint>
</security-constraint>
6.sudo rm -rf webapps/examples

7.sudo vi webapps/manager/META-INF/context.xml
privileged="false"
8.sudo vi webapps/host-manager/META-INF/context.xml
privileged="false"
 

猜你喜欢

转载自blog.csdn.net/Gary_H/article/details/87372142