Giter VIP home page Giter VIP logo

mrrfv / cloudflare-gateway-pihole-scripts Goto Github PK

View Code? Open in Web Editor NEW
236.0 10.0 674.0 270 KB

Use Cloudflare Gateway DNS/VPN to block ads, malware and tracking domains - free alternative to NextDNS, Pi-hole and Adguard

License: MIT License

JavaScript 99.67% Shell 0.33%
cloudflare adblock adblocking anti-tracking antimalware cloudflare-api cloudflare-gateway cloudflare-zero-trust nextdns pihole

cloudflare-gateway-pihole-scripts's Introduction

mrrfv

I may be slow to respond through e-mail.

Linux Android Backup Linux Android Backup

cloudflare-gateway-pihole-scripts's People

Contributors

hlqviet avatar mrrfv avatar norbertjoni avatar omoeba avatar renovate[bot] avatar zlatychlapec avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cloudflare-gateway-pihole-scripts's Issues

"response.body?.pipeTo is not a function" while downloading filter lists using Node.js v16

@hlqviet Tagging you because this might be related to #25 (though I'll try to fix this on my own in my free time).

This is most likely caused by the old Node.js version, that we have to support because that's what the original GitHub Actions workflow uses.

Environment

  node: v16.20.2
  npm: 8.19.4
  yarn: 1.22.19

Error

> Run bash ./get_recommended_whitelist.sh
file:///home/runner/work/***/***/cloudflare-gateway-pihole-scripts/lib/utils.js:69
    await response.body?.pipeTo(writableStream, { preventClose: true });
                         ^

