• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Trying to log in to Tomcat manager using hashed password.

 
Ranch Hand
Posts: 417
  • Number of slices to send:
    Optional 'thank-you' note:
I've my tomcat-users.xml defined this way:



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



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 user, "jack" and the "password" for which hash exists above. It doesn't work. Is there an additiona steps I need to fix above issue?
 
Saloon Keeper
Posts: 27868
196
  • Number of slices to send:
    Optional 'thank-you' note:
So when you see the login form, you type "jack" in the userid box and "4f60ef32b9f4cf8a30d85167c9575e627d1f03845575a620ff5654b85eb29add$1$15a54860775edfab43b7010aed9ca814c6647f5b1c07253cbcdac7dc80e07833ee9ae5392aac0b7ba96760100a1462dcc51ed91cb8c4768bba1de77193f0ad57" in the password box?

Because otherwise who's going to handle the crptography? Tomcat won't.
 
Jack Tauson
Ranch Hand
Posts: 417
  • Number of slices to send:
    Optional 'thank-you' note:

Tim Holloway wrote:So when you see the login form, you type "jack" in the userid box and "4f60ef32b9f4cf8a30d85167c9575e627d1f03845575a620ff5654b85eb29add$1$15a54860775edfab43b7010aed9ca814c6647f5b1c07253cbcdac7dc80e07833ee9ae5392aac0b7ba96760100a1462dcc51ed91cb8c4768bba1de77193f0ad57" in the password box?

Because otherwise who's going to handle the crptography? Tomcat won't.



No, I am typing "password" for password but storing it as a hash in tomcat-users.xml. How to handle this if tomcat won't handle this?
 
Tim Holloway
Saloon Keeper
Posts: 27868
196
  • Number of slices to send:
    Optional 'thank-you' note:
You cannot. Besides, there's more than one encryption algorithm in the world, so even if this particular Realm supported such a feature you'd need to make sure it was configured for it.

Tomcat doesn't need encrypted passwords. Tomcat goes to great lengths to ensure that when you type in a password, it isn't going to be visible to anything but the Tomcat login service, which is quite secure. Tomcat NEVER fetches a passsword, only submits it to a Realm for the Realm to check. And Realms don't fetch passwords either, if they can help it.

The main case where you'd have an encrypted password in Tomcat is if the userid/password was stored in an external database. In which case, you'd encrypt the password IN THE DATABASE, and the Realm would have to do a query in the form "SELECT COUNT(*) FROM users WHERE user_id=? AND ENCRYPT(password) =?". In which case, the actual encryption and checking would be done entirely within the database server, not in Tomcat. You would typically use an encrypted (SSL-style) channel from Tomcat to the database server to avoid network snoops.

Encrypting the password in the database means that even if someone queried the database outside of Tomcat, they wouldn't be able to retrieve the password in a form that Tomcat would match in its Realm processes.

Again, the tomcat-users.xml file isn't really intended for serious production use, so it is not encrypted. Its protection is managed via the OS file-level protections. Which is to say that only the OS "tomcat" user should have the ability to read or write it.
 
Jack Tauson
Ranch Hand
Posts: 417
  • Number of slices to send:
    Optional 'thank-you' note:

Tim Holloway wrote:You cannot. Besides, there's more than one encryption algorithm in the world, so even if this particular Realm supported such a feature you'd need to make sure it was configured for it.

Tomcat doesn't need encrypted passwords. Tomcat goes to great lengths to ensure that when you type in a password, it isn't going to be visible to anything but the Tomcat login service, which is quite secure. Tomcat NEVER fetches a passsword, only submits it to a Realm for the Realm to check. And Realms don't fetch passwords either, if they can help it.

The main case where you'd have an encrypted password in Tomcat is if the userid/password was stored in an external database. In which case, you'd encrypt the password IN THE DATABASE, and the Realm would have to do a query in the form "SELECT COUNT(*) FROM users WHERE user_id=? AND ENCRYPT(password) =?". In which case, the actual encryption and checking would be done entirely within the database server, not in Tomcat. You would typically use an encrypted (SSL-style) channel from Tomcat to the database server to avoid network snoops.

Encrypting the password in the database means that even if someone queried the database outside of Tomcat, they wouldn't be able to retrieve the password in a form that Tomcat would match in its Realm processes.

Again, the tomcat-users.xml file isn't really intended for serious production use, so it is not encrypted. Its protection is managed via the OS file-level protections. Which is to say that only the OS "tomcat" user should have the ability to read or write it.



Hmm, one username and password in my production tomcat has this thing working already and I'm having issues in figuring out why adding an additional user and password with SHA512 hash is not logging that user. Not sure from where to start to figure out how existing case works.
 
Tim Holloway
Saloon Keeper
Posts: 27868
196
  • Number of slices to send:
    Optional 'thank-you' note:
As I said. Tomcat doesn't want anything to do with your hashed/encrypted passwords. It wants the tomcat-users.xml file to keep passwords in plain text and that's it.

Also, please don't quote me in entirety. It's redundant and wastes space.
 
Ranch Hand
Posts: 192
  • Number of slices to send:
    Optional 'thank-you' note:
Tim, what about jdbc passwords stored in conf/Catalina/localhost/MyDb.xml?

 
Tim Holloway
Saloon Keeper
Posts: 27868
196
  • Number of slices to send:
    Optional 'thank-you' note:

Thomas Griffith wrote:Tim, what about jdbc passwords stored in conf/Catalina/localhost/MyDb.xml?



