Solving x509 Self-Signed Certificate Errors in Dockerized GitLab & Mattermost
Solving x509 Self-Signed Certificate Errors in Dockerized GitLab & Mattermost If you have ever deployed self-hosted GitLab alongside Mattermost using Docker or Omnibus in an enterprise intranet or air-gapped environment, you have almost certainly encountered this dreaded error: x509: certificate signed by unknown authority Everything seems to work fine when testing with curl -k or opening the web…
When running self-hosted GitLab alongside Mattermost using Docker or Omnibus in an enterprise environment, users often encounter the error "x509: certificate signed by unknown authority". This issue arises due to the strict certificate validation in Go services such as Mattermost when executed inside Docker containers. The problem stems from the fact that Go reads the system's Root CA bundle from specific operating system paths at startup, and container isolation prevents these certificates from being propagated into running containers.
To fix this issue, you must place the Root CA certificate on the host machine and mount it into the relevant containers. Additionally, trigger a certificate re-hashing process inside the GitLab container by running "docker exec -it gitlab gitlab-ctl reconfigure". This process generates the necessary OpenSSL hash symlinks and ensures the container has access to the compiled system CA store.
Verifying the TLS handshake from within the container using "openssl s_client" confirms that the issue has been resolved, allowing both GitLab and Mattermost to establish encrypted and verified TLS handshakes without errors.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.