After filling out everything which sudo gitlab-ci-multi-runner register requires I get:
ERRO[0019] xxx Registering runner... failed couldn't execute POST against https://git.example.com/ci/api/v1/runners/register.json: Post https://git.example.com/ci/api/v1/runners/register.json: x509: certificate signed by unknown authorityFATA[0019] Failed to register this runner. Perhaps you are having network problems
I'm using a self-signed certificate without a valid root-certificate.
How can I trust this certificate so I can get the runner up and running?
Designs
Child items
...
Show closed items
Linked items
0
Link issues together to show that they're related or that one is blocking others.
Learn more.
ERRO[0002] 1dae8a68 Registering runner... failed couldn't execute POST against https://mygitlab.example.com/ci/api/v1/runners/register.json: Post https://mygitlab.example.com/ci/api/v1/runners/register.json: x509: certificate signed by unknown authority (possibly because of "x509: invalid signature: parent certificate cannot sign this kind of certificate" while trying to verify candidate authority certificate "mygitlab.example.com") FATA[0002] Failed to register this runner. Perhaps you are having network problems
I think that #267 (closed) doesn't fit self-signed certificate or am i missing something?
ERRO[0011] cabbbd8c Registering runner... failed couldn't execute POST against https://git.etaminstud.io/ci/api/v1/runners/register.json: Post https://git.mycompany.com/ci/api/v1/runners/register.json: x509: certificate signed by unknown authorityFATA[0011] Failed to register this runner. Perhaps you are having network problemsroot@ci-runner1:/usr/local/share/ca-certificates# curl https://git.mycompany.comcurl: (60) SSL certificate problem: unable to get local issuer certificate
First, check the certificate chain:
$ openssl s_client -connect git.mycompany.com:443
In my case I had:
Certificate chain 0 s:/OU=Domain Control Validated/OU=Gandi Standard SSL/CN=git.mycompany.com i:/C=FR/ST=Paris/L=Paris/O=Gandi/CN=Gandi Standard SSL CA 2
It means that on my Gitlab instance, I was using a simple SSL certificate, not chained to an intermediate certificate or cross-signed certificate. That was the issue.
Here is how I solved it on my Gitlab omnibus instance:
$ cd /etc/gitlab/ssl
Download the intermediate certificate from your provider (mine is Gandi.net, documentation here):
If nginx has trouble restarting, there is something wrong with the way you concatenated your certificates. Make sure they were all in the same format (DER or PEM).
Then, from your gitlab-ci-multi-runner instance, check the certificate chain:
$ openssl s_client -connect git.mycompany.com:443
You should see something like this:
Certificate chain 0 s:/OU=Domain Control Validated/OU=Gandi Standard SSL/CN=git.mycompany.com i:/C=FR/ST=Paris/L=Paris/O=Gandi/CN=Gandi Standard SSL CA 2 1 s:/C=FR/ST=Paris/L=Paris/O=Gandi/CN=Gandi Standard SSL CA 2 i:/C=US/ST=New Jersey/L=Jersey City/O=The USERTRUST Network/CN=USERTrust RSA Certification Authority 2 s:/C=US/ST=New Jersey/L=Jersey City/O=The USERTRUST Network/CN=USERTrust RSA Certification Authority i:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root
@ayufan the runner has diffinitly a problem, curl successfully reaches gitlab using --cacert on the container.
temporary workaround on ubuntu images:
create an alternative entryoint `/entrypoint2``
# this will trust the certificate at the os level, and allow the runner to register.cp /etc/gitlab-runner/certs/ca.crt /usr/local/share/ca-certificates/[WHATEVER_NAME].crtupdate-ca-certificates/entrypoint $@
and then
docker run -v CA_CERTIFICATE:/etc/gitlab-runner/certs/ca.crt -v entrypoint:/entrypoint2 --entrypoint /entrypoint2 gitlab/gitlab-runner:latest
BUT the issue perssist with docker runners, git doesn't trust the certificate on builds with the following error
Cloning into '/builds/xxxxx'...fatal: unable to access 'https://gitlab-ci-token:xxxxxx@repos/repo.git':server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
I guess the runner must inform git to trust the CA on the created build containers too.
@ayufan I read the doc and it's promising so far, I just would like to suggest make the runner automatically mount the certificate file corresponding to gitlab host in the created containers (docker mode), I think about the standard path /etc/ssl/certs/gitlab-trusted.crt, this way instead of using GIT_SSL_NO_VERIFY just automatically provide the GIT_SSL_CAINFO
You need both CA certificate and server certificate to make self-signed certificates work. See this gist for a full example.
Using a plain self-signed certificate without a CA fails with x509: certificate signed by unknown authority (possibly because of "x509: invalid signature: parent certificate cannot sign this kind of certificate" while trying to verify candidate authority certificate "example.com") ← note the parent certificate cannot sign this kind of certificate part of the error message.
Things I did:
since I am no certificate expert, and our certificate department may need days to respond,
1:
ex +'g/BEGIN CERTIFICATE/,/END CERTIFICATE/p' <(echo | openssl s_client -showcerts -connect ourserver.com:443) -scq
copy that in the path in the runner is /etc/gitlab-runner/certs/ourserver.com.crt
2:
I have copied and pasted in a single file all the certificates that exists on our gitlab omnibus server.
every time the same errors.
yum info gitlab-ceFailed to set locale, defaulting to CLoaded plugins: aliases, changelog, fastestmirror, kabi, langpacks, tmprepo, verify, versionlockLoading support for Red Hat kernel ABILoading mirror speeds from cached hostfile * base: mirrors.ircam.fr * epel: mirrors.ircam.fr * extras: centos.mirror.ate.info * updates: mirrors.ircam.frInstalled PackagesName : gitlab-ceArch : x86_64Version : 9.3.2Release : ce.0.el7Size : 1.0 GRepo : installedFrom repo : gitlab_gitlab-ceSummary : GitLab Community Edition (including NGINX, Postgres, Redis)URL : https://about.gitlab.com/License : MITDescription : GitLab Community Edition (including NGINX, Postgres, Redis)
the path in the runner is /etc/gitlab-runner/certs/ourserver.com.crt
gitlab-runner register --non-interactive --url https://ourserver.com/ --registration-token "yALSNBKJCznSsK5zsnzZ"Running in system-mode.ERROR: Registering runner... failed runner=yALSNBKJ status=couldn't execute POST against https://ourserver.com/api/v4/runners: Post https://ourserver.com/api/v4/runners: x509: certificate signed by unknown authorityERROR: Checking GitLab compatibility... not-compatible reason=GitLab Runner >= 9.0 can be used ONLY with GitLab CE/EE >= 9.0 result=-1 runner=yALSNBKJ statusText=couldn't execute POST against https://ourserver.com/api/v4/runners/verify: Post https://ourserver.com/api/v4/runners/verify: x509: certificate signed by unknown authorityPANIC: Failed to register this runner. Perhaps you are having network problems