Skip to content

Instantly share code, notes, and snippets.

@likuilin
Created June 29, 2023 23:30
Show Gist options
  • Save likuilin/27e78438668e029c489b37c2725c21da to your computer and use it in GitHub Desktop.
Save likuilin/27e78438668e029c489b37c2725c21da to your computer and use it in GitHub Desktop.
cloudflared file transfers

cloudflared file transfers

Want to transfer a file between two computers, but both are behind layers of bastion hosts?

If both can connect to the internet (Cloudflare edge servers), here is a solution that leverages free Cloudflare Tunnels.

The sender must have python3 and cloudflared installed. The receiver doesn't need anything.

Sender:

kuilin@KUILIN-PC:~$ mkdir temp
kuilin@KUILIN-PC:~$ cd temp
kuilin@KUILIN-PC:~/temp$ ln -s ../IMG-1349.JPG .
kuilin@KUILIN-PC:~/temp$ python3 -m http.server &
[1] 12738
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
kuilin@KUILIN-PC:~/temp$ cloudflared tunnel --url localhost:8000
2023-06-29T23:23:29Z INF Thank you for trying Cloudflare Tunnel. Doing so... [snip]
2023-06-29T23:23:29Z INF Requesting new quick Tunnel on trycloudflare.com...
2023-06-29T23:23:30Z INF +--------------------------------------------------------------------------------------------+
2023-06-29T23:23:30Z INF |  Your quick Tunnel has been created! Visit it at (it may take some time to be reachable):  |
2023-06-29T23:23:30Z INF |  https://establishment-fraction-inline-edge.trycloudflare.com                              |
2023-06-29T23:23:30Z INF +--------------------------------------------------------------------------------------------+
2023-06-29T23:23:30Z INF Cannot determine default configuration path. No file [config.yml config.yaml] in [~/.cloudflared ~/.cloudflare-warp ~/cloudflare-warp /etc/cloudflared /usr/local/etc/cloudflared]
2023-06-29T23:23:30Z INF Version 2022.7.1
[...more output...]

Receiver then visits https://establishment-fraction-inline-edge.trycloudflare.com and they can download the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment