Script freenetis ipset: Porovnání verzí
Z Freenetis Wiki
Řádek 15: | Řádek 15: | ||
PORT_WEB=80 | PORT_WEB=80 | ||
PORT_REDIRECT=36000 | PORT_REDIRECT=36000 | ||
− | + | ||
SET_URL_RANGES=http://freenetis.slfree.net/cs/redirect/ipset/ranges | SET_URL_RANGES=http://freenetis.slfree.net/cs/redirect/ipset/ranges | ||
SET_URL_PARTNERS=http://freenetis.slfree.net/cs/redirect/ipset/partners | SET_URL_PARTNERS=http://freenetis.slfree.net/cs/redirect/ipset/partners | ||
SET_URL_MEMBERS=http://freenetis.slfree.net/cs/redirect/ipset/members | SET_URL_MEMBERS=http://freenetis.slfree.net/cs/redirect/ipset/members | ||
− | + | ||
# Funkce testuje jestli je dana ip validne zapsana | # Funkce testuje jestli je dana ip validne zapsana | ||
# @param ip adresa | # @param ip adresa | ||
Řádek 27: | Řádek 27: | ||
local ip=$1 | local ip=$1 | ||
local stat=1 | local stat=1 | ||
− | + | ||
if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then | if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then | ||
OIFS=$IFS | OIFS=$IFS | ||
Řádek 38: | Řádek 38: | ||
return $stat | return $stat | ||
} | } | ||
− | + | ||
# Funkce testuje jestli je dany subnet validne zapsany | # Funkce testuje jestli je dany subnet validne zapsany | ||
# @param subnet | # @param subnet | ||
Řádek 46: | Řádek 46: | ||
local subnet=$1 | local subnet=$1 | ||
local stat=1 | local stat=1 | ||
− | + | ||
if [[ $subnet =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\/[0-9]{1,2}$ ]]; then | if [[ $subnet =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\/[0-9]{1,2}$ ]]; then | ||
OIFS=$IFS | OIFS=$IFS | ||
Řádek 62: | Řádek 62: | ||
return $stat | return $stat | ||
} | } | ||
− | + | ||
function update() | function update() | ||
{ | { | ||
Řádek 70: | Řádek 70: | ||
ipset -F partners | ipset -F partners | ||
ipset -F members | ipset -F members | ||
− | + | ||
echo "Downloading data"; | echo "Downloading data"; | ||
wget -q -O /tmp/ranges $SET_URL_RANGES | wget -q -O /tmp/ranges $SET_URL_RANGES | ||
wget -q -O /tmp/partners $SET_URL_PARTNERS | wget -q -O /tmp/partners $SET_URL_PARTNERS | ||
wget -q -O /tmp/members $SET_URL_MEMBERS | wget -q -O /tmp/members $SET_URL_MEMBERS | ||
− | + | ||
− | |||
BAKIFS=$IFS | BAKIFS=$IFS | ||
IFS=$(echo -en "\n\b") | IFS=$(echo -en "\n\b") | ||
exec 3<&0 | exec 3<&0 | ||
− | + | ||
#Plnime set partners | #Plnime set partners | ||
echo "Filling set partnets."; | echo "Filling set partnets."; | ||
Řádek 88: | Řádek 87: | ||
if valid_subnet $LINE; then echo "$LINE - added to set partners."; ipset -A partners $LINE; else echo "$LINE - not valid subnet."; fi | if valid_subnet $LINE; then echo "$LINE - added to set partners."; ipset -A partners $LINE; else echo "$LINE - not valid subnet."; fi | ||
done | done | ||
− | + | ||
#Plnime set members | #Plnime set members | ||
echo "Filling set members."; | echo "Filling set members."; | ||
Řádek 96: | Řádek 95: | ||
if valid_ip $LINE; then echo "$LINE - added to set members."; ipset -A members $LINE; else echo "$LINE - not valid IP address."; fi | if valid_ip $LINE; then echo "$LINE - added to set members."; ipset -A members $LINE; else echo "$LINE - not valid IP address."; fi | ||
done | done | ||
− | + | ||
#Plnime set ranges - je nutne aby se plnil az na konci. Jinak by byly presmerovane ip v dobe kdy se set nenbers a partners teprve plni. | #Plnime set ranges - je nutne aby se plnil az na konci. Jinak by byly presmerovane ip v dobe kdy se set nenbers a partners teprve plni. | ||
echo "Filling set ranges."; | echo "Filling set ranges."; | ||
Řádek 104: | Řádek 103: | ||
if valid_subnet $LINE; then echo "$LINE - added to set ranges."; ipset -A ranges $LINE; else echo "$LINE - not valid subnet."; fi | if valid_subnet $LINE; then echo "$LINE - added to set ranges."; ipset -A ranges $LINE; else echo "$LINE - not valid subnet."; fi | ||
done | done | ||
− | + | ||
exec 0<&3 | exec 0<&3 | ||
IFS=$BAKIFS | IFS=$BAKIFS | ||
− | + | ||
#Cleaning up | #Cleaning up | ||
rm /tmp/ranges | rm /tmp/ranges | ||
Řádek 113: | Řádek 112: | ||
rm /tmp/members | rm /tmp/members | ||
} | } | ||
− | + | ||
case "$1" in | case "$1" in | ||
start) | start) | ||
− | |||
echo "Adding sets."; | echo "Adding sets."; | ||
ipset -N ranges nethash --hashsize 1024 --probes 4 --resize 50 | ipset -N ranges nethash --hashsize 1024 --probes 4 --resize 50 | ||
ipset -N partners nethash --hashsize 1024 --probes 4 --resize 50 | ipset -N partners nethash --hashsize 1024 --probes 4 --resize 50 | ||
ipset -N members iphash --hashsize 10000 --probes 8 --resize 50 | ipset -N members iphash --hashsize 10000 --probes 8 --resize 50 | ||
− | + | ||
echo "Adding firewall rules."; | echo "Adding firewall rules."; | ||
#Pravidlo pro pridani ip do setu members. Pokud projde firewallem packet na danou cilovou ip prida se zdrojova ip do setu members. | #Pravidlo pro pridani ip do setu members. Pokud projde firewallem packet na danou cilovou ip prida se zdrojova ip do setu members. | ||
$IPTABLES -t nat -A PREROUTING -m set --set ranges src -d $IP_TARGET -j SET --add-set members src | $IPTABLES -t nat -A PREROUTING -m set --set ranges src -d $IP_TARGET -j SET --add-set members src | ||
− | + | ||
#Pokud uz je ip v setu members nebo partners neaplikuje se presmerovani. | #Pokud uz je ip v setu members nebo partners neaplikuje se presmerovani. | ||
$IPTABLES -t nat -A PREROUTING -m set --set partners src -j ACCEPT | $IPTABLES -t nat -A PREROUTING -m set --set partners src -j ACCEPT | ||
$IPTABLES -t nat -A PREROUTING -m set --set members src -j ACCEPT | $IPTABLES -t nat -A PREROUTING -m set --set members src -j ACCEPT | ||
− | + | ||
#Povoleni portu 36000 pro potreby presmerovani. Na tomto portu nasloucha webserver a provede presmerovani na zvolenou url. | #Povoleni portu 36000 pro potreby presmerovani. Na tomto portu nasloucha webserver a provede presmerovani na zvolenou url. | ||
$IPTABLES -t nat -A PREROUTING -m set --set ranges src -p tcp --dport $PORT_REDIRECT -j ACCEPT | $IPTABLES -t nat -A PREROUTING -m set --set ranges src -p tcp --dport $PORT_REDIRECT -j ACCEPT | ||
− | + | ||
#Presmerovani vseho co miri do internetu a ma cilovy port 80 na port 36000. | #Presmerovani vseho co miri do internetu a ma cilovy port 80 na port 36000. | ||
$IPTABLES -t nat -A PREROUTING -m set --set ranges src -p tcp --dport $PORT_WEB -j REDIRECT --to-port $PORT_REDIRECT | $IPTABLES -t nat -A PREROUTING -m set --set ranges src -p tcp --dport $PORT_WEB -j REDIRECT --to-port $PORT_REDIRECT | ||
− | + | ||
#Vyjimky ip adres a portu ktere budou fungovat i po presmerovani. | #Vyjimky ip adres a portu ktere budou fungovat i po presmerovani. | ||
$IPTABLES -t nat -A PREROUTING -m set --set ranges src -p icmp -d $IP_SELF -j ACCEPT | $IPTABLES -t nat -A PREROUTING -m set --set ranges src -p icmp -d $IP_SELF -j ACCEPT | ||
$IPTABLES -t nat -A PREROUTING -m set --set ranges src -p udp -d $IP_SELF --dport 53 -j ACCEPT | $IPTABLES -t nat -A PREROUTING -m set --set ranges src -p udp -d $IP_SELF --dport 53 -j ACCEPT | ||
$IPTABLES -t nat -A PREROUTING -m set --set ranges src -p tcp -d $IP_SELF --dport 22 -j ACCEPT | $IPTABLES -t nat -A PREROUTING -m set --set ranges src -p tcp -d $IP_SELF --dport 22 -j ACCEPT | ||
− | + | ||
$IPTABLES -t nat -A PREROUTING -m set --set ranges src -p icmp -d $IP_SELF1 -j ACCEPT | $IPTABLES -t nat -A PREROUTING -m set --set ranges src -p icmp -d $IP_SELF1 -j ACCEPT | ||
$IPTABLES -t nat -A PREROUTING -m set --set ranges src -p udp -d $IP_SELF1 --dport 53 -j ACCEPT | $IPTABLES -t nat -A PREROUTING -m set --set ranges src -p udp -d $IP_SELF1 --dport 53 -j ACCEPT | ||
$IPTABLES -t nat -A PREROUTING -m set --set ranges src -p tcp -d $IP_SELF1 --dport 22 -j ACCEPT | $IPTABLES -t nat -A PREROUTING -m set --set ranges src -p tcp -d $IP_SELF1 --dport 22 -j ACCEPT | ||
− | + | ||
− | |||
#Vyjimka pro kecalka pro podporu | #Vyjimka pro kecalka pro podporu | ||
$IPTABLES -t nat -A PREROUTING -m set --set ranges src -p tcp -d 67.23.29.84 --dport 80 -j ACCEPT | $IPTABLES -t nat -A PREROUTING -m set --set ranges src -p tcp -d 67.23.29.84 --dport 80 -j ACCEPT | ||
$IPTABLES -t nat -A PREROUTING -m set --set ranges src -p tcp -d 67.23.27.61 --dport 80 -j ACCEPT | $IPTABLES -t nat -A PREROUTING -m set --set ranges src -p tcp -d 67.23.27.61 --dport 80 -j ACCEPT | ||
− | + | ||
#Jinak vse ostatni zahod. | #Jinak vse ostatni zahod. | ||
$IPTABLES -t nat -A PREROUTING -m set --set ranges src -j DROP | $IPTABLES -t nat -A PREROUTING -m set --set ranges src -j DROP | ||
− | + | ||
exit 1 | exit 1 | ||
;; | ;; | ||
− | + | ||
restart) | restart) | ||
$0 stop | $0 stop | ||
Řádek 161: | Řádek 158: | ||
exit 1 | exit 1 | ||
;; | ;; | ||
− | + | ||
update) | update) | ||
update | update | ||
exit 1 | exit 1 | ||
;; | ;; | ||
− | + | ||
stop) | stop) | ||
Řádek 172: | Řádek 169: | ||
#Pravidlo pro pridani ip do setu members. Pokud projde firewallem packet na danou cilovou ip prida se zdrojova ip do setu members. | #Pravidlo pro pridani ip do setu members. Pokud projde firewallem packet na danou cilovou ip prida se zdrojova ip do setu members. | ||
$IPTABLES -t nat -D PREROUTING -m set --set ranges src -d $IP_TARGET -j SET --add-set members src | $IPTABLES -t nat -D PREROUTING -m set --set ranges src -d $IP_TARGET -j SET --add-set members src | ||
− | + | ||
#Pokud uz je ip v setu members nebo partners neaplikuje se presmerovani. | #Pokud uz je ip v setu members nebo partners neaplikuje se presmerovani. | ||
$IPTABLES -t nat -D PREROUTING -m set --set partners src -j ACCEPT | $IPTABLES -t nat -D PREROUTING -m set --set partners src -j ACCEPT | ||
$IPTABLES -t nat -D PREROUTING -m set --set members src -j ACCEPT | $IPTABLES -t nat -D PREROUTING -m set --set members src -j ACCEPT | ||
− | + | ||
#Povoleni portu 36000 pro potreby presmerovani. Na tomto portu nasloucha webserver a provede presmerovani na zvolenou url. | #Povoleni portu 36000 pro potreby presmerovani. Na tomto portu nasloucha webserver a provede presmerovani na zvolenou url. | ||
$IPTABLES -t nat -D PREROUTING -m set --set ranges src -p tcp --dport $PORT_REDIRECT -j ACCEPT | $IPTABLES -t nat -D PREROUTING -m set --set ranges src -p tcp --dport $PORT_REDIRECT -j ACCEPT | ||
− | + | ||
#Presmerovani vseho co miri do internetu a ma cilovy port 80 na port 36000. | #Presmerovani vseho co miri do internetu a ma cilovy port 80 na port 36000. | ||
$IPTABLES -t nat -D PREROUTING -m set --set ranges src -p tcp --dport $PORT_WEB -j REDIRECT --to-port $PORT_REDIRECT | $IPTABLES -t nat -D PREROUTING -m set --set ranges src -p tcp --dport $PORT_WEB -j REDIRECT --to-port $PORT_REDIRECT | ||
− | + | ||
#Vyjimky ip adres a portu ktere budou fungovat i po presmerovani. | #Vyjimky ip adres a portu ktere budou fungovat i po presmerovani. | ||
$IPTABLES -t nat -D PREROUTING -m set --set ranges src -p icmp -d $IP_SELF -j ACCEPT | $IPTABLES -t nat -D PREROUTING -m set --set ranges src -p icmp -d $IP_SELF -j ACCEPT | ||
$IPTABLES -t nat -D PREROUTING -m set --set ranges src -p udp -d $IP_SELF --dport 53 -j ACCEPT | $IPTABLES -t nat -D PREROUTING -m set --set ranges src -p udp -d $IP_SELF --dport 53 -j ACCEPT | ||
$IPTABLES -t nat -D PREROUTING -m set --set ranges src -p tcp -d $IP_SELF --dport 22 -j ACCEPT | $IPTABLES -t nat -D PREROUTING -m set --set ranges src -p tcp -d $IP_SELF --dport 22 -j ACCEPT | ||
− | + | ||
$IPTABLES -t nat -D PREROUTING -m set --set ranges src -p icmp -d $IP_SELF1 -j ACCEPT | $IPTABLES -t nat -D PREROUTING -m set --set ranges src -p icmp -d $IP_SELF1 -j ACCEPT | ||
$IPTABLES -t nat -D PREROUTING -m set --set ranges src -p udp -d $IP_SELF1 --dport 53 -j ACCEPT | $IPTABLES -t nat -D PREROUTING -m set --set ranges src -p udp -d $IP_SELF1 --dport 53 -j ACCEPT | ||
$IPTABLES -t nat -D PREROUTING -m set --set ranges src -p tcp -d $IP_SELF1 --dport 22 -j ACCEPT | $IPTABLES -t nat -D PREROUTING -m set --set ranges src -p tcp -d $IP_SELF1 --dport 22 -j ACCEPT | ||
− | + | ||
#Vyjimka pro kecalka pro podporu | #Vyjimka pro kecalka pro podporu | ||
$IPTABLES -t nat -D PREROUTING -m set --set ranges src -p tcp -d 67.23.29.84 --dport 80 -j ACCEPT | $IPTABLES -t nat -D PREROUTING -m set --set ranges src -p tcp -d 67.23.29.84 --dport 80 -j ACCEPT | ||
$IPTABLES -t nat -D PREROUTING -m set --set ranges src -p tcp -d 67.23.27.61 --dport 80 -j ACCEPT | $IPTABLES -t nat -D PREROUTING -m set --set ranges src -p tcp -d 67.23.27.61 --dport 80 -j ACCEPT | ||
− | + | ||
#Jinak vse ostatni zahod. | #Jinak vse ostatni zahod. | ||
$IPTABLES -t nat -D PREROUTING -m set --set ranges src -j DROP | $IPTABLES -t nat -D PREROUTING -m set --set ranges src -j DROP | ||
− | + | ||
echo "Deleting sets."; | echo "Deleting sets."; | ||
ipset -X ranges | ipset -X ranges | ||
ipset -X partners | ipset -X partners | ||
ipset -X members | ipset -X members | ||
− | + | ||
exit 1 | exit 1 | ||
;; | ;; | ||
esac | esac | ||
− | + | ||
exit 0 | exit 0 |
Verze z 1. 3. 2010, 08:28
################################################################################## #! /bin/sh # # # # Skript pro presmerovani ip adres. Data jsou nacitana automaticky z freenetisu. # # # # autor Sevcik Roman 2009 # # email sevcik.roman@slfree.net # # # ################################################################################## IPTABLES=/usr/local/sbin/iptables IP_SELF=10.143.128.1 IP_SELF1=10.143.129.0 IP_TARGET=212.111.4.121 PORT_WEB=80 PORT_REDIRECT=36000 SET_URL_RANGES=http://freenetis.slfree.net/cs/redirect/ipset/ranges SET_URL_PARTNERS=http://freenetis.slfree.net/cs/redirect/ipset/partners SET_URL_MEMBERS=http://freenetis.slfree.net/cs/redirect/ipset/members # Funkce testuje jestli je dana ip validne zapsana # @param ip adresa # return 1 pokud je ip validni function valid_ip() { local ip=$1 local stat=1 if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then OIFS=$IFS IFS='.' ip=($ip) IFS=$OIFS [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 && ${ip[2]} -le 255 && ${ip[3]} -le 255 ]] stat=$? fi return $stat } # Funkce testuje jestli je dany subnet validne zapsany # @param subnet # return 1 pokud je subnet validni function valid_subnet() { local subnet=$1 local stat=1 if [[ $subnet =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\/[0-9]{1,2}$ ]]; then OIFS=$IFS IFS='/' subnet=($subnet) IFS='.' ip=${subnet[0]} ip=($ip) mask=${subnet[1]} IFS=$OIFS [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 && ${ip[2]} -le 255 && ${ip[3]} -le 255 ]] $mask -le 31 stat=$? fi return $stat } function update() { #Vymazeme obsah vsech setu echo "Erasing content of sets."; ipset -F ranges ipset -F partners ipset -F members echo "Downloading data"; wget -q -O /tmp/ranges $SET_URL_RANGES wget -q -O /tmp/partners $SET_URL_PARTNERS wget -q -O /tmp/members $SET_URL_MEMBERS BAKIFS=$IFS IFS=$(echo -en "\n\b") exec 3<&0 #Plnime set partners echo "Filling set partnets."; exec 0</tmp/partners while read LINE do if valid_subnet $LINE; then echo "$LINE - added to set partners."; ipset -A partners $LINE; else echo "$LINE - not valid subnet."; fi done #Plnime set members echo "Filling set members."; exec 0</tmp/members while read LINE do if valid_ip $LINE; then echo "$LINE - added to set members."; ipset -A members $LINE; else echo "$LINE - not valid IP address."; fi done #Plnime set ranges - je nutne aby se plnil az na konci. Jinak by byly presmerovane ip v dobe kdy se set nenbers a partners teprve plni. echo "Filling set ranges."; exec 0</tmp/ranges while read LINE do if valid_subnet $LINE; then echo "$LINE - added to set ranges."; ipset -A ranges $LINE; else echo "$LINE - not valid subnet."; fi done exec 0<&3 IFS=$BAKIFS #Cleaning up rm /tmp/ranges rm /tmp/partners rm /tmp/members } case "$1" in start) echo "Adding sets."; ipset -N ranges nethash --hashsize 1024 --probes 4 --resize 50 ipset -N partners nethash --hashsize 1024 --probes 4 --resize 50 ipset -N members iphash --hashsize 10000 --probes 8 --resize 50 echo "Adding firewall rules."; #Pravidlo pro pridani ip do setu members. Pokud projde firewallem packet na danou cilovou ip prida se zdrojova ip do setu members. $IPTABLES -t nat -A PREROUTING -m set --set ranges src -d $IP_TARGET -j SET --add-set members src #Pokud uz je ip v setu members nebo partners neaplikuje se presmerovani. $IPTABLES -t nat -A PREROUTING -m set --set partners src -j ACCEPT $IPTABLES -t nat -A PREROUTING -m set --set members src -j ACCEPT #Povoleni portu 36000 pro potreby presmerovani. Na tomto portu nasloucha webserver a provede presmerovani na zvolenou url. $IPTABLES -t nat -A PREROUTING -m set --set ranges src -p tcp --dport $PORT_REDIRECT -j ACCEPT #Presmerovani vseho co miri do internetu a ma cilovy port 80 na port 36000. $IPTABLES -t nat -A PREROUTING -m set --set ranges src -p tcp --dport $PORT_WEB -j REDIRECT --to-port $PORT_REDIRECT #Vyjimky ip adres a portu ktere budou fungovat i po presmerovani. $IPTABLES -t nat -A PREROUTING -m set --set ranges src -p icmp -d $IP_SELF -j ACCEPT $IPTABLES -t nat -A PREROUTING -m set --set ranges src -p udp -d $IP_SELF --dport 53 -j ACCEPT $IPTABLES -t nat -A PREROUTING -m set --set ranges src -p tcp -d $IP_SELF --dport 22 -j ACCEPT $IPTABLES -t nat -A PREROUTING -m set --set ranges src -p icmp -d $IP_SELF1 -j ACCEPT $IPTABLES -t nat -A PREROUTING -m set --set ranges src -p udp -d $IP_SELF1 --dport 53 -j ACCEPT $IPTABLES -t nat -A PREROUTING -m set --set ranges src -p tcp -d $IP_SELF1 --dport 22 -j ACCEPT #Vyjimka pro kecalka pro podporu $IPTABLES -t nat -A PREROUTING -m set --set ranges src -p tcp -d 67.23.29.84 --dport 80 -j ACCEPT $IPTABLES -t nat -A PREROUTING -m set --set ranges src -p tcp -d 67.23.27.61 --dport 80 -j ACCEPT #Jinak vse ostatni zahod. $IPTABLES -t nat -A PREROUTING -m set --set ranges src -j DROP exit 1 ;; restart) $0 stop $0 start exit 1 ;; update) update exit 1 ;; stop)
echo "Deleting firewall rules."; #Pravidlo pro pridani ip do setu members. Pokud projde firewallem packet na danou cilovou ip prida se zdrojova ip do setu members. $IPTABLES -t nat -D PREROUTING -m set --set ranges src -d $IP_TARGET -j SET --add-set members src #Pokud uz je ip v setu members nebo partners neaplikuje se presmerovani. $IPTABLES -t nat -D PREROUTING -m set --set partners src -j ACCEPT $IPTABLES -t nat -D PREROUTING -m set --set members src -j ACCEPT #Povoleni portu 36000 pro potreby presmerovani. Na tomto portu nasloucha webserver a provede presmerovani na zvolenou url. $IPTABLES -t nat -D PREROUTING -m set --set ranges src -p tcp --dport $PORT_REDIRECT -j ACCEPT #Presmerovani vseho co miri do internetu a ma cilovy port 80 na port 36000. $IPTABLES -t nat -D PREROUTING -m set --set ranges src -p tcp --dport $PORT_WEB -j REDIRECT --to-port $PORT_REDIRECT #Vyjimky ip adres a portu ktere budou fungovat i po presmerovani. $IPTABLES -t nat -D PREROUTING -m set --set ranges src -p icmp -d $IP_SELF -j ACCEPT $IPTABLES -t nat -D PREROUTING -m set --set ranges src -p udp -d $IP_SELF --dport 53 -j ACCEPT $IPTABLES -t nat -D PREROUTING -m set --set ranges src -p tcp -d $IP_SELF --dport 22 -j ACCEPT $IPTABLES -t nat -D PREROUTING -m set --set ranges src -p icmp -d $IP_SELF1 -j ACCEPT $IPTABLES -t nat -D PREROUTING -m set --set ranges src -p udp -d $IP_SELF1 --dport 53 -j ACCEPT $IPTABLES -t nat -D PREROUTING -m set --set ranges src -p tcp -d $IP_SELF1 --dport 22 -j ACCEPT #Vyjimka pro kecalka pro podporu $IPTABLES -t nat -D PREROUTING -m set --set ranges src -p tcp -d 67.23.29.84 --dport 80 -j ACCEPT $IPTABLES -t nat -D PREROUTING -m set --set ranges src -p tcp -d 67.23.27.61 --dport 80 -j ACCEPT #Jinak vse ostatni zahod. $IPTABLES -t nat -D PREROUTING -m set --set ranges src -j DROP echo "Deleting sets."; ipset -X ranges ipset -X partners ipset -X members exit 1 ;; esac exit 0