0

I'm not very familiar with SSL certificates/handshakes and I have a big problem now.

I want to get access to an URL https://myhost:443/ inside a docker container. The URL is defined in apache virtualhost, and it's using HTTPS with a certificate httpd.crt:

    SSLCertificateFile /etc/pki/certs/httpd.crt
    SSLCertificateKeyFile /etc/pki/private/httpd.key

But when I try to get access to https://myhost:443/api inside a docker container, I get this:

PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Basically I have no right to make SSL connection because I do not have certificate in the container.

My problem is, how to make the HTTPS connection work? Do I need to put the same certificate(httpd.crt) inside the container? Where should I put it?

Thank you in advance.

hawarden_
  • 1,904
  • 5
  • 28
  • 48

1 Answers1

1

Looking at this link, I would say you have 2 ways:

  1. You could create a docker image with the JAVA_HOME/jre/lib/security/cacerts file edited with the certificated added.

  2. Or, if security is not that important in this case, you could pass java vm some parameters on the container creation docker run -e JAVA_OPTS='-Djavax.net.ssl.trustStore' <image-name>. I took this from here.

Hope this helps.

Community
  • 1
  • 1
AxelWass
  • 1,321
  • 12
  • 21