Hi Bluepuma,
I own a custom SSL but added let's encrypt because I won't need to update my custom cert. When I connect to the 443, I can see in cert detail that the letsencrypt cert is used (legoddady certresolver option on my 443 router).
to-server1-443:
entryPoints:
- "websecure"
rule: "Host(`subdomain1.domain.com`)"
service: server1-443
tls:
certResolver: legodaddy
I've done the same thing with my TCP router on my last answer :
to-server1-5000:
entryPoints:
- "serverport5000"
rule: "HostSNI(`subdomain1.domain.com`)"
service: server1-5000
tls:
certResolver: legodaddy
From your reply I should use a custom cert instead, so I added my custom cert in the dynamic config with no stores. It will be used as default cert :
certificates:
- certFile: "/etc/ssl/traefik/customcert.pem"
keyFile: "/etc/ssl/traefik/customcert.key"
Added it to my tcp router by removing certResolver. Since my server supports tls 1.2, I added an option for this :
to-server1-5000:
entryPoints:
- "serverport5000"
rule: "HostSNI(`subdomain1.domain.com`)"
service: server1-5000
tls:
options : maxtls12
The custom cert is used the 443 server1 website and the dashboard. So the custom cert is loaded.
Tested TLS 1.1 option too and the answer is that 1.2 is expected. (Error 302) So TLS version is good.
Still get the same error with custom cert loaded :
"Handling TCP connection from myip :randomport to servercontainer1 :5000"
Dial with lookup to address servercontainer1 :5000"
Error while handling TCP connection: read tcp traefikcontainerip :randomport->servercontainer1 :5000: read: connection reset by peer
I've done some research about this error. From what I understand, the TCP connection is stopped by Traefik and Traefik does nothing else with it or my server need to handle the handshake. So, my server app need the passthrough option on tcp routers.
tls:
passthrough: true
Passthrough option don't use the cert on the load balancer, the connexion is accepted and forwarded to the backend server who uses it's own cert to handle the connexion. Without passthrough traefik establish the secure connexion with the client and communicate unencrypted data with the backend servers.
So, now my tcp 5000 is working on tcp routers. Good news. But, once the connexion is established on 5000 it stays active for 5 minutes. So once connected to port 5000, I must wait to switch between server 1 and 2. I must find a way to desactivate the SSL on my backends servers to let traefik manage it. That SSL 5 minutes cache must be a configuration from my server app.
Update : After some test, my server in container handle tls 1.3 on 5000 with the last version of my app. Since passthough is true, the LE cert or custom cert doesn't matter for now.
Thank you bluepuma for your help. I'll update my post when I find how to deactivate SSL on my backend server and let traefik handle it.
Update : Removed SSL on my backends servers. Removed passtrough option on my tcp servers. It's working with the le cert or custom cert. I still have to wait 5 minutes, but it must be a setting in my backends servers.