CF Tunnel Gate is a secure Reverse Proxy, Web Application Firewall (WAF), and Intrusion Prevention System(WAF), designed for self-hosted projects and backed with Cloudflare Tunnels.
This project combines a number of common open source tools in a single Docker Compose application preconfigured for easy setup with just a few environment varables.
Basic usage for most use cases is covered below, please see each project for additional configuration information.
For more detailed information and insights about the project, check out this dev.to post.
Backing Containers:
- Create a Cloudflare Tunnel (How-to).
- Set the tunnel
Service
tohttps://cf-tunnel-gate:8443
(Section 2, Step 2 of the above How-to)
- Generate a Cloudflare API Key with the following permissions (How-to).
Account:Account Filter Lists:Edit
Account:Account Filter Lists:Read
Account:Account Settings: Read
-
Create a Cloudflare Custom IP List named
fail2ban
(How-to) -
Create A Cloudflare Custom WAF Rule which block traffic from IPs in the
fail2ban
custom list. (How-to)
-
Make sure you have Docker, Docker Compose and git installed
-
Clone the CF Tunnel Gate repository
git clone https://github.com/binbashing/cf-tunnel-gate.git
-
Using
.env.example
as a template create your.env
file and set the necessary values. -
Start the containers with
docker compose up -d
-
Test that your proxied service is available via your tunnel URL.
-
Configure nightly updates. A simple cron to run
docker compose restart
or restart of the host is recommended to get regular updates.