Welcome to the OpenWrt Cloudflare Tunnel Installer and Uninstaller project! This repository contains scripts that automate installation, configuration and uninstallation of Cloudflare Tunnels on OpenWrt systems, suitable for both Raspberry Pi and x86 platforms.
This repository includes:
install-cloudflared.sh
– Installs Cloudflared, guides through tunnel setup (local or web-managed), configures as an init.d service, installs updater and optionally schedules daily updates.uninstall-cloudflared.sh
– Reverses all changes: stops & disables service, removes binaries, configs, updater and cron jobs.
- Compatible Hardware: Raspberry Pi or x86 devices running OpenWrt.
- Administrative Access: Must run as root (installer enforces UID 0).
- Internet: Required to download binaries and updates.
Clone the repo to your device:
git clone https://github.com/Coralesoft/OpenwrtCloudflare.git
cd OpenwrtCloudflare
chmod +x install-cloudflared.sh && sudo ./install-cloudflared.sh
- Download the installer:
wget https://raw.githubusercontent.com/Coralesoft/OpenwrtCloudflare/main/install-cloudflared.sh
- Make executable:
chmod +x install-cloudflared.sh
- Run the installer:
sudo ./install-cloudflared.sh
- Follow prompts:
- Choose local or web-managed tunnel.
- Enter tunnel name and domain or paste token.
- Opt in for cron-based auto-updates if desired.
chmod +x uninstall-cloudflared.sh && sudo ./uninstall-cloudflared.sh
- Download the uninstaller (if not present):
wget https://raw.githubusercontent.com/Coralesoft/OpenwrtCloudflare/main/uninstall-cloudflared.sh
- Make executable:
chmod +x uninstall-cloudflared.sh
- Run the uninstaller:
sudo ./uninstall-cloudflared.sh
- Verify removal: No
cloudflared
service, binary or configs should remain.
If auto-updates were enabled, a daily cron job at 12:30 will run /usr/sbin/cloudflared-update
.
Run on demand:
/usr/sbin/cloudflared-update
This will:
- Check the latest release on GitHub.
- Compare to your installed version.
- Download and replace if newer.
- Restart the
cloudflared
service.
- Insufficient space: Installer will exit with a message.
- Unsupported architecture: Only
aarch64
andx86_64
are supported. - Permission errors: Ensure you run as root.
- Rollback: On error, installer cleans up all changes.
For issues or feature requests, contact C. Brown at [email protected].
If this project helps you streamline your OpenWrt setup and you’d like to support ongoing development, consider buying me a coffee. Your contribution keeps the creativity flowing and helps sustain future updates.
MIT License – see LICENSE
for details.
Thanks to the OpenWrt and Cloudflare communities for their tools and documentation.