Raspberry Pi with Cloudflare Argo Tunnel

If you are using Raspberry Pi 3 or later, I think you can try Cloudflare Argo Tunnel quickly with the official cloudflared binary. This blog post is about my attempt to get a web server running in an old Raspberry Pi protected with Cloudflare Argo Tunnel.

Reviving the old Raspberry Pi

A few days ago, I found my old board—from the days where I quite often play with electronics—in a box. It must have been lying there for at least three years since we moved house back then. I don’t even remember which model it is. I think it would be great if I can run a web server on it. Here is how it looks:

The top view of the Raspberry Pi board
The top view of the Raspberry Pi board

It has an RCA video output and two USB ports. A quick search online reveals that it is a Raspberry Pi rev 2 Model B, made in China. Then, the first step is to figure out which stable release OS could run in this old piece of hardware.

At first, I would like to run Ubuntu 20.04. However, Ubuntu does not support ancient ARMv6-based devices. So I decided to go with the official Raspberry Pi OS Lite (a.k.a. Raspbian), which based on Debian Buster.

After logging in to the device, we can confirm which model it is.

Raspberry Pi rev 2 Model B, Revision: 000d.
Revision: 000d

If you are curious which Raspberry Pi device you have, you can check the Revision from cat /proc/cpuinfo and look it up on this list: https://elinux.org/RPi_HardwareHistory

Getting cloudflared to work

After Nginx is up, next is to try the free version of Cloudflare Argo Tunnel.

nginx/1.14.2 running on the Raspberry Pi
nginx/1.14.2

As I’m running Raspbian, which is a Debian Buster, I downloaded the .deb package. But, the installation failed. The package seems to be prepared for arm but not armhf.

Tried to install cloudflared-stable-linux-arm.deb on the Raspberry Pi
cloudflared-stable-linux-arm.deb

I also tried the official binary for ARM, but it failed to run: Segmentation fault. It seems that this is a known issue.

Downloaded the official cloudflared-stable-linux-arm.tgz
cloudflared-stable-linux-arm.tgz
Details of official cloudflared tested
cloudflared

Most likely, it is a similar issue with the .deb package; the binary possibly compiled for a different architecture. Let’s try something else.

$ wget https://dl.google.com/go/go1.14.4.linux-armv6l.tar.gz
$ sudo tar -C /usr/local -xzf go1.14.4.linux-armv6l.tar.gz
$ export GOPATH=$HOME/go
$ go get github.com/cloudflare/cloudflared/cmd/cloudflared
$ $GOPATH/bin/cloudflared -v
cloudflared version DEV (built unknown)

Note: If you see an error like cannot allocate memory, you would need to increase the swap size.

It works!

As this is just a test run, I’m happy when I am able to get cloudflared running flawlessly. And I quickly set a test tunnel.

the free test tunnel
the test page protected by the test tunnel

As could be seen above, finally we have the web server serving traffic through Cloudflare Argo Tunnel.

Note: As I only intend to test whether the old pi can run a recent stable release of OS, web server, and protect it with Argo Tunnel, I did not keep the tunnel up and running.

I am delighted to see the result. I will decide later on what I would try on this thing. Do you have an old pi lying around? It might be more useful than you thought.

Leave a Reply

Your email address will not be published. Required fields are marked *