Created
July 31, 2025 08:14
-
-
Save jedisct1/3060ba3c116b627da621e6666aa4a2a7 to your computer and use it in GitHub Desktop.
Block all connections to Fastly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
IPV4_RANGES=( | |
"23.235.32.0/20" | |
"43.249.72.0/22" | |
"103.244.50.0/24" | |
"103.245.222.0/23" | |
"103.245.224.0/24" | |
"104.156.80.0/20" | |
"140.248.64.0/18" | |
"140.248.128.0/17" | |
"146.75.0.0/17" | |
"151.101.0.0/16" | |
"157.52.64.0/18" | |
"167.82.0.0/17" | |
"167.82.128.0/20" | |
"167.82.160.0/20" | |
"167.82.224.0/20" | |
"172.111.64.0/18" | |
"185.31.16.0/22" | |
"199.27.72.0/21" | |
"199.232.0.0/16" | |
) | |
IPV6_RANGES=( | |
"2a04:4e40::/32" | |
"2a04:4e42::/32" | |
) | |
for ip in "${IPV4_RANGES[@]}"; do | |
iptables -A OUTPUT -d $ip -j REJECT | |
iptables -A FORWARD -d $ip -j REJECT | |
done | |
for ip in "${IPV6_RANGES[@]}"; do | |
ip6tables -A OUTPUT -d $ip -j REJECT | |
ip6tables -A FORWARD -d $ip -j REJECT | |
done | |
echo "Blocking rules have been applied to OUTPUT and FORWARD chains." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment