2019.9.22 tomcat access control and management functions using

Note: The test function, do not use the production environment

     Tomcat Tomcat management functions for applications deployed on their own as well as the Tomcat for web application management.

Default is in the disabled state. If you need to turn on this feature, you need to configure user management, namely configure tomcat-user.xml file.

 As we row the upper right corner of the Server Status will pop up this prompt

 

 [Root @ localhost ~] # vim /usr/local/tomcat8/conf/tomcat-users.xml // modify files

<role rolename="tomcat"/>
<role rolename="role1"/>
<user username="tomcat" password="<must-be-changed>" roles="tomcat"/>
<user username="both" password="<must-be-changed>" roles="tomcat,role1"/>
<user username="role1" password="<must-be-changed>" roles="role1"/>
-->
<role rolename="manager-gui" />
<role rolename="admin-gui" />                                                       
<user username="tomcat" password="tomcat" roles="manager-gui,admin-gui" />        //用户是tomcat,密码是tomcat,对manager-gui和admin-gui这两个生效。

</ Tomcat-users> // before this line three of the above

[Root @ localhost ~] # /usr/local/tomcat8/bin/startup.sh // start the service

Test show or error.

[Root @ localhost ~] # vim /usr/local/tomcat8/webapps/manager/META-INF/context.xml // ip it allowed all disabled

->
<= antiResourceLocking the Context "to false" Privileged = "to true">
<-! <Valve className = "org.apache.catalina.valves.RemoteAddrValve" // <-! -> The use of these symbols to allowed ip to disable
the allow = "127 \ \ D + \ \ D + \ \ D + | ::. 1 | 0:... 0: 0: 0: 0: 0: 0:. 1" /> ->
<Manager sessionAttributeValueClassNameFilter = "java \ .lang \ ( ?: Boolean | Integer | Long | Number | String) | org \ .apache \ .catalina \ .filters \ .CsrfPreventionFilter \ $ LruCache. (:? \ $ 1) |? java \. util \. (?: Linked)? HashMap "/>
</ Context>

[Root @ localhost ~] # /usr/local/tomcat8/bin/shutdown.sh // Close

[Root @ localhost ~] # /usr/local/tomcat8/bin/startup.sh // restart

  The next test is to use a password that we created, the user password is tomcat tomcat

 

 And there are sensitive information, usually in the test machine to do the above.

 

Guess you like

Origin www.cnblogs.com/otherwise/p/11566874.html
Recommended