Bug 64955 - Keystore password not reset on reload
Summary: Keystore password not reset on reload
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: Main (show other bugs)
Version: 5.3
Hardware: All All
: P2 major (vote)
Target Milestone: JMETER 5.4.1
Assignee: JMeter issues mailing list
Keywords: FixedInTrunk, PatchAvailable
Depends on:
Reported: 2020-12-04 08:23 UTC by Michael Osipov
Modified: 2020-12-19 12:04 UTC (History)
2 users (show)

Ask again for password, when keystore can not be loaded (7.46 KB, patch)
2020-12-04 20:32 UTC, Felix Schumacher
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Osipov 2020-12-04 08:23:17 UTC
* Create a testplan with mutual TLS authentication
* Load a PKCS12 keystore through the SSL Manager
* Start the test and supply the requested password
* Load another store thourhg the SSL Manager
* No password dialog pops up. Log output says: 
020-12-04 09:21:48,307 INFO o.a.j.u.SSLManager: KeyStore created OK
2020-12-04 09:21:48,345 ERROR o.a.j.u.SSLManager: Problem loading keystore: keystore password was incorrect
java.io.IOException: keystore password was incorrect
	at sun.security.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:2078) ~[?:1.8.0_275]
	at java.security.KeyStore.load(KeyStore.java:1445) ~[?:1.8.0_275]
	at org.apache.jmeter.util.keystore.JmeterKeyStore.load(JmeterKeyStore.java:108) ~[ApacheJMeter_core.jar:5.3]
	at org.apache.jmeter.util.SSLManager.getKeyStor...

Obviously the password cache is not reset when a new keystore is loaded. I am forced to restart JMeter and load the other keystore.
Comment 1 Felix Schumacher 2020-12-04 20:32:40 UTC
Created attachment 37587 [details]
Ask again for password, when keystore can not be loaded
Comment 2 Felix Schumacher 2020-12-04 20:38:01 UTC
I have attached a patch to enable re-trying to ask for a password in case the given password could not be used to load keys from the keystore.

Would you be able to patch and build a JMeter and report back, if it helps in your case? Otherwise you would have to wait a few days, as we are currently doing a release and we have to prepare the trunk for the next cycle.

With this patch, I cleaned up the code a bit, too. I removed an old TODO whether a sync was needed in the password dialog. I decided, it was not needed, as it was called from within a synced region, only. The dialog has gotten a label, as I found it irritating to see a lonely input field with no real explanation (it was given in the title, which I did not read :))

Another enhancement would be to get the focus inside the password dialog.
Comment 3 Michael Osipov 2020-12-05 11:00:52 UTC
Thank you, will pick this up on Monday as soon as I get hands on the infrastructure at work.
Comment 4 Felix Schumacher 2020-12-06 10:40:47 UTC
@MichaelO you can try the next nightly, it should have the patch built in.

commit 6701514938f743d864956e4564db13776f7a1f02
Author: Felix Schumacher <felix.schumacher@internetallee.de>
AuthorDate: Sun Dec 6 11:29:43 2020 +0100

    Keystore password not reset on reload
    Bugzilla Id: 64955
 .../java/org/apache/jmeter/util/SSLManager.java    | 94 ++++++++++++++--------
 xdocs/changes.xml                                  |  1 +
 2 files changed, 61 insertions(+), 34 deletions(-)
Comment 5 Michael Osipov 2020-12-13 11:28:40 UTC
Awesome, just tried a snapshot from Jenkins. It does work. I did run the testplan with a keystore, switched the stored, supplied a new password and had success.

Thank you, looking forward to JMeter 5.4.1.
Comment 6 The ASF infrastructure team 2022-09-24 20:38:21 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/5442