您的位置:首页 > 运维架构 > Tomcat

tomcat域名能访问。ip地址不能访问:服务器防止攻击

2017-10-20 15:32 471 查看
tomcat禁止ip直接访问

设置Tomcat不允许通过IP直接访问

更改host节点后虚拟目录设置失效

发现内部ip泄露模式

1、若公布于外网的服务器IP地址未备案,就有可能被工信部查封。这样备案的域名也会无法访问。

2、如果AppScan通过ip访问扫描,会有“发现内部ip泄露模式”的低级别的警告

安全风险

- 可能会收集有关Web 应用程序的敏感信息,如用户名、密码、机器名和/或敏感文件位置

若是tomcat服务,可通过简单的配置屏蔽IP地址直接访问。

比如,有服务器,IP地址是 192.168.1.2 ,相应域名是 www.myTest.com

打开 conf/server.xml文件

找到 Engine节点作如下

<!-- 1、配置默认的主机为域名-->
<Engine name="Catalina" defaultHost="*.com">

<!--For clustering, please take a look at documentation at:
/docs/cluster-howto.html  (simple how to)
/docs/config/cluster.html (reference documentation) -->
<!--
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
-->

<!-- Use the LockOutRealm to prevent attempts to guess user passwords
via a brute-force attack -->
<Realm className="org.apache.catalina.realm.LockOutRealm">
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase".  Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm.  -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>
<!-- 2、配置允许域名访问-->
<Host name="*.com"  appBase="webapps"
unpackWARs="true" autoDeploy="false">
</Host>
<!-- 3、配置禁止ip地址访问-->
<Host name="192.168.0.120"  appBase="none"
unpackWARs="true" autoDeploy="false">
</Host>
</Engine>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  tomcat
相关文章推荐