Tomcat6 only allows to specify domain name access, disables IP address access, and prevents malicious parsing

Source: Internet
Author: User

2015.02.27

Suddenly colleague reaction, in Baidu search other domain name, unexpectedly opened and we peer to the same site, my first reaction is the source code was stolen. Later found that the domain name is malicious parsing, resolution 1, prohibit the IP address access to Project 2, only allow the specified domain name access.


Environment: Tomcat 6

Method: Modify the Tomcat 6 configuration file Tomcat/conf/server.xml, implement the principle, the tomcat default parameter Defaulthost point to a non-existent domain name, and add the same virtual directory, so when an unknown domain name resolved, Access to the default virtual directory, but there are no items in this directory, so the effect is achieved.

The following is the number of my profile parameters only posted between Engine Oh ~



<engine name= "Catalina" defaulthost= "192.168.1.1" > <!--default parameters I set my server's extranet IP address--

      <!--for clustering, documentation a look at:
   & nbsp;     /docs/cluster-howto.html  (Simple)
          /docs/config/cluster.html (reference documentation)-->
       <!--
      <cluster classname= " Org.apache.catalina.ha.tcp.SimpleTcpCluster "/>
     -->       

      <!--the request dumper valve dumps useful debugging information about
 & nbsp;         the request and response data received and sent by Tomcat.
           documentation at:/docs/config/valve.html--
      <!--
      <valve classname= " Org.apache.catalina.valves.RequestDumperValve "/>
     -->

      <!--This Realm uses the userdatabase configured in the global JNDI
  & nbsp;        resources under the key "Userdatabase" .  any edits
            that is performed against this userdatabase is immediately
           available for use by the realm. -->
      <realm classname= "Org.apache.catalina.realm.UserDatabaseRealm"
              resourcename= "Userdatabase"/>

      <!--Define The default virtual host
            note:xml Schema validation won't work with Xerces 2.2.
      -->
             Unpackwars = "true" autodeploy= "true"
         xmlvalidation= "false" Xmlnamespaceaware= "false",
      <context path= "" Docbase= "/home/web/ Apache-tomcat-6.0.39/webapps/abc "debug=" 0 "reloadable=" true "/> <!--Specify the project address of the virtual directory-->
          

Unpackwars= "true" autodeploy= "true"
Xmlvalidation= "false" Xmlnamespaceaware= "false" >
</Host>

</Engine>


Tomcat6 only allows to specify domain name access, disables IP address access, and prevents malicious parsing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.