That file should be describing a webapp accessable from http://localhost:8080/MyDb. The Resource defines something that Tomcat will store in that webapp's JNDI dictionary. Typically it would also specify type="javax.sql.DataSource", which would define a Datasource Connection Pool that the webapp would use. It has no direct connection to Tomcat security.

Tomcat's security is managed by plugins to Tomcat itself and not to the webapp. The security modules are called Realms and there are a specific set of APIs (Interfaces( that define Realms so that Tomcat knows how to talk to them.

The most important method a Realm module presents is the authenticate() method. This is an overloaded method from org.apache.catalina.realm.RealmBase, but the most common invocation is for Tomcat to pass 2 arguments that it obtains from the LoginForm or dialog: juserid and jpassword. These arguments are always cleaf-text strings, never encrypted. Tomcat assumes your client login was done via SSL. it trusts its own internal security, so there's no need for encryption there.

If the Realm talks to an external data repository (most do), it is up the the Realm implementation as to whether or not to use encryption at that point. For the JDBC Realm, you can provide a JDBC query such as "SELECT COUNT(*) FROM my_user WHERE user_id = ? AND password = CRYPT(?)". And/or use an encrypted network connection to the JDBC server.

As I've said before, the tomcat-users.xml file is not intended for production use, so it doesn't make any provision for encryption. Since it's typically stored in the Tomcat directory tree, it's as secure — or not — as the rest of Tomcat.
 
reply
    Bookmark Topic Watch Topic
  • New Topic
vceplus-200-125    | boson-200-125    | training-cissp    | actualtests-cissp    | techexams-cissp    | gratisexams-300-075    | pearsonitcertification-210-260    | examsboost-210-260    | examsforall-210-260    | dumps4free-210-260    | reddit-210-260    | cisexams-352-001    | itexamfox-352-001    | passguaranteed-352-001    | passeasily-352-001    | freeccnastudyguide-200-120    | gocertify-200-120    | passcerty-200-120    | certifyguide-70-980    | dumpscollection-70-980    | examcollection-70-534    | cbtnuggets-210-065    | examfiles-400-051    | passitdump-400-051    | pearsonitcertification-70-462    | anderseide-70-347    | thomas-70-533    | research-1V0-605    | topix-102-400    | certdepot-EX200    | pearsonit-640-916    | itproguru-70-533    | reddit-100-105    | channel9-70-346    | anderseide-70-346    | theiia-IIA-CIA-PART3    | certificationHP-hp0-s41    | pearsonitcertification-640-916    | anderMicrosoft-70-534    | cathMicrosoft-70-462    | examcollection-cca-500    | techexams-gcih    | mslearn-70-346    | measureup-70-486    | pass4sure-hp0-s41    | iiba-640-916    | itsecurity-sscp    | cbtnuggets-300-320    | blogged-70-486    | pass4sure-IIA-CIA-PART1    | cbtnuggets-100-101    | developerhandbook-70-486    | lpicisco-101    | mylearn-1V0-605    | tomsitpro-cism    | gnosis-101    | channel9Mic-70-534    | ipass-IIA-CIA-PART1    | forcerts-70-417    | tests-sy0-401    | ipasstheciaexam-IIA-CIA-PART3    | mostcisco-300-135    | buildazure-70-533    | cloudera-cca-500    | pdf4cert-2v0-621    | f5cisco-101    | gocertify-1z0-062    | quora-640-916    | micrcosoft-70-480    | brain2pass-70-417    | examcompass-sy0-401    | global-EX200    | iassc-ICGB    | vceplus-300-115    | quizlet-810-403    | cbtnuggets-70-697    | educationOracle-1Z0-434    | channel9-70-534    | officialcerts-400-051    | examsboost-IIA-CIA-PART1    | networktut-300-135    | teststarter-300-206    | pluralsight-70-486    | coding-70-486    | freeccna-100-101    | digitaltut-300-101    | iiba-CBAP    | virtuallymikebrown-640-916    | isaca-cism    | whizlabs-pmp    | techexams-70-980    | ciscopress-300-115    | techtarget-cism    | pearsonitcertification-300-070    | testking-2v0-621    | isacaNew-cism    | simplilearn-pmi-rmp    | simplilearn-pmp    | educationOracle-1z0-809    | education-1z0-809    | teachertube-1Z0-434    | villanovau-CBAP    | quora-300-206    | certifyguide-300-208    | cbtnuggets-100-105    | flydumps-70-417    | gratisexams-1V0-605    | ituonline-1z0-062    | techexams-cas-002    | simplilearn-70-534    | pluralsight-70-697    | theiia-IIA-CIA-PART1    | itexamtips-400-051    | pearsonitcertification-EX200    | pluralsight-70-480    | learn-hp0-s42    | giac-gpen    | mindhub-102-400    | coursesmsu-CBAP    | examsforall-2v0-621    | developerhandbook-70-487    | root-EX200    | coderanch-1z0-809    | getfreedumps-1z0-062    | comptia-cas-002    | quora-1z0-809    | boson-300-135    | killtest-2v0-621    | learncia-IIA-CIA-PART3    | computer-gcih    | universitycloudera-cca-500    | itexamrun-70-410    | certificationHPv2-hp0-s41    | certskills-100-105    | skipitnow-70-417    | gocertify-sy0-401    | prep4sure-70-417    | simplilearn-cisa    |
http://www.pmsas.pr.gov.br/wp-content/    | http://www.pmsas.pr.gov.br/wp-content/    |