0

I'm trying to load SSL cert/key from the Docker secrets in NGINX configuration (based on that post) as follow

    # TLS config
    ssl_certificate      /run/secrets/localhost.crt;
    ssl_certificate_key  /run/secrets/localhost.key;
    ssl_session_cache    shared:SSL:10m;
    ssl_session_timeout  5m;
    ssl_ciphers          HIGH:!aNULL:!MD5;
    ssl_protocols        TLSv1.1 TLSv1.2;

but this will error out as

2020/11/03 23:25:40 [emerg] 1#1: cannot load certificate "/run/secrets/localhost.crt": PEM_read_bio_X509_AUX() failed (SSL: error:0909006C:PEM routines:get_name:no start line:Expecting: TRUSTED CERTIFICATE)

nginx: [emerg] cannot load certificate "/run/secrets/localhost.crt": PEM_read_bio_X509_AUX() failed (SSL: error:0909006C:PEM routines:get_name:no start line:Expecting: TRUSTED CERTIFICATE)

When I will list /run/secerts locations I will see cert and key (both with size 0)

When I will copy cert and key from /run/secrets during the build time and update NGINX configuration to

   ssl_certificate      /etc/ssl/localhost.crt;
   ssl_certificate_key  /etc/ssl/localhost.key;

that will work fine.

Any thoughts why I can't access them directly from /run/secrets during the run time?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.