mTLS support #46
Replies: 4 comments 11 replies
-
perhaps via https://plugins.traefik.io/plugins/6637c92c3f17a1aeb061e27e/mtls-or-whitelist ? |
Beta Was this translation helpful? Give feedback.
-
i would love this feature. is there a way to contribute here? |
Beta Was this translation helpful? Give feedback.
-
I'd use the hell out of this feature if it were added Currently I need to choose between using Tailscale which limits me from using any other VPN on mobile devices, and using Cloudflare Tunnels with mTLS rules which I'm not a huge fan of because Cloudflare act as a MITM Most of the services I use support mTLS on their clients, obviously the clients aren't able to auth with Pangolin and I'm not keen on creating bypass rules for paths because I feel as though that makes services just as vulnerable as they would be if I didn't use any auth at all |
Beta Was this translation helpful? Give feedback.
-
Alright guys, I just tried this and it seems to work pretty good. What I achieved so far:
you can extend your dynamic conf stored in ### NEW
tls:
options:
default:
clientAuth:
caFiles:
- /etc/traefik/certs/rootCa.pem
clientAuthType: RequireAndVerifyClientCert
### NEW
http:
middlewares:
redirect-to-https:
redirectScheme:
scheme: https
routers:
# HTTP to HTTPS redirect router
main-app-router-redirect:
rule: "Host(`pangolin.domain.de`)"
service: next-service
entryPoints:
- web
middlewares:
- redirect-to-https
# Next.js router (handles everything except API and WebSocket paths)
next-router:
rule: "Host(`pangolin.domain.de`) && !PathPrefix(`/api/v1`)"
service: next-service
entryPoints:
- websecure
tls:
certResolver: letsencrypt
### NEW
options: default
### NEW
# API router (handles /api/v1 paths)
api-router:
rule: "Host(`pangolin.domain.de`) && PathPrefix(`/api/v1`)"
service: api-service
entryPoints:
- websecure
tls:
certResolver: letsencrypt
# WebSocket router
ws-router:
rule: "Host(`pangolin.domain.de`)"
service: api-service
entryPoints:
- websecure
tls:
certResolver: letsencrypt
services:
next-service:
loadBalancer:
servers:
- url: "http://pangolin:3002" # Next.js server
api-service:
loadBalancer:
servers:
- url: "http://pangolin:3000" # API/WebSocket server you still need to create your own rootCa and clientCert, which i created using these commands: # Create root CA private key
openssl genrsa -out rootCA.key 4096
# Create root CA certificate
openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 3650 -out rootCA.pem
# Create client private key
openssl genrsa -out client.key 2048
# Create client CSR
openssl req -new -key client.key -out client.csr
# Create client certificate
openssl x509 -req -in client.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out client.crt -days 365 -sha256
# Create client PFX file
openssl pkcs12 -export -out client.pfx -inkey client.key -in client.crt -certfile rootCA.pem the file rootCa.pem should be placed at Please test this and give me Feedback. If it works for you too, I will look into how to secure specific Domains/Urls only. regards |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Requesting mTLS support to be able to do seamless client authentication.
Example (with CF): https://kcore.org/2024/06/28/using-cloudflare-zerotrust-and-mtls-with-home-assistant-via-the-internet/
Beta Was this translation helpful? Give feedback.
All reactions