Using Teleport behind Caddy as a reverse proxy #16370
Replies: 4 comments 14 replies
-
|
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.
-
|
Hey @webvictim, thank you for the wonderful guide! I tried to follow it; however, I can't seem to add a node to the teleport SSH service. I tried to debug this for an hour, managed to make some progress on my own (for example, by finding the I have installed teleport via this docker-compose file: services:
teleport:
image: public.ecr.aws/gravitational/teleport-distroless:18
container_name: teleport
volumes:
- ./config:/etc/teleport
- ./data:/var/lib/teleport
restart: always
networks:
- caddy
networks:
caddy:
external: trueHave teleport configured like this version: v2
teleport:
nodename: ncx40-docker
data_dir: /var/lib/teleport
log:
output: stderr
severity: DEBUG
format:
output: text
auth_service:
enabled: true
listen_addr: 0.0.0.0:3025
proxy_listener_mode: multiplex
cluster_name: tp.domain.com
authentication:
type: local
second_factor: on
webauthn:
rp_id: tp.domain.com
connector_name: passwordless
ssh_service:
enabled: yes
proxy_service:
enabled: true
web_listen_addr: 0.0.0.0:3080
public_addr: tp.domain.com:443
trust_x_forwarded_for: true
https_keypairs: []
acme: {}
app_service:
enabled: false... and my Caddyfile looks like this: I've played around with the configs a lot, added several directives to the Caddy configuration, like manually setting header_ups, but the result stays the same. The client does not show up, and the client itself does not even show error logs, and on the server console, I can see the following logs: Do you have any idea or further steps I can take to debug this issue further? Thank you for your time! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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.comis my domainteleport.example.comis the subdomain that Caddy will redirect to the Raspberry Pi I have running Teleport (artemis), where Teleport is listening on port 3080.*.teleport.example.comis also configured, so I can use applications on subdomains of Teleport using Teleport application access.teleport.example.comand*.teleport.example.comwhich point to the public IP address of my router.teleport.example.comand*.teleport.example.comcertbotconfigured underhttps_keypairs, but this is not a hard requirement when using a reverse proxy.tls_insecure_skip_verifyfrom your Caddy config and replace it withtls_server_name teleport.example.comif you also have this set up.External port forwarding
Caddy configuration
Caddy's configuration goes into a file called
Caddyfile. It also has aCaddyfile.ddirectory where you can drop configurations for individual sites, rather than using a monolithic config file./etc/caddy/Caddyfile.d/teleport.caddyfile:The
dns cloudflareline here means that Caddy will perform DNS-01 challenges using Cloudflare, with a token provided via theCLOUDFLARE_AUTH_TOKENenvironment variable. If you don't use Cloudflare you can remove the bracketed section and just leavetlsby itself to do challenges using the default mechanism. Wildcard certs will require the use of a DNS-01 challenge, however.Note that to use Cloudflare DNS challenges, your Caddy setup must have the
dns.providers.cloudflaremodule enabled.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
artemisin the caddy config tolocalhostinstead./etc/teleport.yaml:Config for agents joining remotely
Beta Was this translation helpful? Give feedback.
All reactions