Blocking Reverse Proxys from cloudflare

I would like to prevent my network from connecting to cloudflare’s CDN (MITM proxy). Are there any blocklists that can be used where all IP addresses of cloudflare are listed?
Couldn’t the location block function be extended with reverse proxies? (Question to the developers)

Or does anyone know another simple solution to protect against cloudflare man-in-the-middle-attack ?

Edit: Thx for correct the typo.

What about using Banish ( here where to download it: Index of /~helix/banish ) and the ASN number of cloudflare? A bit too draconian?

1 Like

You can’t imagine how many legitimate websites use cloudflare’s CDN service.
If you block all of this provider’s ASNs, you will end up being unhappy, as many everyday websites and/or content will no longer work.
Also, many important websites as update sites will no longer work.
In the end, you end up as an enemy of, your family and your company colleagues… You are then the person who breaks everything, from the point of view of others.

Also, the later search for reasons and malfunctions, will be a very tedious work for you.
For example, finding a single IP from the huge block and then allowing it, is a considerable effort.

If you are looking for an emergency pharmacy or doctor at 02:00 in the morning and certain websites do not work, you will understand that what you are planning is not the right way is.
As you can see and understand, I speak partly from experience.

Do you really want that?
Have you thought this through?

If your answer to the two questions above is yes, then search for the ASNs and block these IP group ranges.
I suggest to use an separate testing environment for a while, to check results and problems you are running into.
Sometimes an whitelist is better than an blocklist.

You can enter ASN founding under Example “Route option” and redirect them to an unused IP at the DMZ as an Gateway IP.
Or create a firewall rule to DROP them.



Yes, unfortunately that is the problem we have with these big cloud providers.

See this blog post from 2021 and I don’t think it has got better in the meantime.



Thank you for your advice, but I am well aware of what this means. Cloudfare has almost 20% under its taper. Wait a minute, I’m going to put on my alu hat. When I read how the NSA could perfect their PRISM program and the answer is that what cloudflare does would be perfect to control the internet and I don’t even need computing power to break SLL certificates because I issue them myself,
As a non-US citizen, the question of how to deal with this monster is quickly answered.

But mainly I am concerned that I am blocked by most ( is fortunately not one of them) anyway by the reverse proxy, because Tor exit nodes are blocked in the default settings of each product of cloudflare. You have to change this as a customer.
Since this number is very limited, I prefer to block the CDN from cloudflare and create a whitelist.

I found the ASN number AS13335 from cloudflare, but I don’t understand where I can use that to create a list and where I can use that list.
To make it short, I need a tutorial for stupids. Terminal is not a problem as long as I can copy the commands.

Thanks a lot!

1 Like

Install banish (see the readme for the instructions) and you can enter the ASN numbers directly and have them available in the firewall menu. Otherwise you need to convert the ASN in IP ranges and enter them in IPset, then you can access those sets in the firewall menu.

You find the ASN info at claudflare IP Ranges there the IP range too as an list.

An simple (test) you can do, by adding those IP ranges groups to static routes, and give an unused IP of your network as an false gateway.


banish is not a offical ipfire addon, i found on github but outdated since 5 years.

And this includes my question, how to convert ASN to IP ranges?

thank you,
I just have to see how I can update this list once cloudflare is no longer available, but ok.

This gateway can be set to an intern IP that is in no IP Range of green,blue and VPN?
Because i did not have a extra network for DMZ.
Is this correct →

and how can I create now a whitelist? For as an example.

sorry did not saw this first post from you.

I will have a look at his package

Test for a while how your needed sites works.
If you then are sure devout that it is the right way, you can follow the same procedure as it is done for shodan IPs.
Make a group at firewall where you add all those IP subs.
Take this link as example and follow the howto:


This static routes alone did changed nothing all cloudflare was reachable.

So what I did in pictures :smiley:
static routs to unused intern IP

Add the networks to firewall groups

Make a group with this networks

Make firewall rule with this group like in the wiki

but that did not work either, all cloudflare was reachable. I don’t understand why cloudflare should not reach me, I want them not to log my IP, so the rule is reversed.

But it doesn’t work either…I can calmly continue to access

So what did I wrong? Any advise ?

