cloudflared icon indicating copy to clipboard operation
cloudflared copied to clipboard

🐛

Open Daniel-dev22 opened this issue 3 years ago • 3 comments
trafficstars

I am trying to add a virtual network to one of my tunnels. I am using docker compose. This is a working token. The volume path works as initially I didn't have the private key in the file and it asked for a private key, I added that and now it asks for a token I found the code here and put the correct format but it's unable to find the token.

docker exec --interactive network-cloudflared-tunnel cloudflared tunnel vnet add second-network
Could not add virtual network: error while creating backend client: Error decoding origin cert: Missing token in the certificate

I also tried cloudflared login but it saves the cert somewhere unaccessible to the container. I tried switching to root to find the path and it's empty when I tried to look for it to copy the file over to the path I specified in the volume for docker compose.

I'm using the zero Trust Dashboard which is why there's no configuration file specified in my docker compose.

Path where cloudflared login saves cert.

If you wish to copy your credentials to a server, they have been saved to:
/home/nonroot/.cloudflared/cert.pem
version: "3.9"
services:
  tunnel:
    container_name: network-cloudflared-tunnel
    image: cloudflare/cloudflared
    restart: unless-stopped
    command: tunnel run
    volumes:
      - /home/daniel/cloudflare:/etc/.cloudflared
    environment:
      - TUNNEL_ORIGIN_CERT=/etc/.cloudflared/origin_cert.pem
      - TUNNEL_TOKEN=

Cert.pem format used

-----BEGIN PRIVATE KEY-----
Xxx
-----END PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
Xxx
-----END CERTIFICATE-----
-----BEGIN ARGO TUNNEL TOKEN-----
Xxx
-----END ARGO TUNNEL TOKEN-----

I also tried

-----BEGIN PRIVATE KEY-----
Xxx
-----END PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
Xxx
-----END CERTIFICATE-----
-----BEGIN WARP TOKEN-----
Xxx
-----END WARP TOKEN-----

Daniel-dev22 avatar Nov 07 '22 11:11 Daniel-dev22

Same here

GitIgnoreMaybe avatar Nov 16 '22 23:11 GitIgnoreMaybe

I was able to figure it out.. I don't know how but cloudflared login and immediately after giving the commands for creating the virtual networks. I did it on two instances successfully.

Daniel-dev22 avatar Nov 17 '22 00:11 Daniel-dev22

Thanks for the super quick response. I was dropping cloudflared and using the tunnel settings directly at Cloudflare.

GitIgnoreMaybe avatar Nov 17 '22 06:11 GitIgnoreMaybe