Configuring Jenkins CLI tool with non-TrustStore TLS certificates

1 minute readAutomation

If your CloudBees CI instance has been secured with a non-TrustStore TLS certificate, then you may need to configure your local machine running the Jenkins CLI tool, to allow it to successfully communicate with CloudBees CI.

  1. Ensure that the keytool command is running on the machine that runs the Jenkins CLI tool.

  2. Obtain or download your CloudBees CI’s non-TrustStore TLS certificate directly from the web browser itself and name it (for example, cloudbees-ci.example.com.crt).

    In Firefox, this can be done by doing the following:

    1. Visit your CloudBees CI site.

    2. Select its padlock icon to the left of the URL field.

    3. Select the > to the right of Connection.

    4. Select More Information at the base of the resulting dialog box.

    5. On the Page Info dialog box, select the Security tab and then select the View Certificate button.

    6. On the Certificate Viewer dialog box, select the Details tab and then select the Export button.

  3. Create a keystore and import this certificate by running the following command (change the values as appropriate):

    keytool -import -noprompt -trustcacerts -alias cloudbees-ci.example.com -file cloudbees-ci.example.com.crt -keystore myKeystore -storepass changeme
  4. Test that the certificate configured in your keystore works and now provides your locally running Jenkins CLI tool access to your CloudBees CI instance by running this command:

    java -Djavax.net.ssl.trustStore=myKeystore -Djavax.net.ssl.trustStorePassword=changeme -jar jenkins-cli.jar -s https://cloudbees-ci.example.com/cjoc/ help

    If you receive a list of available Jenkins CLI commands in both cases, then your Jenkins CLI is now working.

  5. Update the alias file/s configured for your Jenkins CLI tool to insert these additional components between java and -jar:

    -Djavax.net.ssl.trustStore=myKeystore -Djavax.net.ssl.trustStorePassword=changeme