Mongo DB Java Driver SSL

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: 3.5.0
    • Component/s: Configuration
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Hi Team,

      I am looking for help for SSL connection to mongo db through Java driver.

      I am able to connect to Mongo with SSL using key and cert and steps mentioned in mongodb documentation.

       

      JVM properties

                  System.setProperty("javax.net.ssl.trustStore", <keystorePath>);

                  System.setProperty("javax.net.ssl.trustStorePassword", <*******>);

                  System.setProperty("javax.net.ssl.trustStoreType", "JKS");

       

                  System.setProperty("javax.net.ssl.keyStore", <keystorePath>);

                  System.setProperty("javax.net.ssl.keyStorePassword", <*******>);

                  System.setProperty("javax.net.ssl.keyStoreType", "JKS");

      options = MongoClientOptions.builder().codecRegistry(codecRegistry).connectionsPerHost(100)

                              .connectTimeout(5000).readPreference(ReadPreference.primary())

                              .threadsAllowedToBlockForConnectionMultiplier(10).maxConnectionIdleTime(600000).sslEnabled(true)

                              .sslInvalidHostNameAllowed(true).build();

       

      But I am facing other problems with it, I have other functionality dependent on different certificate not working, seems setting above system property overwritten JVM cert keystore with mongodb certificate, So only mongo SSL is working, all other functionality need SSL connection failing.

      Is this correct understanding or I am doing wrong. In case its overwriting what should be the solution.

       

      Thanks,

      Siddharth Mehta

       

            Assignee:
            Unassigned
            Reporter:
            Siddharth Mehta
            None
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: