Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TLS stores are incorrectly configured - uses jakarta.net.ssl.* properties instead of javax.net.ssl.* #91

Closed
omarfi opened this issue Apr 14, 2023 · 1 comment

Comments

@omarfi
Copy link

omarfi commented Apr 14, 2023

ibmmq-jms-spring version(s):
3.0.3 and 3.0.5
Java version (including vendor and platform):
JDK 17 Zuul with Spring Boot 3

A small code sample that demonstrates the issue.
I get an error trying to connect to my MQ-server using the following properties specified in application.yml:

ibm.mq.jks.key-store=file://c:/keystore.p12
ibm.mq.jks.trust-storefile://c:/truststore.p12
ibm.mq.jks.key-store-password=test

However, if I replace this configuration with the following command-line params, everything works:

-Djavax.net.ssl.keyStore=c:/keystore.jks
-Djavax.net.ssl.trustStore=c:/truststore.p12
-Djavax.net.ssl.keyStorePassword=test

Possible cause:
com.ibm.mq.spring.boot.MQConnectionFactoryFactory#configureTLSStores seems to map MQConfigurationPropertiesJks to system properties with prefix jakarta.net.ssl.* and com.ibm.ssl.* instead of javax.net.ssl.* i.e.:

private static void configureTLSStores(MQConfigurationProperties props) {
        String[] prefixes = new String[]{"jakarta.net.ssl.", "com.ibm.ssl."};
        logger.trace("configuring TLS Store system properties");
        MQConfigurationPropertiesJks jksProperties = props.getJks();
        String[] var3 = prefixes;
        int var4 = prefixes.length;

        for(int var5 = 0; var5 < var4; ++var5) {
            String prefix = var3[var5];
            if (!isNullOrEmpty(jksProperties.getKeyStore())) {
                System.setProperty(prefix + "keyStore", jksProperties.getKeyStore());
            }

            if (!isNullOrEmpty(jksProperties.getKeyStorePassword())) {
                System.setProperty(prefix + "keyStorePassword", jksProperties.getKeyStorePassword());
            }

            if (!isNullOrEmpty(jksProperties.getTrustStore())) {
                System.setProperty(prefix + "trustStore", jksProperties.getTrustStore());
            }

            if (!isNullOrEmpty(jksProperties.getTrustStorePassword())) {
                System.setProperty(prefix + "trustStorePassword", jksProperties.getTrustStorePassword());
            }
        }

    }
@ibmmqmet
Copy link
Collaborator

Thanks for finding that. The script that automatically creates the jakarta variant from the base source code was a little too aggressive in its conversions. I'll fix it for the next update.

ibmmqmet added a commit that referenced this issue Apr 21, 2023
- Over-enthusiastic conversion to Jakarta names (#91)
@ibmmqmet ibmmqmet closed this as completed Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants