GitLab: couldn’t execute POST against https://gitlab.mysite.com/api/v4/runners: Post “https://gitlab.mysite.com/api/v4/runners”: x509: certificate signed by unknown authority

Published on Author JFLeave a comment

When registering your runner, you might get this certificate error.

couldn't execute POST against https://gitlab.mysite.com/api/v4/runners: Post "https://gitlab.mysite.com/api/v4/runners": x509: certificate signed by unknown authority

In this case we’re using GoDaddy wildcards on our servers (for reasons).

Simple fix on the Runner itself:

mkdir /etc/gitlab-runner/certs

openssl s_client -showcerts -connect gitlab.mysite.com:443 -servername gitlab.mysite.com < /dev/null 2>/dev/null | openssl x509 -outform PEM > /etc/gitlab-runner/certs/gitlab.mysite.com.crt

This will copy the target server’s (gitlab.mysite.com) CRT into the Runner’s /etc/gitlab-runner/certs/ folder. Make sure you are using the complete FQDN as the cert name must match the target name/FQDN.

systemctl stop gitlab-runner
systemctl start gitlab-runner

gitlab-runner status

gitlab-runner register

That should do it.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.