2

I am running a ASP.NET Core container. This container sends a request to an api that is ssl encrypted by a self signed certificate. I need my container to trust the certificate, so that the request goes through. The Container is using microsoft/dotnet:2.1-aspnetcore-runtime as base so it is using ubuntu.

I have tried the following:

I exported the certificate on the server that holds the api and created a .crt with openssl by using the following command:

openssl pkcs12 -in exportedcert.pfx -clcerts -nokeys -out my.crt

Then I added the following to my Dockerfile:

ADD /my.crt /usr/local/share/ca-certificates/my.crt
RUN chmod 644 /usr/local/share/ca-certificates/my.crt && update-ca-certificates

The image builded perfectly but my application still throws: "AuthenticationException: The remote certificate is invalid according to the validation procedure."

Afterwards I tried adding this to the Dockerfile:

RUN apt-get update && apt-get install -y ca-certificates
COPY /my.crt /usr/local/share/ca-certificates/my.crt
RUN update-ca-certificates

The same error occured.

Does anyone know how I can add the certificate to the CA, so that the container trusts it? Did I create the certificate for the container in the wrong way? Any help is greatly appreciated.

Lycrosa
  • 51
  • 2
  • 8
  • https://stackoverflow.com/a/59960897/8767237 – Cometchaser Mar 13 '20 at 15:54
  • Does this answer your question? [How do I add a CA root certificate inside a docker image?](https://stackoverflow.com/questions/42292444/how-do-i-add-a-ca-root-certificate-inside-a-docker-image) – Jim G. Jul 15 '20 at 14:43

0 Answers0