Skip to main content

Automatic CloudFlare Tor Exit Whitelister

CloudFlare provides an external service to defend your site against denial of service attacks. Unfortunately Tor users are often inconvenienced by repeated requests to solve CAPTCHA’s due to CloudFlare’s threat scoring approach.

CloudFlare does not currently provide a means of allowing Tor visitors. Website operators should be able to take advantage of the increased stability and DoS resistance that CloudFlare provides without blocking their anonymous users.

On the [tor-talk] mailing list, Moritz Bartl proposed the idea that operators could explicitly white list Tor exit IP addresses in their control panel as a stop-gap measure to avoid blocking their users.

This script is a rough proof-of-concept which whitelist’s Tor exit IP addresses via the CloudFlare REST API. Problematically CloudFlare currently enforces a maximum limit of 200 access rules per user or zone. However the top 200 Tor exit IP addresses currently represent ~95% of the exit probability. as such using this should still significantly enhance the user experience for Tor users.

All feedback and bug reports very welcome!

Installation

$ pip install cloudflare-tor-whitelister

Usage

Your CloudFlare API token and email can also be specified in the environment variables CLOUDFLARE_API_TOKEN and CLOUDFLARE_EMAIL.

$ cloudflare-whitelist -t 'API_TOKEN' -e 'CLOUDFLARE_EMAIL'

By default the whitelist rules are applied across all zones owned by your account. If instead you would like to only whitelist on a particular domain you should specify it with the –zone option.

It is probably sufficient to run this script via cron once per day.

Metadata

Release files for cloudflare-tor-whitelister 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cloudflare-tor-whitelister 0.1.1
File Size Uploaded Provenance Actions
cloudflare-tor-whitelister-0.1.1.tar.gz 5.8 kB Without provenance Details for cloudflare-tor-whitelister-0.1.1.tar.gz

Release files / cloudflare-tor-whitelister-0.1.1.tar.gz

Download URL cloudflare-tor-whitelister-0.1.1.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2ab7d63f7829f3d43421ce8f9aafcf8800660e53c202e65882fb918a116857d4
BLAKE2b-256 checksum
How to use checksums
0422574d1ca4aefede44806a38569f6622d9f0e8279c858da631b05ba378e927
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for cloudflare-tor-whitelister 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page