Skip to content

IanDesuyo/CloudflareGatewayAdBlock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cloudflare Zero Trust Gateway Ad Block

Using Cloudflare Zero Trust Gateway with WRAP to block ads on your devices.

What is this?

This script convert adblock list like StevenBlack/hosts or AdAway blocklist to domain list, split it into chunks and upload to Cloudflare Zero Trust Lists, and create a new policy to block those domains using Cloudflare Zero Trust Gateway.

Getting Started

Prerequisites

Cloudflare provides a free plan for Zero Trust Gateway, which is enough for this script.

  • Cloudflare account with Zero Trust Free plan
  • API Token with Zero Trust:Edit and Account Firewall Access Rules:Edit permissions, which can be created in Cloudflare Dashboard.

Usage

  1. Clone this repository.
  2. Install dependencies with pip install -r requirements.txt.
  3. Set environment variables.
# API Token
export CF_API_TOKEN=your_api_token
# Zone ID of your domain, can be found in url like https://dash.cloudflare.com/{zone_id}
export CF_ZONE_ID=your_zone_id
  1. Edit main.py to set adblock list url.
app = App("Adaway", "https://adaway.org/hosts.txt")

app.run()
  1. Run python main.py.

About

Using Cloudflare Zero Trust Gateway with WRAP to block ads on your devices.

Resources

Stars

Watchers

Forks

Languages