Tomcat Digest with WebApp Manager

I am trying to get the digest password setting for tomcat manager application.

I have

<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase" digest="MD5"/>

in my tomcat server.xml, the web.xml manager web application has changed to use the digest and changed the name of the area to TESTING:

<login-config>
    <auth-method>DIGEST</auth-method>
    <realm-name>TESTING</realm-name>
  </login-config>

Then I used the included bat file to generate the md5 hash:

C:\tomcat6\bin>digest.bat -a MD5 tomcat:TESTING:testor
tomcat:TESTING:testor:1926e50988667dbd5deda9df02b82f28

Then I have a user in tomcat-users.xml with this digested hash as a password:

<!-- testor -->
  <user username="tomcat" password="1926e50988667dbd5deda9df02b82f28" roles="manager"/>

I also modified the 401.jsp page to use digest and TEST as the name of the area.

-, http://localhost:8080/manager/html . tomcat testor , enter, 401. , , 401.

, , , BASIC- SSL, ant , .

?

+3
5

KiaMorot Tomcat 8.0.32, . , "-s 0" ( lenth zero) :

sudo/opt/apache-tomcat-8.0.32/bin/digest.sh -s 0 -a MD5 ': UserDatabase:

" ". , .

, -s . digest.sh -s, , .

+2

:

digest.sh -a MD5 tomcat:UserDatabase:testor
+1

, server.xml, .

 <Resource
    auth="Container"
    description="User database that can be updated and saved"
    factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
    name="UserDatabase"  #<--------------NOTE
    pathname="conf/tomcat-users.xml"
    type="org.apache.catalina.UserDatabase"/>

name <Resource> resourceName <Realm>, .

<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
   resourceName="UserDatabase"  #<------------NOTE
   digest="MD5"/>

<realm-name> web.xml, .

<login-config>
    <auth-method>DIGEST</auth-method>
    <realm-name>UserDatabase</realm-name> #<------------NOTE
</login-config>

:

C:\tomcat6\bin > digest.bat -a MD5 tomcat: UserDatabase: testor

, , .

, tomcat7 tomcat8 MD5 must.

+1

. web.xml? /webapps/manager/WEB -INF/web.xml loginconfig.

, , , 8.0.26, md5.

0

1) : /bin > digest.bat -s 0 -a sha-256

: /bin > digest.bat -s 0 -a sha-256 admin

Password for use: 8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918

* Important note: you must use "-s 0" (salt 0), or it will not work.

2) paste the password above into the tomcat-users.xml file.

Example:

<!-- for password "admin" -->
<user username="tomcat" password="8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918" roles="manager-gui,manager,admin"></user>

3) configure server.xml to use SHA-256 hash passwords:

             

4) configure your web.xml to use the "DIGEST" passwords and update RealmName to match the above (in the HTMLManager section)

 <catalina_home>/webapps/manager\WEB-INF\web.xml

    <login-config>
        <auth-method>DIGEST</auth-method>
        <realm-name>UserDatabase</realm-name> 
    </login-config>

Full context:
  <servlet>
    <servlet-name>HTMLManager</servlet-name>
    <servlet-class>org.apache.catalina.manager.HTMLManagerServlet</servlet-class>
    <init-param>
      <param-name>debug</param-name>
      <param-value>2</param-value>
    </init-param>

… SNIPPED_FOR_BREVITY ...   

    <login-config>
    <auth-method>DIGEST</auth-method>
    <realm-name>UserDatabase</realm-name>
  </login-config>

    <multipart-config>
      <!-- 50MB max -->
      <max-file-size>52428800</max-file-size>
      <max-request-size>52428800</max-request-size>
      <file-size-threshold>0</file-size-threshold>
    </multipart-config>
  </servlet>
0
source

Source: https://habr.com/ru/post/1748623/


All Articles