Hello, I'm trying to deploy traefik for tcp tls server, but it fails with default cert, which causes no response for tls client connection (I see in logs, requests passes well). Compose config has a https service, which acquires cert and works ok. I tried both HostSNI(
*)
and HostSNI(${DOMAIN}
), the second one just not working
version: "3.7"
services:
traefik:
image: "traefik:latest"
container_name: traefik
restart: unless-stopped
command:
# - --metrics
# - --metrics.prometheus.buckets=0.1,0.3,1.2,5.0
- --log.level=DEBUG
- --providers.docker=true
- --providers.docker.exposedbydefault=false
# - --accesslog=true
# - --accesslog.filepath=/var/log/traefik/access.log
- --accesslog.format=json
- --certificatesresolvers.md-resolver.acme.tlschallenge=true
- --certificatesresolvers.md-resolver.acme.email=support@mydomain.com
- --certificatesresolvers.md-resolver.acme.storage=/letsencrypt/acme.json
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- --entryPoints.websecure.http.tls=true
- --entryPoints.websecure.http.tls.certResolver=md-resolver
- --entryPoints.ldap.address=:389
- --entryPoints.ldaps.address=:636
- --entrypoints.web.http.redirections.entryPoint.to=websecure
- --entrypoints.web.http.redirections.entryPoint.scheme=https
- --entrypoints.web.http.redirections.entrypoint.permanent=true
ports:
- "80:80"
- "8080:8080"
- "443:443"
- "389:389"
- "636:636"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- ./certs:/letsencrypt
deploy:
resources:
limits:
cpus: '0.50'
memory: 96M
reservations:
cpus: '0.25'
memory: 32M
ldap_server:
env_file:
.env
labels:
# this works fine with any ldap client
- traefik.enable=true
- traefik.tcp.routers.ldap_server.rule=HostSNI(`*`)
- traefik.tcp.routers.ldap_server.service=ldap_server-svc
- traefik.tcp.services.ldap_server-svc.loadbalancer.server.port=389
# default cert error
- traefik.tcp.routers.ldaps_server.rule=HostSNI(`*`)
- traefik.tcp.routers.ldaps_server.tls=true
- traefik.tcp.routers.ldaps_server.tls.passthrough=false # pass decrypted traffic to server
- traefik.tcp.routers.ldaps_server.entrypoints=ldaps
- traefik.tcp.routers.ldaps_server.tls.certresolver=md-resolver
- traefik.tcp.routers.ldaps_server.service=ldaps_server
- traefik.tcp.services.ldaps_server.loadbalancer.server.port=389
api_server:
hostname: api_server
labels:
# works fine, cert acquired
- "traefik.enable=true"
- "traefik.http.routers.api.rule=Host(`${DOMAIN}`) && PathPrefix(`/api`)"
- "traefik.http.routers.api.tls.certresolver=md-resolver"
- "traefik.http.routers.api.entrypoints=websecure"
- "traefik.http.services.api.loadbalancer.server.port=8000"
- "traefik.http.routers.api.service=api"
- "traefik.http.routers.api.middlewares=api_strip"
- "traefik.http.middlewares.api_strip.stripprefix.prefixes=/api"
- "traefik.http.middlewares.api_strip.stripprefix.forceslash=false"