charts icon indicating copy to clipboard operation
charts copied to clipboard

[stable/jenkins] Unable to configure custom httpsKeyStore

Open aetherith opened this issue 6 years ago • 5 comments

Describe the bug When trying to use a custom Java keystore Jenkins fails to start up saying that there is no keystore at /var/jenkins_keystore/keystore.jks. I am trying to use a custom keystore to add an internal CA certificate to Java so that I can use LDAPS.

Version of Helm and Kubernetes: Helm: v3.1.1 Kubernetes: v1.17.2

Which chart: stable/jenkins

What happened: After installing the chart, the Jenkins container enters a crash loop. When viewing the logs Jenkins is reporting that there is no keystore at /var/jenkins_keystore/keystore.jks. The secret seems to be mounted correctly from a Kubernetes perspective and running the following lists the expected certificates in the keystore.

$ kubectl exec jenkins -c jenkins -- keytool -list -keystore /var/jenkins_keystore/keystore.jks -storepass password
Keystore type: jks
Keystore provider: SUN

Your keystore contains 2 entries

jenkinsci.com, Oct 8, 2019, PrivateKeyEntry
Certificate fingerprint (SHA1): <fingerprint>
example.com, Feb 27, 2020, trustedCertEntry
Certificate fingerprint (SHA1): <fingerprint>

Even trying to boot up with the keystore provided by default in the chart fails with the same error and keytool reports the same information (w/o the example.com certificate).

What you expected to happen: Jenkins would boot with customized keystore.

How to reproduce it (as minimally and precisely as possible):

# jenkins-values.yml
master:
  httpsKeyStore:
    enable: true

Anything else we need to know: Things I have tried:

  • Creating a new keystore with keytool, adding my certificate, and adding it base64 encoded to jenkinsKeystoreBase64Encoded. This creates a PKCS12 keystore.
  • Decoding the keystore provided by default in the chart, adding my certificate, reencoding it to jenkinsKeystoreBase64Encoded. This creates the older non-PKCS12 format keystore.
  • Manually creating a secret both with kubectl and by hand and passing it in via jenkinsHttpsJksSecretName. I've tried both of those methods with my new keystore, the one from the chart, and even one from my local Linux install.

All the methods listed above seem to fail with the same error, not being able to see the keystore file, which is odd because the file exists and can be read with the password provided.

aetherith avatar Feb 27 '20 19:02 aetherith

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions.

stale[bot] avatar Mar 28 '20 19:03 stale[bot]

Any updates on this issue

bdabburi3091 avatar Mar 31 '20 23:03 bdabburi3091

I think you're correct. I actually ended up "fixing" the issue in a post here:

https://thomascfoulds.com/2020/03/10/ldaps-in-jenkins-on-k8s.html

I still want to look into fixing the JAVA_OPTS issue I found while doing it but for now that will let you get the outbound connection working.

On April 3, 2020 15:58:36 Alex Zuroff [email protected] wrote:

I'm in the same boat - trying to get Jenkins to use a custom keystore for outgoing https calls (to AAD in our case).

Based on this section at the very end of the helm chart doc - https://github.com/helm/charts/tree/master/stable/jenkins#https-keystore-configuration

  • it looks like httpsKeyStore settings are for configuring Jenkins to serve https directly (instead of using a reverse proxy) and not for authenticating outgoing https calls.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

aetherith avatar Apr 03 '20 23:04 aetherith

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions.

stale[bot] avatar May 04 '20 00:05 stale[bot]

This issue is being automatically closed due to inactivity.

stale[bot] avatar May 18 '20 01:05 stale[bot]