Using Teleport behind Caddy as a reverse proxy #16370
Replies: 3 comments
-
thanks for this. got my setup going. |
Beta Was this translation helpful? Give feedback.
-
Thanks for this! I'm using traefik (still with http challenge) and was struggling the whole day. |
Beta Was this translation helpful? Give feedback.
-
Some more documentation to help anyone trying this. I had to do this with OVH dns provider
Make sure you are using the build with the plugin installed /usr/lib/systemd/system/caddy.service :
OVH is also making it pretty annoying to manage application tokens and give it the correct permissions.
|
Beta Was this translation helpful? Give feedback.
-
Edit (December 2024): Teleport has supported tunnelling its TLS multiplexing over websockets since the release of Teleport 15.1, so this guide has been updated with that in mind to remove the requirement to use separate ports.
A question that comes up often is how to deploy Teleport with a reverse proxy (like Caddy) in front of it, so that people deploying in homelabs can still expose other public services other than Teleport on the same home IP.
Here's an example of how I did this with Caddy.
Notes
example.com
is my domainteleport.example.com
is the subdomain that Caddy will redirect to the Raspberry Pi I have running Teleport (artemis
), where Teleport is listening on port 3080.*.teleport.example.com
is also configured, so I can use applications on subdomains of Teleport using Teleport application access.teleport.example.com
and*.teleport.example.com
which point to the public IP address of my router.teleport.example.com
and*.teleport.example.com
certbot
configured underhttps_keypairs
, but this is not a hard requirement when using a reverse proxy.tls_insecure_skip_verify
from your Caddy config and replace it withtls_server_name teleport.example.com
if you also have this set up.External port forwarding
Caddy configuration
Caddy's configuration goes into a file called
Caddyfile
. It also has aCaddyfile.d
directory where you can drop configurations for individual sites, rather than using a monolithic config file./etc/caddy/Caddyfile.d/teleport.caddyfile
:The
dns cloudflare
line here means that Caddy will perform DNS-01 challenges using Cloudflare, with a token provided via theCLOUDFLARE_AUTH_TOKEN
environment variable. If you don't use Cloudflare you can remove the bracketed section and just leavetls
by itself to do challenges using the default mechanism. Wildcard certs will require the use of a DNS-01 challenge, however.Teleport configuration
Teleport is installed straight onto a Raspberry Pi and uses the config file below. You can use the same host as Caddy if you like - just change the mention of
artemis
in the caddy config tolocalhost
instead./etc/teleport.yaml
:Config for agents joining remotely
Beta Was this translation helpful? Give feedback.
All reactions