Docker Community Forums

Share and learn in the Docker community.

Secure Docker behind NGinX with self-signed certificate and Nexus 3

docker

(Odupre) #1

Hi all,

I am trying to setup my Sonatype Nexus 3 as a docker registry.
I am using NGinX in front of Nexus.

I just followed that tutorial: https://docs.docker.com/engine/security/https/#create-a-ca-server-and-client-keys-with-openssl to generate a couple of certificates.
I setup my NginX as follow:
ssl config - customize as per your setup
ssl_certificate /home/agorha-ic/certificates/adgroupe.priv/server-cert.pem;
ssl_certificate_key /home/agorha-ic/certificates/adgroupe.priv/server-key.pem;
ssl_trusted_certificate /home/agorha-ic/certificates/adgroupe.priv/ca.pem;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_session_tickets off;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ‘ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK’;
ssl_prefer_server_ciphers on;
ssl_dhparam /home/agorha-ic/certificates/adgroupe.priv/dhparam.pem;

    ssl_stapling                    on;
    ssl_stapling_verify             on;

    add_header                      Strict-Transport-Security max-age=15768000;

But each time I’m trying to login to nexus with docker, it complains that the certificate is signed by an unknown authority.
Error response from daemon: Get https://nexus.adgroupe.priv/v1/users/: x509: certificate signed by unknown authority

I just don’t understand what I should do. I tried to put my CA and certificates in “/etc/docker/certs.d/nexus.adgroupe.priv” and in “/usr/local/share/ca-certificates/”, I tried to add --insecure-registry to “/etc/default/docker” and command line, … but nothing makes it work.

Do you guys have any ideas?

PS: Of course, I’m using a private name, so “Let’s Encrypt” just does not work…

Cheers,
Olivier.