Hi, I am trying to get my docker registry running again.
First my setup: The Gitlab WebGUI is behind a reverse proxy (ports 80 and 443). The SSH Port for cloning and the docker registry (port 5005) are bind to my public IPv4 address. I have a lets encrypt certificate which is configured on my nginx reverse proxy. My gitlab runs in a docker environment.
Now I tried to configure my docker registry in “gitlab.rb” to use the same certificate. To do that I copied the fullchain.pem and privkey.pem to mydomain.crt and mydomain.key under /etc/gitlab/ssl.
When I try to login with docker or try to let a runner running (I already had gitlab registry in use but then I switched to reverse proxy and also changed the domain) I get the following error:
ERROR: Preparation failed: Error response from daemon: Get https://mydomain:5005/v2/: x509: certificate signed by unknown authority (executor_docker.go:175:0s)
Hm, maybe Nginx doesn’t include the full chain required for validation. How do the portions in your Nginx config look like for adding the certificates? You may need the full pem there.
@dnsmichi
It hasn’t something to do with nginx. The ports 80 and 443 which are redirected over the reverse proxy are working.
The thing that is not working is the docker registry which is not behind the reverse proxy. It is bound directly to the public IPv4.
Ah, I see. Typical Monday where more coffee is needed
Then I would inspect whether only the .crt is enough for the configuration, of if you can use the pull PEM in that path, including the certificate chain.
@dnsmichi
I mentioned in my question that I copied fullchain.pem to /etc/gitlab/ssl/mydomain.crt and privkey.pem to mydomain.key. Is that the correct what I’ve done?
I also showed my config for registry_nginx where I give the path to the crt and the key. I am sure that this is right
It should be correct, that was a missing detail. I’m wondering though why the runner doesn’t pick it up, set aside from the openssl connect.
Did you register the runner before with a custom --tls-ca-file parameter before, shown here?
It should be seen in the runner config.toml, can you look for that specific setting (likewise, post the config from the runner without sensitive details).
Version: 1.11.5
OpenSSL 1.0.2n 7 Dec 2017
OpenSSL version does not support SSLv2
SSLv2 ciphers will not be detected
OpenSSL version does not support SSLv3
SSLv3 ciphers will not be detected
Testing SSL server mydomain on port 5005
TLS renegotiation:
Session renegotiation not supported
TLS Compression:
OpenSSL version does not support compression
Rebuild with zlib1g-dev package for zlib support
Heartbleed:
TLS 1.2 not vulnerable to heartbleed
TLS 1.1 not vulnerable to heartbleed
TLS 1.0 not vulnerable to heartbleed
Supported Server Cipher(s):
Preferred TLSv1.2 256 bits ECDHE-RSA-AES256-GCM-SHA384 Curve P-256 DHE 256
Accepted TLSv1.2 128 bits ECDHE-RSA-AES128-GCM-SHA256 Curve P-256 DHE 256
Accepted TLSv1.2 256 bits ECDHE-RSA-AES256-SHA384 Curve P-256 DHE 256
Accepted TLSv1.2 128 bits ECDHE-RSA-AES128-SHA256 Curve P-256 DHE 256
Accepted TLSv1.2 256 bits ECDHE-RSA-AES256-SHA Curve P-256 DHE 256
Accepted TLSv1.2 128 bits ECDHE-RSA-AES128-SHA Curve P-256 DHE 256
Accepted TLSv1.2 256 bits AES256-GCM-SHA384
Accepted TLSv1.2 128 bits AES128-GCM-SHA256
Accepted TLSv1.2 256 bits AES256-SHA256
Accepted TLSv1.2 128 bits AES128-SHA256
Accepted TLSv1.2 256 bits AES256-SHA
Accepted TLSv1.2 128 bits AES128-SHA
SSL Certificate:
Signature Algorithm: sha256WithRSAEncryption
RSA Key Strength: 2048
Subject: mydomain
Altnames: DNS:mydomain
Issuer: Let's Encrypt Authority X3
Not valid before: Nov 24 20:57:50 2019 GMT
Not valid after: Feb 22 20:57:50 2020 GMT
Ok, we are getting somewhere. You may see a German Telekom IP address in your logs, I’d suggest editing the web host above in your output.
So it is indeed the full chain missing in the certificate. I remember having that issue with Nginx a while ago myself.
You’re saying that you have the fullchain.pem and privkey.pem from Let’s Encrypt. Keep their names in the config, I’m not sure if that file suffix makes a difference.
@dnsmichi To answer the last question: Nearly yes. I am trying docker login mydomain:5005 and then I get asked for username and password.
I will show after the file permissions.
Within the CI job, the token is automatically assigned via environment variables. For your tests, you’ll need your username and the authorization token for the API. You can create that in your profile settings.
@dnsmichi is this new? A few versions before I didn’t needed that.
But this is not the problem. I generated a code with access to everything (after only api didn’t work) and it is still not working.
(I posted to much for my first day here so I had to wait :D)