Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-13351

keystore specified in Jenkins startup is not used to make ssl call to crowd

    Details

    • Similar Issues:

      Description

      I noticed that when I ran Jenkins under https and specified the keystore to use as per http://wiki.hudson-ci.org/display/HUDSON/Starting+and+Accessing+Hudson that I was unable to connect to our https instance of crowd. I verified that the keystore contained the correct certificates but testing the connection though jenkins always resulted in an ssl error.

      In order to get around this I had to specify the keystore path as a java argument:
      JAVA_ARGS="-Djavax.net.ssl.trustStore=/opt/etc/keystore -Djavax.net.ssl.trustStorePassword=*****"

      It appears that the crowd plugin is not using the credentials that are being used to start up winstone.

        Attachments

          Activity

          Hide
          t_heit Thorsten Heit added a comment -

          Hi,

          after digging a lot through the source code of Crowd, Jenkins and Winstone, the servlet container used by Jenkins, it seems to me that it isn't actually possible:

          As far as I can tell, Winstone uses its own mechanism to read and extract the certificates contained in your keystore; see src/java/winstone/ssl/HttpsListener#getSSLContext() in the Winstone source code. The keystore file to use and its password must be specified on the command line with the additional Winstone-specific parameters --httpsKeyStore and --httpsKeyStorePassword.

          The Crowd REST API on the other hand uses Apache Jakarta HttpClient for the communication with your Crowd server. So far I haven't found whether it's possible at all to extract / receive the startup parameters given to Jenkins.

          Apart from that it's not possible to (re-)configure the HttpClient components used internally in the REST client and inform them there's a certain keystore and password to use - the corresponding variables / objects are private and not accessible from outside of the REST client. Therefore you'd have to specify the necessary system properties by setting them in the JVM command line as you already found out.

          But...:

          According to the JSSE Reference Guide ([1], [2]) you can perhaps make life a bit easier by putting your keystore into the file <java-home>/lib/security/jssecacerts that is used when the system property javax.net.ssl.trustStore isn't specified; see in the guide under "Key Classes -> Support Classes and Interfaces -> X509TrustManager Interface".

          The section "Customization -> How to Specify a java.security.Security Property" also mentions that you can add (additional) security properties to the file <java-home>/lib/security/java.security. I haven't tried it and therefore can't tell whether that works, but if yes, add the property with your keystore password to that file (javax.net.ssl.trustStorePassword=<mypassword>), and in combination with the jssecacerts file you eventually can get rid of the additional command line parameters.

          [1] http://docs.oracle.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html
          [2] http://docs.oracle.com/javase/7/docs/technotes/guides/security/jsse/JSSERefGuide.html

          Show
          t_heit Thorsten Heit added a comment - Hi, after digging a lot through the source code of Crowd, Jenkins and Winstone, the servlet container used by Jenkins, it seems to me that it isn't actually possible: As far as I can tell, Winstone uses its own mechanism to read and extract the certificates contained in your keystore; see src/java/winstone/ssl/HttpsListener#getSSLContext() in the Winstone source code. The keystore file to use and its password must be specified on the command line with the additional Winstone-specific parameters --httpsKeyStore and --httpsKeyStorePassword . The Crowd REST API on the other hand uses Apache Jakarta HttpClient for the communication with your Crowd server. So far I haven't found whether it's possible at all to extract / receive the startup parameters given to Jenkins. Apart from that it's not possible to (re-)configure the HttpClient components used internally in the REST client and inform them there's a certain keystore and password to use - the corresponding variables / objects are private and not accessible from outside of the REST client. Therefore you'd have to specify the necessary system properties by setting them in the JVM command line as you already found out. But...: According to the JSSE Reference Guide ( [1] , [2] ) you can perhaps make life a bit easier by putting your keystore into the file <java-home>/lib/security/jssecacerts that is used when the system property javax.net.ssl.trustStore isn't specified; see in the guide under "Key Classes -> Support Classes and Interfaces -> X509TrustManager Interface". The section "Customization -> How to Specify a java.security.Security Property" also mentions that you can add (additional) security properties to the file <java-home>/lib/security/java.security . I haven't tried it and therefore can't tell whether that works, but if yes, add the property with your keystore password to that file ( javax.net.ssl.trustStorePassword=<mypassword> ), and in combination with the jssecacerts file you eventually can get rid of the additional command line parameters. [1] http://docs.oracle.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html [2] http://docs.oracle.com/javase/7/docs/technotes/guides/security/jsse/JSSERefGuide.html
          Hide
          t_heit Thorsten Heit added a comment -

          Hi,

          what about this issue?
          Do you have any further information about your problem?
          Have you perhaps tried the hint I mentioned?

          Regards

          Thorsten

          Show
          t_heit Thorsten Heit added a comment - Hi, what about this issue? Do you have any further information about your problem? Have you perhaps tried the hint I mentioned? Regards Thorsten

            People

            • Assignee:
              t_heit Thorsten Heit
              Reporter:
              thorarakis Christopher Stephens
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: