change to iptables
This commit is contained in:
28
iptables/china-unblock.sh
Executable file
28
iptables/china-unblock.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
IPSET_NAME="china"
|
||||
|
||||
echo "[*] Removing iptables rules..."
|
||||
iptables -D INPUT -m set --match-set "$IPSET_NAME" src -j DROP 2>/dev/null || true
|
||||
iptables -D OUTPUT -m set --match-set "$IPSET_NAME" dst -j DROP 2>/dev/null || true
|
||||
|
||||
echo "[*] Removing raw table rules..."
|
||||
iptables -t raw -D PREROUTING -m set --match-set "$IPSET_NAME" src -j DROP 2>/dev/null || true
|
||||
iptables -t raw -D OUTPUT -m set --match-set "$IPSET_NAME" dst -j DROP 2>/dev/null || true
|
||||
|
||||
echo "[*] Removing ip6tables rules..."
|
||||
ip6tables -D INPUT -m set --match-set china6 src -j DROP 2>/dev/null || true
|
||||
ip6tables -D OUTPUT -m set --match-set china6 dst -j DROP 2>/dev/null || true
|
||||
ip6tables -t raw -D PREROUTING -m set --match-set china6 src -j DROP 2>/dev/null || true
|
||||
ip6tables -t raw -D OUTPUT -m set --match-set china6 dst -j DROP 2>/dev/null || true
|
||||
|
||||
echo "[*] Destroying ipsets..."
|
||||
ipset destroy "$IPSET_NAME" 2>/dev/null || true
|
||||
ipset destroy china6 2>/dev/null || true
|
||||
rm -f /etc/ipset.conf /tmp/cn.cidr /tmp/cn6.cidr
|
||||
|
||||
echo "[*] Clearing saved rules..."
|
||||
rm -f /etc/iptables/iptables.rules /etc/iptables/ip6tables.rules
|
||||
|
||||
echo "[+] Done! Chinese IPs are now unblocked."
|
||||
Reference in New Issue
Block a user