Why not just add a new ip-block-list-source for ?!

Add additional sources to IPFire blocklist feature - Security - IPFire Community

Sometimes you need to terminate already established and running connections, because a new rule will act just for next “newer” communication requests.
Same as already known resolved domains IPs by an client computer/browser.

You use an VPN connection, so it could be that the communication were flow over there, or the resolve were done.

You do an 1x incoming and an 1x outgoing rule for eth “Firewall All” to be drop… same as for ex. Shodan or GeoIP incoming/outgoing.

Source is the group you made
Destination is Firewall All

Source is Firewall All
Destination is the group you made

Furthermore put the rules at the top ex. position Nr.1 of firewall rules, to be handeld at first.
Delete the route “Routing Table Entries” with the fake gateway IP, as you do not need them further, after you done your tests and added those two rules to firewall.


1 Like

Hi all,

am wondering if this all ? If i check the ASN via libloc

location search-as "Cloudflare"

i get the following results

AS132892 - Cloudflare, Inc.
AS133877 - Cloudflare Hong Kong, LLC
AS139242 - Cloudflare Sydney, LLC
AS202623 - Cloudflare Inc
AS203898 - Cloudflare Inc
AS209242 - Cloudflare London, LLC

converting this into CIDR´s also via libloc and count the lines i get an result of 2200 CIDR´s

for i in $(location search-as "Cloudflare" | awk -F'[^0-9]*' '$0=$2'); do
    location list-networks-by-as --family=ipv4 "${i}"
done | wc -l

IMHO, the best way to handle this amount might be IPSet.



1 Like

12 posts were split to a new topic: Banish as an add-on?

Nice to see, that here directly so many are interested and my idea encourages to make a forgotten addon fit again… but back to my project…

Yes I know this, I had restart the network.

I even use several VPNs and proxies at the same time but I’ll get to that when I understand exactly how it works.

Man you make my day, I think I had learnd more about this firewall as in the last 10 years now.

But can you explain me why the static routes were set before? So that nothing can happen if I set wrong rules?
Or what is the purpose of that?

in the firewall rules there are 3 rows, the upper one is shown with the default rules of the networks. If I set the forward option in the settings to Blocked, the standard rules disappear. Is there a way to block the blue network for the internet despite the standard rules? Or do I have to set Forward to blocked and define all rules myself?

Back to the cloudflare problem.
For VPN the iptables don’t apply, but do they also not apply if the DNS server of ipfire is used instead of sending the DNS query through the VPN?
If I use the squid proxy from Ipfire the rules work, right?
What about the ipfire tor proxy and would a tor relay also be affected by the firewall rules?
Now, how can I whitelist a host for example that will exclude this iptables rules?

Can you tell me how to start such a query and then generate a list with the IP ranges? I can Add this Ranges in the firewall group to block then too.

Thank you very much for the help so far.

1 Like

Hi @mumpitz

have used firewall.local with specific IPSet sets since the regular Firewall WUI does not convert CIDRs into bitmap or hash format. Therefor i used this script →

!!!Deleted the script since it collides with new IPSet set integration!!!

in the time where the script was developed (thanks again to shellshock) we used u.a. whois to investigate the CIDRs at some time it doesn´t worked that way for some companies. Have now integrated libloc which is not only part in IPFire but also developed by it. A fast test with Cloudflare did it good at the first glance

(last line)

but deeper checks are absolute needed.
Needless to say that Tor or VPN (like in Opera, etc.) circumvent this, also testing systems are always the best way.

A cheap interface for user interaction can be found :smirk:

which was ruff enough for me but surely, Banish might be the way :blush:




But it would be important to me, I could not write the CIDRs also in the host file and block via DNS, so that at least the VPN connections when using the dns server of IPfire will be cloudflare free?
I use several VPNs at the same time to make tracking via IP more difficult.
With my real IP I visit only certain sites there cloudflare plays no role.

In case your client is the VPN endpoint, i think you defeat your own Cloudflare censorship since the FW can not see/block the added CIDRs. If IPFires VPN is the endpoint it might work since the script uses CUSTOMFORWARD{INPUT}{OUTPUT} chain.

Leaving the VPN connections aside, what about the squid proxy and the Tor proxy?