How could I setup SSH on Zero trust network through Docker?

I have set up my Cloudflare tunnel through Docker container. However, it doesn’t seem to allow any connections from the website with the configuration provided.

I’ve noticed that whenever I do cloudflared tunnel list on terminal, it shows a list of the tunnels connected in Zero Trust. On the contrary, interacting with the docker container using docker exec -it showed that it wasn’t logged in and failed to search all tunnels.

I tried docker exec -it cloudflared cloudflared --config /origin/sshTunnelConfig.yaml (/origin mounted to ~/.cloudflared) and this method wasn’t properly fulfilled to the right result.

config.yaml:

tunnel: *****-*****-*****-*****
credentials-file: /origin/sshTunnel.json
metrics: :5000
protocol: http2
no-autoupdate: true
ingress:
  - hostname: ******.*****.xyz
    service: ssh://localhost:22

My guess is because the config is pointing ssh at your docker container, not your host. You need to start the docker container with the flag --add-host=host.docker.internal:host-gateway then change your config to service: ssh://host.docker.internal:22. You will also have to make sure the sshd is running on your docker interface.

I have not tested this myself

Ah, ok. I also encounter an error that fails to open /origin/sshTunnelConfig.yaml: due to permission denied. The configuration file cannot open the credential file because it’s located under my host directory, not the container’s.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.