• Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Major Major
    • winstone-jetty
    • None
    • Redhat Linux

      I am trying to start jenkins using a CA signed certificate but I am getting this error

      Running from: /usr/lib/jenkins/jenkins.war
      Apr 01, 2014 9:56:01 AM winstone.Logger logInternal
      INFO: Winstone shutdown successfully
      Apr 01, 2014 9:56:01 AM winstone.Logger logInternal
      SEVERE: Container startup failed
      java.io.IOException: Failed to start a listener: winstone.HttpsConnectorFactory
      at winstone.Launcher.spawnListener(Launcher.java:209)
      at winstone.Launcher.<init>(Launcher.java:149)
      at winstone.Launcher.main(Launcher.java:354)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at Main._main(Main.java:293)
      at Main.main(Main.java:98)
      Caused by: java.io.IOException: DerValue.getBigInteger, not an int 48
      at sun.security.util.DerValue.getBigInteger(DerValue.java:511)
      at winstone.HttpsConnectorFactory.readPEMRSAPrivateKey(HttpsConnectorFactory.java:171)
      at winstone.HttpsConnectorFactory.start(HttpsConnectorFactory.java:90)
      at winstone.Launcher.spawnListener(Launcher.java:207)
      ... 8 more

      Open ssl was used to generate the key and csr, then the CA gave us back the cert. What could be causing this error?

      JENKINS_ARGS="--httpsCertificate=/var/lib/jenkins/cert/cci-jenkins_uncc_edu_cert.cer --httpsPrivateKey=/var/lib/jenkins/cert/cci-jenkins.key"

          [JENKINS-22448] Add support for PKCS #8 private keys

          TJ Bryant created issue -

          Oleg Nenashev added a comment -

          Oleg Nenashev added a comment - Have you tried the resolution on http://serverfault.com/questions/569866/jenkins-wont-serve-with-ca-signed-certificate ?

          TJ Bryant added a comment -

          No I gave up because it was too much trouble. I decided to run Jenkins in tomcat and let apache handle the ssl. That was much easier.

          TJ Bryant added a comment - No I gave up because it was too much trouble. I decided to run Jenkins in tomcat and let apache handle the ssl. That was much easier.

          Daniel Beck added a comment -

          From the Server Fault question, answer, and solution regarding startssl this seems to be an issue with the certificates in a format Java (or maybe Jetty) cannot handle (please correct me if I'm wrong).

          For this reason, and because the reporter has given up on the issue, resolving as Won't Fix as there seems to be little that can be done about it in Jenkins.

          Daniel Beck added a comment - From the Server Fault question, answer, and solution regarding startssl this seems to be an issue with the certificates in a format Java (or maybe Jetty) cannot handle (please correct me if I'm wrong). For this reason, and because the reporter has given up on the issue, resolving as Won't Fix as there seems to be little that can be done about it in Jenkins.
          Daniel Beck made changes -
          Resolution New: Won't Fix [ 2 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

          After updating the renewed SSL cert into java keystore for HTTPS auth, Jenkins
          startup failed with below error. Still it works with the old expired SSL cert.
          I have verified the verified the java keystore and key cert password, I was
          able to list the keystore content and view the content of the .pfx used in the
          keystore using the passwords.

          Please assist to fix this error.

          svmftadm 19916 1 99 05:49 pts/0 00:00:09
          /opt/mft/shared/software/jdk/jdk1.7.0_51/bin/java
          -Djavax.net.ssl.trustStore=/opt/mft/admin/certs/ldapTrustStore
          -Djavax.net.ssl.keyStore=/opt/mft/admin/certs/ldapTrustStore
          -Djavax.net.ssl.keyStorePassword=xyz -jar /opt/mft/jenkins/jenkins.war
          --httpPort=-1 --httpsPort=9443 --httpsKeyStore=/opt/mft/jenkins/jenkins.jks
          --httpsKeyStorePassword=xyz

          lx0001[/opt/mft/jenkins]> cat jenkins.log
          Running from: /apps/mft/jenkins/jenkins.war
          webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
          Oct 10, 2014 5:36:02 AM winstone.Logger logInternal
          INFO: Beginning extraction from war file
          Oct 10, 2014 5:36:02 AM winstone.Logger logInternal
          INFO: Winstone shutdown successfully
          Oct 10, 2014 5:36:02 AM winstone.Logger logInternal
          SEVERE: Container startup failed
          java.io.IOException: Failed to start a listener: winstone.HttpsConnectorFactory
          at winstone.Launcher.spawnListener(Launcher.java:209)
          at winstone.Launcher.<init>(Launcher.java:149)
          at winstone.Launcher.main(Launcher.java:354)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at
          sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at
          sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:606)
          at Main._main(Main.java:293)
          at Main.main(Main.java:98)
          Caused by: winstone.WinstoneException: Error getting the SSL context object
          at
          winstone.HttpsConnectorFactory.getSSLContext(HttpsConnectorFactory.java:218)
          at
          winstone.HttpsConnectorFactory.createConnector(HttpsConnectorFactory.java:127)
          at winstone.HttpsConnectorFactory.start(HttpsConnectorFactory.java:116)
          at winstone.Launcher.spawnListener(Launcher.java:207)
          ... 8 more

          Sudhakar Shanmugam added a comment - After updating the renewed SSL cert into java keystore for HTTPS auth, Jenkins startup failed with below error. Still it works with the old expired SSL cert. I have verified the verified the java keystore and key cert password, I was able to list the keystore content and view the content of the .pfx used in the keystore using the passwords. Please assist to fix this error. svmftadm 19916 1 99 05:49 pts/0 00:00:09 /opt/mft/shared/software/jdk/jdk1.7.0_51/bin/java -Djavax.net.ssl.trustStore=/opt/mft/admin/certs/ldapTrustStore -Djavax.net.ssl.keyStore=/opt/mft/admin/certs/ldapTrustStore -Djavax.net.ssl.keyStorePassword=xyz -jar /opt/mft/jenkins/jenkins.war --httpPort=-1 --httpsPort=9443 --httpsKeyStore=/opt/mft/jenkins/jenkins.jks --httpsKeyStorePassword=xyz lx0001 [/opt/mft/jenkins] > cat jenkins.log Running from: /apps/mft/jenkins/jenkins.war webroot: EnvVars.masterEnvVars.get("JENKINS_HOME") Oct 10, 2014 5:36:02 AM winstone.Logger logInternal INFO: Beginning extraction from war file Oct 10, 2014 5:36:02 AM winstone.Logger logInternal INFO: Winstone shutdown successfully Oct 10, 2014 5:36:02 AM winstone.Logger logInternal SEVERE: Container startup failed java.io.IOException: Failed to start a listener: winstone.HttpsConnectorFactory at winstone.Launcher.spawnListener(Launcher.java:209) at winstone.Launcher.<init>(Launcher.java:149) at winstone.Launcher.main(Launcher.java:354) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at Main._main(Main.java:293) at Main.main(Main.java:98) Caused by: winstone.WinstoneException: Error getting the SSL context object at winstone.HttpsConnectorFactory.getSSLContext(HttpsConnectorFactory.java:218) at winstone.HttpsConnectorFactory.createConnector(HttpsConnectorFactory.java:127) at winstone.HttpsConnectorFactory.start(HttpsConnectorFactory.java:116) at winstone.Launcher.spawnListener(Launcher.java:207) ... 8 more

          Daniel Beck added a comment -

          Please direct your requests for assistance somewhere else. This is an issue tracker, not a support forum.

          Daniel Beck added a comment - Please direct your requests for assistance somewhere else. This is an issue tracker, not a support forum.

          Let me question the analysis by Daniel Beck.

          Is there any evidence that Jenkins supports PEM-formatted keys as claimed? Say, a regression test? The exception is thrown by Jenkins code that implements by hand parsing of key files, and that code has some TODOs that suggest it's not a correctness champion, and there's no link to what spec it is implementing. In fact, it's surprising that Jenkins code implements such low-level certificate parsing instead of using some library.

          https://github.com/jenkinsci/winstone/blob/f42497acd05d2ab69ae40875cfab0f9675777ef4/src/java/winstone/HttpsConnectorFactory.java#L148

          1. Jenkins documents supporting PEM keys.
          2. I have what looks like such a key generated with openssl.
          3. Jenkins fails on that key as documented in this issue.

             --httpsPrivateKey        = the location of the PEM-encoded SSL private key.
                                        (the one that starts with '-----BEGIN RSA PRIVATE KEY-----')
          

          I created a key with openssl:

          openssl req -nodes -newkey rsa:2048 -keyout kamino.key -out kamino-req.pem -subj $OMITTED
          

          the file starts with

          -----BEGIN PRIVATE KEY-----

          Paolo Giarrusso added a comment - Let me question the analysis by Daniel Beck. Is there any evidence that Jenkins supports PEM-formatted keys as claimed? Say, a regression test? The exception is thrown by Jenkins code that implements by hand parsing of key files, and that code has some TODOs that suggest it's not a correctness champion, and there's no link to what spec it is implementing. In fact, it's surprising that Jenkins code implements such low-level certificate parsing instead of using some library. https://github.com/jenkinsci/winstone/blob/f42497acd05d2ab69ae40875cfab0f9675777ef4/src/java/winstone/HttpsConnectorFactory.java#L148 1. Jenkins documents supporting PEM keys. 2. I have what looks like such a key generated with openssl. 3. Jenkins fails on that key as documented in this issue. --httpsPrivateKey = the location of the PEM-encoded SSL private key. (the one that starts with '-----BEGIN RSA PRIVATE KEY-----' ) I created a key with openssl: openssl req -nodes -newkey rsa:2048 -keyout kamino.key -out kamino-req.pem -subj $OMITTED the file starts with -----BEGIN PRIVATE KEY-----
          Paolo Giarrusso made changes -
          Resolution Original: Won't Fix [ 2 ]
          Status Original: Resolved [ 5 ] New: Reopened [ 4 ]
          Paolo Giarrusso made changes -
          Assignee New: Daniel Beck [ danielbeck ]

            Unassigned Unassigned
            tjbryant TJ Bryant
            Votes:
            4 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated: