When I generate certificate for e.g. proxmox I am able to perform the general procedure to make this Self-Signed certificate trusted.
But that is not the case with Traefik Routes
I followed these guides:
- Traefik Proxy 2.x and TLS 101 [Updated 2022] | Traefik Labs
-
How to create & sign SSL/TLS certificates - DEV Community
And everything in my setup is almost the same.
When it comes to generating the Certificate I try to generate a wildcard certificate to *.home
# 1. Generate CA's private key and self-signed certificate
openssl req -x509 -newkey rsa:4096 -days 3650 -nodes -keyout ca-key.pem -out ca-cert.pem -subj "/C=FR/ST=Occitanie/L=Toulouse/O=Tech School/OU=Education/CN=*.home/emailAddress=bartmok17@gmail.com"
echo "CA's self-signed certificate"
openssl x509 -in ca-cert.pem -noout -text
echo "subjectAltName=DNS:*.home" > server-ext.cnf
# 2. Generate web server's private key and certificate signing request (CSR)
openssl req -newkey rsa:4096 -nodes -keyout server-key.pem -out server-req.pem -subj "/C=FR/ST=Ile de France/L=Paris/O=PC Book/OU=Computer/CN=*.home/emailAddress=bartmok17@gmail.com"
# 3. Use CA's private key to sign web server's CSR and get back the signed certificate
openssl x509 -req -in server-req.pem -days 3650 -CA ca-cert.pem -CAkey ca-key.pem -CAcreateserial -out server-cert.pem -extfile server-ext.cnf
echo "Server's signed certificate"
openssl x509 -in server-cert.pem -noout -text
traefik-stack.j2
version: '3.5'
services:
reverse-proxy:
image: {{traefik_app_image}}
command:
- "--api.dashboard=true"
- "--providers.docker"
- "--providers.docker.swarmMode=true"
- "--entrypoints.web.address=:{{traefik_listen_port}}"
- "--entrypoints.{{traefik_secure_network_name}}.address=:{{traefik_secure_listen_port}}"
- "--providers.docker.exposedByDefault=false"
- "--log.level=DEBUG"
+ - "--providers.file.directory=/configuration/"
+ - "--providers.file.watch=true"
+ - "--serversTransport.insecureSkipVerify=true" # I thought It would fix the issue
ports:
- "{{traefik_listen_port}}:{{traefik_listen_port}}"
- "{{traefik_admin_port}}:8080"
+ - "{{traefik_secure_listen_port}}:{{traefik_secure_listen_port}}"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
+ - "/home/{{ansible_user}}/traefik/configuration/:/configuration/"
+ - "/home/{{ansible_user}}/traefik/certs/:/certs/"
networks:
- {{traefik_network_name}}
deploy:
labels:
- "traefik.enable=true"
- "traefik.http.routers.api.rule=Host(`{{traefik_app_name}}.{{app_domain_name}}`)"
- "traefik.http.routers.api.service=api@internal"
- "traefik.http.routers.api.middlewares=auth"
- "traefik.http.middlewares.auth.basicauth.users={{traefikpassword.stdout}}"
# Dummy service for Swarm port detection. The port can be any valid integer value.
- "traefik.http.services.dummy-svc.loadbalancer.server.port=9999"
mode: global
placement:
constraints: [node.role == manager]
networks:
{{traefik_network_name}}:
driver: overlay
attachable: true
name: {{traefik_network_name}}
example-app-stack.j2
:
version: "3.5"
services:
{{dsomm_app_name}}:
image: "{{dsomm_app_image}}"
container_name: {{dsomm_app_name}}
ports:
- "{{app_default_port}}"
networks:
- {{traefik_network_name}}
- {{dsomm_network_name}}
volumes:
- {{dsomm_volume_name}}:/app
deploy:
labels:
- "traefik.enable=true"
- "traefik.http.routers.{{dsomm_app_name}}.rule=Host(`{{dsomm_app_name}}.{{app_domain_name}}`)"
- "traefik.http.services.{{dsomm_app_name}}.loadbalancer.server.port={{dsomm_admin_port}}"
- "traefik.docker.network={{traefik_network_name}}"
- "io.portainer.accesscontrol.users=admin"
+ - "traefik.http.routers.{{dsomm_app_name}}.tls=true"
networks:
{{dsomm_network_name}}:
driver: overlay
attachable: true
name: {{dsomm_network_name}}
{{traefik_network_name}}:
external: true
name: {{traefik_network_name}}
volumes:
{{dsomm_volume_name}}:
driver: {{filesystem_driver}}
certificates.yml
tls:
certificates:
# first certificate
- certFile: "/certs/server-cert.pem"
keyFile: "/certs/server-key.pem"
And the self-signed certificate is used
But adding the CA Cert doesn't make this domain Trusted
Please help