Trying to log in to Tomcat Manager using encrypted password generated using digest.bat

170 Views Asked by At

I've my tomcat-users.xml defined this way on Windows 11, tomcat version 9.0.78:

<?xml version="1.0" encoding="UTF-8"?>
<tomcat-users xmlns="http://tomcat.apache.org/xml"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
              version="1.0">
<role rolename="tomcat"/>
  <role rolename="manager-gui"/>
  <role rolename="admin-gui"/>
  <user username="jack" password="4f60ef32b9f4cf8a30d85167c9575e627d1f03845575a620ff5654b85eb29add$1$15a54860775edfab43b7010aed9ca814c6647f5b1c07253cbcdac7dc80e07833ee9ae5392aac0b7ba96760100a1462dcc51ed91cb8c4768bba1de77193f0ad57" roles="tomcat,manager-gui,admin-gui"/>
  <user username="TomcatJackAdmin" password="test" roles="manager-gui"/>
</tomcat-users>

And I've generated the hash like this from my bin directory :

bin>.\digest.bat -a SHA-512 -h org.apache.catalina.realm.MessageDigestCredentialHandler password

When I login to Tomcat Manager (tomcat 9.0.78) on Windows using TomcatJackAdmin and test, it works fine. But I'm trying to use the encrypted stuff, username- jack and the password for which hash exists above. It doesn't work. Are there an additional steps I need to fix the above issue?

1

There are 1 best solutions below

0
dk.adil On
  • generated the hash like this from bin directory:

digest.bat -a sha-256 admin

Change the password with the hash in tomcat-users.xml Add in server.xml:

<CredentialHandler className="org.apache.catalina.realm.MessageDigestCredentialHandler" algorithm="SHA-256" />

as a result :

<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase">
     <CredentialHandler className="org.apache.catalina.realm.MessageDigestCredentialHandler" algorithm="SHA-256" />
</Realm>