Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSL CA Certificate loading is broken... #199

Closed
brendandburns opened this issue Feb 23, 2018 · 11 comments
Closed

SSL CA Certificate loading is broken... #199

brendandburns opened this issue Feb 23, 2018 · 11 comments
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@brendandburns
Copy link
Contributor

We try to load the CA certificate twice, but the InputStream is exhausted...

@ceeaspb
Copy link
Contributor

ceeaspb commented Feb 23, 2018

@brendandburns I have left comments in #197

@karthikkondapally
Copy link
Contributor

@brendanburns
if this is about the below error

Exception in thread "main" java.lang.IllegalArgumentException: expected non-empty set of trusted certificates 
at io.kubernetes.client.ApiClient.applySslSettings(ApiClient.java:1134)

it is because of default value of verifySSl being true.
error vanished for me, once i added insecure-skip-tls-verify: true in kubeconfig.yaml (in cluster section).
or setVerifySSL to true using ClientBuilder.
Config.defaultClient().setVerifyingSsl(false) also throws the error, as applySslSettings(); is called in defaultClient() before setting verifySSL to false.

@brendandburns
Copy link
Contributor Author

@kondapally1989 I don't think that's quite correct. The underlying problem is that applySslSettings can not be called more than once after the CA certificate has been set. We need to ultimately fix that in the ApiClient so that applySslSettings is idempotent...

@brendandburns
Copy link
Contributor Author

@ceeaspb I don't quite follow your comments... Can you clarify the issue you're seeing and the needed repro?

Thanks

@karthikkondapally
Copy link
Contributor

@brendanburns
my bad, read the issue in wrong way.
after keeping the line client.setSslCaCert(as in your push #200) at the end. its working without throwing non-empty error.

@ceeaspb
Copy link
Contributor

ceeaspb commented Feb 23, 2018

with #200 similarly it works. I didn't spot the PR earlier. thanks

@karthikkondapally
Copy link
Contributor

@brendanburns
I tried something, may be few pointers from you.
i cloned InputStream and passed the clone to certificateFactory.generateCertificates(sslCaCertCopy);
original sslCaCert will always persist.

        byte[] targetArray = null ;
        try {
          targetArray = new byte[sslCaCert.available()];
          sslCaCert.read(targetArray);
        }
        catch(Exception e) {
        }
        sslCaCert = new ByteArrayInputStream(targetArray);
        char[] password = null; // Any password will work.
        InputStream sslCaCertCopy =  new ByteArrayInputStream(targetArray);
        CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
        Collection<? extends Certificate> certificates = certificateFactory.generateCertificates(sslCaCertCopy);

above works without placing client.setSslCaCert at end of ClientBuilder
but ApiClient.java is a swagger generated code.

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 22, 2019
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels May 22, 2019
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests

5 participants