Skip to content

Make ad blocking dns using Cloudflare Gateway Zero Trust

Notifications You must be signed in to change notification settings

mintss-zez0/Cloudflare-Gateway-Pihole

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dành cho các bạn Việt Nam

Các bạn cần phân biệt bộ lọc DNS và bộ lọc browser. Mình thấy nhiều bạn đem bộ lọc browser lên chạy -> lỗi lướt web

Credit

Cloudflare-Gateway-Pihole

Create your block ad-list to Cloudflare Gateway

Note

https://raw.githubusercontent.com/bigdargon/hostsVN/master/option/hosts-VN
https://raw.githubusercontent.com/Yhonay/antipopads/master/hosts
https://raw.githubusercontent.com/hagezi/dns-blocklists/main/wildcard/light-onlydomains.txt

or

[Hosts-Urls]
hostsVN = https://raw.githubusercontent.com/bigdargon/hostsVN/master/option/hosts-VN
Antipopup = https://raw.githubusercontent.com/Yhonay/antipopads/master/hosts
Hagezi = https://raw.githubusercontent.com/hagezi/dns-blocklists/main/wildcard/light-onlydomains.txt
  • Supported white list

Introduce

Add variables secrets to https://github.com/your-user/your-repository/settings/secrets/actions:

or add to .env

Use .env

If you add CF_IDENTIFIER and CF_API_TOKEN to .env , you must edit main.yml , re-run.yml and re-run2 like this, remove secret env:

- name: Cloudflare Gateway Zero Trust 
  run: python -m src 
  • Script has 2 backup workflow files that if the upload fails, will run 2 more times every 5 minutes. So the failure rate will be very low

More informations about Secret Github Action and API TOKEN

Secret Github Action like: 1000015672

Generate CF_API_TOKEN like: CF_API_TOKEN

Termux

Now you can run on Termux

  • Download Termux

  • Copy and paste commands

yes | pkg upgrade
yes | pkg install python-pip
yes | pkg install git
git clone https://github.com/luxysiv/Cloudflare-Gateway-Pihole
cd Cloudflare-Gateway-Pihole
nano .env

Input your value then

  • Command
nano adlist.ini

to edit block list

  • Command
nano whitelist.ini

to edit white list

  • Command
python -m src

to upload

  • If Termux not work you can copy and paste this command
termux-change-repo

Enter 3 times

Next time only use commands to run

cd Cloudflare-Gateway-Pihole
python -m src

Chú ý

  • Đã hỗ trợ sử dụng list nào cũng được

  • Giới hạn của Cloudflare Gateway Zero Trust free là 300k domains nên các bạn nhớ chú ý log, nếu quá script sẽ stop

  • Các bạn đã up lists bằng script khác thì nên xoá đi bằng tính năng xoá của script đã up hoặc xoá tay

  • Nếu không biết thêm vào Secret Github Action thì có thể điền giá trị vào file .env và sửa file main.yml , re-run.ymlre-run2 như sau, loại bỏ các dòng secret env

- name: Cloudflare Gateway Zero Trust 
  run: python -m src 
  • Mình đã update thêm tính năng xoá lists khi các bạn không cần sử dụng script nữa. Vào main.py để như sau:

  • Script có 2 files workflow dự phòng nếu upload thất bại sẽ chạy tiếp 2 lần sau mỗi 5p. Cho nên tỉ lệ fail sẽ rất thấp

async def main():
    adlist_urls = read_urls_from_file("adlist.ini")
    whitelist_urls = read_urls_from_file("whitelist.ini")
    adlist_name = "DNS-Filters"
    app = App(adlist_name, adlist_urls, whitelist_urls)
    await app.delete()  # Leave script
    # await app.run()
  • Đã thêm tính năng white lists

  • Bạn có thể thay tên DNS-Filters bằng các tên bạn thích

  • Thêm danh sách của bạn vào adlist.ini

  • Đã hỗ trợ 2 loại adlist.ini

https://raw.githubusercontent.com/bigdargon/hostsVN/master/option/hosts-VN
https://raw.githubusercontent.com/Yhonay/antipopads/master/hosts
https://raw.githubusercontent.com/hagezi/dns-blocklists/main/wildcard/light-onlydomains.txt

hoặc

[Hosts-Urls]
hostsVN = https://raw.githubusercontent.com/bigdargon/hostsVN/master/option/hosts-VN
Antipopup = https://raw.githubusercontent.com/Yhonay/antipopads/master/hosts
Hagezi = https://raw.githubusercontent.com/hagezi/dns-blocklists/main/wildcard/light-onlydomains.txt

👌 Chúc các bạn thành công

👌 Mọi thắc mắc về script các bạn có thể mở issue

About

Make ad blocking dns using Cloudflare Gateway Zero Trust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%