TypeError: response.body?.pipeTo is not a function
    at downloadFiles (file:///home/runner/work/***/***/cloudflare-gateway-pihole-scripts/lib/utils.js:69:26)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async downloadLists (file:///home/runner/work/***/***/cloudflare-gateway-pihole-scripts/download_lists.js:18:3)
    at async file:///home/runner/work/***/***/cloudflare-gateway-pihole-scripts/download_lists.js:32:5
Error: Process completed with exit code 1.

Please make this easier to understand

Hello, a youtube video with every step would be a godsend with this - as ive never used node.js and have no idea wth im doing.
Would grately appreciate it.

google.com blocked

I see that google.com is blocked now, but we cant see which blocklist is doing this.
Can you check please and fix it.

[Feature Request] Discord (or similar) webhook notifications

CGPS is more of a "set-and-forget" script, meaning that if something happens to go wrong, it usually isn't noticed until it's too late and ads start showing up. It'd be nice to have a feature allowing the use of Discord (as well as Matrix, maybe with the use of Matrix-Webhooks) for error notifications and such.

tutorial for github

Hi,
If i understand good,this script can be installed on github?

If yes, can you please share the step by step procedure to install your script on my github account?
And also how to link cloudlfare gateway with github for the blocklist.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

github-actions
.github/workflows/dry-run.yml
  • actions/checkout v4
  • actions/setup-node v4
.github/workflows/sync-branch.yml
  • actions/checkout v4
  • connor-baer/action-sync-branch v1.1.0
auto_update_github_action.yml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • gautamkrishnar/keepalive-workflow v2
nodenv
.node-version
  • node 20.12.2
npm
package.json
  • dotenv 16.4.5
  • node-fetch 3.3.2
  • node 20.12.2

  • Check this box to trigger a request for Renovate to run again on this repository

block lists

Hi,
I see mullavad already added adguard dns list.
Also cgps script adds adguard dns, so its double now.

I hope you can add some of hagezi's list.

HTTP error! Status: 504

> cloudflare-delete:list
> node cf_list_delete.js

file:///home/runner/work/cloudflare-gateway-adblock/cloudflare-gateway-adblock/lib/helpers.js:40
    throw new Error(`HTTP error! Status: ${response.status}`);
          ^

Error: HTTP error! Status: 504
    at request (file:///home/runner/work/cloudflare-gateway-adblock/cloudflare-gateway-adblock/lib/helpers.js:40:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async file:///home/runner/work/cloudflare-gateway-adblock/cloudflare-gateway-adblock/cf_list_delete.js:9:29

Hi, my github action run failed and show up this HTTP error message, it works great before.

Is there any fixable problem? What info should I provide for maintainers?

Error: Process completed with exit code 1.

Error: HTTP error! Status: 400
at request (file:///home/runner/work/cloudflare-gateway-pihole-scripts/cloudflare-gateway-pihole-scripts/lib/helpers.js:106:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async file:///home/runner/work/cloudflare-gateway-pihole-scripts/cloudflare-gateway-pihole-scripts/cf_gateway_rule_delete.js:4:27

Node.js v20.11.0
Error: Process completed with exit code 1.

Getting 404 at CF Steps

Hope you can help me find what I'm doing wrong.
I forked the repo, setup my secrets and variables. I'm getting a 404 error. This looks like a CF/Credential error, but I cannot figure it out :( I run a curl test to verify the token is valid. "This API Token is valid and active"
image

Pics of my repo action secrets:
image

Pic of Variables:
image

Log at Delete old rule and list (If I comment this step out, fails at Create).
Run npm run cloudflare-delete

cloudflare-delete
npm run cloudflare-delete:rule && npm run cloudflare-delete:list

cloudflare-delete:rule
node cf_gateway_rule_delete.js

file:///home/runner/work/cloudflare-gateway-pihole-scripts/cloudflare-gateway-pihole-scripts/lib/helpers.js:106
throw new Error(HTTP error! Status: ${response.status});
^

Error: HTTP error! Status: 404
at request (file:///home/runner/work/cloudflare-gateway-pihole-scripts/cloudflare-gateway-pihole-scripts/lib/helpers.js:106:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async file:///home/runner/work/cloudflare-gateway-pihole-scripts/cloudflare-gateway-pihole-scripts/cf_gateway_rule_delete.js:4:27

Node.js v20.9.0
Error: Process completed with exit code 1.

Error: HTTP error! Status: 502

Hi,

I just synced with the latest,and now getting these errors.

Could not create "CGPS List - Chunk 140" - Error: HTTP error! Status: 502
file:///home/runner/work/cloudflare-gateway-pihole-scripts/cloudflare-gateway-pihole-scripts/lib/helpers.js:106
throw new Error(HTTP error! Status: ${response.status});
^

Error: HTTP error! Status: 502
at request (file:///home/runner/work/cloudflare-gateway-pihole-scripts/cloudflare-gateway-pihole-scripts/lib/helpers.js:106:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async createZeroTrustListsOneByOne (file:///home/runner/work/cloudflare-gateway-pihole-scripts/cloudflare-gateway-pihole-scripts/lib/api.js:48:7)
at async file:///home/runner/work/cloudflare-gateway-pihole-scripts/cloudflare-gateway-pihole-scripts/cf_list_create.js:140:5

Node.js v20.9.0
Error: Process completed with exit code 1.

gateway locations

Hi,
I need advice how to connect my mobile devices to cf gateway.
Should we create new dns location for evry device to get the unique dot/doh adress ?
Are there resctrictions on the zero trust free how many device/location we can have?

cgps Process completed with exit code 1.

Hi,

I have the latest version forked, and synced yesterday the new update.
Now when i want to update my filter list, i get this error.

at new URL (node:internal/url:637:13)
at new Request (node:internal/deps/undici/undici:7132:25)
at fetch2 (node:internal/deps/undici/undici:10715:25)
at Object.fetch (node:internal/deps/undici/undici:11574:18)
at fetch (node:internal/process/pre_execution:242:25)
at file:///home/runner/work/cloudflare-gateway-pihole-scripts/cloudflare-gateway-pihole-scripts/lib/utils.js:60:57
at Array.map ()
at downloadFiles (file:///home/runner/work/cloudflare-gateway-pihole-scripts/cloudflare-gateway-pihole-scripts/lib/utils.js:60:44)
at downloadLists (file:///home/runner/work/cloudflare-gateway-pihole-scripts/cloudflare-gateway-pihole-scripts/download_lists.js:18:9) {
input: '',
code: 'ERR_INVALID_URL'
}
}

Node.js v18.18.0
Error: Process completed with exit code 1.

[Feature Request] SNI-based blocking

An optional feature that creates a network firewall policy that denies access to blocked domains based on their SNI, making it near impossible to bypass the filter by apps using hardcoded DNS settings.

[Feature Request] Docker support

A Docker image with cron built-in that works in a similar fashion as the GitHub Action, with the security benefit of being able to run it on your own hardware.

clean up oisd li

Hello,

Thank you for your work. I am trying to use your scripts with oisd list.
Is there a good way to clean up the oisd big list? https://big.oisd.nl/

It should be done in cf_list_create.js but not sure how.

Create or delete lists script error

Hello,

I I run create lists script (and also delete lists script) I run into this error:

Creating 169 lists for 168793 domains...
Could not create "CGPS List - Chunk 1" - Error: HTTP error! Status: 400
file:///srv/cloudflare-gateway-pihole-scripts/lib/helpers.js:106
    throw new Error(`HTTP error! Status: ${response.status}`);
          ^

Error: HTTP error! Status: 400
    at request (file:///srv/cloudflare-gateway-pihole-scripts/lib/helpers.js:106:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async createZeroTrustListsOneByOne (file:///srv/cloudflare-gateway-pihole-scripts/lib/api.js:48:7)
    at async file:///srv/cloudflare-gateway-pihole-scripts/cf_list_create.js:140:5

The error is the same as above for the delete lists script.

hagezi blocklist

Hi,

Can you please add hagezi Pro blocklist to the cgps script.
It is very well maintained block list.

whitelist

Hi,

the whitelist you added,is it automatically added when updating workflow?
and can we select which whitelist we want to be used?
I would prefer the hagezi's whitelist.

[OFF-TOPIC] [Need Help] How to use it in router which only supports IPv4 DNS?

I am using Xiaomi Router 3c & Router 4c, both of which only support IPv4 DNS. Cause when I entered the IPv6 one, it gave an error saying the DNS needs to of a value 255.255.255.255 max. The script is working perfectly fine. This is first time I used node.js, npm, etc. but surprisingly managed to do it in one go. Tried the output in two of my android devices and chrome browser using the dns over tls / https DNS and all are working fine.

I just couldn't manage to make it work in my router and windows 10 PC.

My ISP is using PPPoE connection type, which assigns random IP address to my network.

If someone can guide me how can I use this DNS with my router I'll be very grateful ๐Ÿ™

mi3-wireless-router-repeater-mmode

Regarding 300000 free limit

I see that you wrote that there's a limit of 300000 blocked domains on the free account. I can't any info regarding this on cloudflare.

Also, according to this documentation https://developers.cloudflare.com/cloudflare-one/account-limits/#gateway there's a limit of 100 on Lists. And each list can only contain 1000 items. So shouldn't there be a limit of 100000 on free accounts?

Although, i tried your script via github on my cloudflare account with OISD list. It created around 187 lists without any error. I am worried if my cloudflare account will get banned for bypassing 100 limit on Lists. Is this correct?

update issues when forked

Hi,
These days i see there are some great new updates, however with forked version we cant sync to the latest automatically anymore.
Please solve this issue,so when can sync the the latest version with no problem.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.