Repository navigation
fix: allowing cacerts and passwordless pkcs12 in non-strict - #54394
Conversation
eda6e2d to
25d46ef
Compare
There was a problem hiding this comment.
Looks good, thanks Steve.
| // passwordless pkcs12 is not supported by all providers, try SUN | ||
| if (StringUtil.isNullOrEmpty(password) && StringUtil.isNullOrEmpty(provider) && PKCS12.equalsIgnoreCase(type)) { | ||
| try { | ||
| return KeystoreUtil.loadKeyStore(path, password, type, "SUN"); |
There was a problem hiding this comment.
I'm not too happy about ad-hoc hardcoding SUN here. Can't we somehow try and find the first registered provider that supports passwordless keystore.
There was a problem hiding this comment.
@vmuzikar added a guard and updated the comment. In practical terms, we only expect this to be SUN - we only fully support OpenJDKs, and the other common VM implementations have a SUN provider. The only situation that wouldn't work is if the user has disabled the SUN provider and added another provider (other than bc / bcfips). Are you trying to cover that case?
|
Expanded the changes to incorporate what the other pr was trying to do - make an attempt to load the system truststore with the default password if not provided. The reasoning in the pr description is not valid - all of our supported JREs ship with a cacerts file that is pkcs12. JKS has not been the format for quite some time. However in a fips environment, or as an alternative to the SUN provider, trying to load cacerts with a password may work. |
closes: keycloak#54430 Signed-off-by: Steve Hawkins <shawkins@redhat.com>
Signed-off-by: Steve Hawkins <shawkins@redhat.com>
|
To build on the replies to copilot - starting with version 9 openjdk used pkcs12 for cacerts. Then in version 18+ it started using a passwordless pkcs12. Since we still support openjdk 17, it's proper to have the fallback to try the changeit password. All the certs we're interested in are public and are not encrypted - the password (if applicable) is only used in that case for integrity checking. |
Signed-off-by: Steve Hawkins <shawkins@redhat.com>
…#54394) * fix: allowing cacerts and passwordless pkcs12 in non-strict closes: keycloak#54430 Signed-off-by: Steve Hawkins <shawkins@redhat.com> * updating the attempts to load the cacerts as well Signed-off-by: Steve Hawkins <shawkins@redhat.com> * improving naming Signed-off-by: Steve Hawkins <shawkins@redhat.com> --------- Signed-off-by: Steve Hawkins <shawkins@redhat.com>


closes: #54430
Original was targeting this at #28526 because of #54171 - but a new issue is warranted as it clearly articulates the scenario.