Self-Signed Certificates
This guide configures DTaaS to work with self-signed TLS certificates. Internal servers that are not reachable from the public Internet need them, because they cannot get certificates from public certificate authorities such as Let's Encrypt.
Background
When DTaaS is installed with a self-signed certificate, the
traefik-forward-auth service must trust that certificate in order to
complete the OAuth 2.0 token exchange with the GitLab instance.
Otherwise, authentication fails with a certificate error, and the
logs of the traefik-forward-auth service contain this error:
Prerequisites
- Administrative access to the host
- A DTaaS installation using the secure server package
Step 1: Update the DNS Configuration
Containers in the secure-server package use the host's DNS configuration.
If the GitLab instance uses an internal DNS name that the public
Internet cannot resolve, add the correct nameserver to /etc/resolv.conf
on the Docker host so that the host can resolve it. Ask the IT department
for the correct values. For example:
Step 2: Create Local TLS Certificates with mkcert
Install mkcert if it is not already present, preferably with the OS
package manager:
Alternatively, download the binary from the mkcert releases page and verify its SHA-256 checksum against the value published on that page before installing:
Create a local root CA and server certificates:
Replace intocps.org with the actual hostname of the DTaaS installation.
Step 3: Build a Custom traefik-forward-auth Image
The traefik-forward-auth container must trust the local root CA.
Create a Dockerfile in the same directory as rootCA.crt:
Build the image:
Step 4: Use the Custom Image
In deploy/dtaas/docker/secure-server/docker-compose.yml, replace the
image reference image: thomseddon/traefik-forward-auth:latest with:
Step 5: Recreate the forward-auth Container
External GitLab with Self-Signed Certificates
If the GitLab OAuth provider is hosted on a separate server
(for example, gitlab.intocps.org) and also uses a self-signed certificate,
generate that certificate using the same mkcert root CA:
The custom traefik-forward-auth image already trusts the mkcert
root CA, so the OAuth token exchange succeeds.
Notes
- Certificates created with
mkcertare trusted only on the machine wheremkcert -installwas run. Other clients that access the DTaaS installation must also importrootCA.crtinto their trust store. - If the server has a valid public TLS certificate, this guide is not needed. Use the standard Let's Encrypt renewal guide instead.