#!/bin/shIPTABLES="/sbin/iptables"$IPTABLES -P OUTPUT ACCEPT$IPTABLES -P INPUT DROP$IPTABLES -P FORWARD DROP#Очищаю всі правила$IPTABLES -F$IPTABLES -X$IPTABLES -N bad_tcp$IPTABLES -N allowed$IPTABLES -N tcp_pack$IPTABLES -N udp_pack$IPTABLES -N icmp_pack#Дозволяю зєднання по петлі$IPTABLES -A INPUT -i lo -j ACCEPT$IPTABLES -A OUTPUT -o lo -j ACCEPT$IPTABLES -A bad_tcp -p tcp --tcp-flags SYN,ACK SYN,ACK -m state --state NEW -j DROP$IPTABLES -A allowed -p TCP --syn -j ACCEPT$IPTABLES -A allowed -p TCP -m state --state ESTABLISHED,RELATED -j ACCEPT#Для allow решту пакетів відкидаєм$IPTABLES -A allowed -j DROP#Відкриваєм потрібні порти$IPTABLES -A tcp_pack -p TCP -s 0/0 --dport 21 -j allowed $IPTABLES -A tcp_pack -p TCP -s 0/0 --dport 80 -j allowed $IPTABLES -A udp_pack -p UDP -s 0/0 --sport 53 -j ACCEPT #-------------------------------------------------------------#Настроюємо icmp$IPTABLES -A icmp_pack -p ICMP -s 0/0 --icmp-type 3 -j ACCEPT # Dest unreachable$IPTABLES -A icmp_pack -p ICMP -s 0/0 --icmp-type 11 -j ACCEPT # Time exceeded$IPTABLES -A icmp_pack -p ICMP -s 0/0 --icmp-type 12 -j ACCEPT # Parameter problem$IPTABLES -A icmp_pack -p ICMP -s 0/0 --icmp-type 8 -j DROP # Ping#--------------------------------------------------------------$IPTABLES -A INPUT -p tcp -j bad_tcp$IPTABLES -A INPUT -p ALL -m state --state ESTABLISHED,RELATED -j ACCEPT$IPTABLES -A INPUT -p TCP -j tcp_pack$IPTABLES -A INPUT -p UDP -j udp_pack$IPTABLES -A INPUT -p ICMP -j icmp_pack
#!/bin/shIPTABLES="/sbin/iptables"$IPTABLES -P OUTPUT ACCEPT$IPTABLES -P INPUT DROP$IPTABLES -P FORWARD DROP$IPTABLES -F$IPTABLES -A INPUT -i lo -j ACCEPT$IPTABLES -A INPUT -p tcp --syn -j ACCEPT$IPTABLES -A INPUT -p tcp -m state --state ESTABLISHED,RELATED -j ACCEPT$IPTABLES -A INPUT -p tcp -m tcp -s 0/0 --dport 21 -j allowed $IPTABLES -A INPUT -p tcp -m tcp -s 0/0 --dport 80 -j allowed $IPTABLES -A INPUT -p udp -m udp -s 0/0 --sport 53 -j ACCEPT $IPTABLES -A INPUT -p icmp -m icmp -s 0/0 --icmp-type 3 -j ACCEPT$IPTABLES -A INPUT -p icmp -m icmp -s 0/0 --icmp-type 11 -j ACCEPT $IPTABLES -A INPUT -p icmp -m icmp -s 0/0 --icmp-type 12 -j ACCEPT$IPTABLES -A INPUT -p icmp -m -s 0/0 --icmp-type 8 -j DROP$IPTABLES -A INPUT -p tcp -j bad_tcp$IPTABLES -A INPUT -p ALL -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A INPUT -p tcp -m tcp -s 0/0 --dport 21 -j allowed $IPTABLES -A INPUT -p tcp -m tcp -s 0/0 --dport 80 -j allowed
$IPTABLES -A INPUT -p tcp --syn -j ACCEPT$IPTABLES -A INPUT -p tcp -m state --state ESTABLISHED,RELATED -j ACCEPT
[root@linadmin scripts]# ./firewall2.shiptables v1.3.5: Couldn't load match `-s':/lib/iptables/libipt_-s.so: cannot open shared object file: No such file or directory
Цитата$IPTABLES -A INPUT -p tcp -m tcp -s 0/0 --dport 21 -j allowed $IPTABLES -A INPUT -p tcp -m tcp -s 0/0 --dport 80 -j allowed allowed перед цим куском коду треба описувати, і як він має виглядати? Бо ви наскільки я поняв створили стандартне правило для INPUTЦитата$IPTABLES -A INPUT -p tcp --syn -j ACCEPT$IPTABLES -A INPUT -p tcp -m state --state ESTABLISHED,RELATED -j ACCEPT, яке в мене було для allow. Вибачаюсь можливо за дурні запитання. :-/Зараз мені видає такеКод: [Вибрати][root@linadmin scripts]# ./firewall2.shiptables v1.3.5: Couldn't load match `-s':/lib/iptables/libipt_-s.so: cannot open shared object file: No such file or directory
${iptables} -N allowed${iptables} -A allowed -p TCP --syn -j ACCEPT${iptables} -A allowed -p TCP -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT# Loging incorect packets:${iptables} -A allowed -p TCP -m limit --limit 5/m -j LOG --log-prefix "iptables tcp INPUT " --log-tcp-options --log-ip-options# Bann all IP which try acces to other${iptables} -A allowed -p TCP -j DROP
[root@linadmin scripts]# ./iptables-workstation wlan0 startDevice /dev/wlan0 not exist!!! Machine type: i586-mandriva-linux-gnu hostname: linadmin. Interface=wlan0 HostIP=192.168.0.70 BroadcastIP=192.168.0.255 NetMask=255.255.255.0iptables v1.3.5: Couldn't load target `BadGuy':/lib/iptables/libipt_BadGuy.so: cannot open shared object file: No such file or directoryTry `iptables -h' or 'iptables --help' for more information.iptables v1.3.5: Couldn't load target `GoodGuy':/lib/iptables/libipt_GoodGuy.so: cannot open shared object file: No such file or directoryTry `iptables -h' or 'iptables --help' for more information.iptables v1.3.5: Couldn't load target `BadTcp':/lib/iptables/libipt_BadTcp.so: cannot open shared object file: No such file or directoryTry `iptables -h' or 'iptables --help' for more information.iptables v1.3.5: Couldn't load target `TCPRules':/lib/iptables/libipt_TCPRules.so: cannot open shared object file: No such file or directoryTry `iptables -h' or 'iptables --help' for more information.iptables v1.3.5: Couldn't load target `TCPRules':/lib/iptables/libipt_TCPRules.so: cannot open shared object file: No such file or directoryTry `iptables -h' or 'iptables --help' for more information.iptables v1.3.5: Bad OWNER UID value `tor'Try `iptables -h' or 'iptables --help' for more information.iptables v1.3.5: Bad OWNER UID value `named'Try `iptables -h' or 'iptables --help' for more information.iptables v1.3.5: Bad OWNER UID value `ebuild'Try `iptables -h' or 'iptables --help' for more information.
Machine type: i586-mandriva-linux-gnu hostname: linadmin. Interface=wlan0 HostIP=192.168.0.70 BroadcastIP=192.168.0.255 NetMask=255.255.255.0
iptables-lo lo start
iptables v1.3.5: Couldn't load target `BadGuy':/lib/iptables/libipt_BadGuy.so: cannot open shared object file: No such file or directoryTry `iptables -h' or 'iptables --help' for more information.iptables v1.3.5: Couldn't load target `GoodGuy':/lib/iptables/libipt_GoodGuy.so: cannot open shared object file: No such file or directoryTry `iptables -h' or 'iptables --help' for more information.iptables v1.3.5: Couldn't load target `BadTcp':/lib/iptables/libipt_BadTcp.so: cannot open shared object file: No such file or directoryTry `iptables -h' or 'iptables --help' for more information.iptables v1.3.5: Couldn't load target `TCPRules':/lib/iptables/libipt_TCPRules.so: cannot open shared object file: No such file or directoryTry `iptables -h' or 'iptables --help' for more information.iptables v1.3.5: Couldn't load target `TCPRules':/lib/iptables/libipt_TCPRules.so: cannot open shared object file: No such file or directory
Try `iptables -h' or 'iptables --help' for more information.iptables v1.3.5: Bad OWNER UID value `tor'Try `iptables -h' or 'iptables --help' for more information.iptables v1.3.5: Bad OWNER UID value `named'Try `iptables -h' or 'iptables --help' for more information.iptables v1.3.5: Bad OWNER UID value `ebuild'Try `iptables -h' or 'iptables --help' for more information.
#!/bin/shIPTABLES="/sbin/iptables"$IPTABLES -P INPUT DROP$IPTABLES -P OUTPUT ACCEPT$IPTABLES -P FORWARD DROP$IPTABLES -F$IPTABLES -X$IPTABLES -A INPUT -i lo -j ACCEPT$IPTABLES -A OUTPUT -o lo -j ACCEPT$IPTABLES -A INPUT -m state -p tcp --state ESTABLISHED,RELATED -j ACCEPT#Доступ до ФТП серверу$IPTABLES -A INPUT -p tcp -i wlan0 --dport 20:21 -s 192.168.0.0/24 -j ACCEPT#Доступ до ВЕБ серверу$IPTABLES -A INPUT -p tcp -i wlan0 --dport 80 -s 192.168.0.0/24 -j ACCEPT#До проксі серверу$IPTABLES -A INPUT -p tcp -i wlan --dport 3128 -s 192.168.0.0/24 -j ACCEPT#Пускаті всі пакети по ТСР$IPTABLES -A OUTPUT -p tcp -o wlan0 -j ACCEPT$IPTABLES -A OUTPUT -p udp -o wlan0 --sport 1024:65535 -j ACCEPT$IPTABLES -A INPUT -p udp -i wlan0 --dport 1024:65535 --sport 53 -j ACCEPT$IPTABLES -A INPUT -p udp -m state --state ESTABLISHED -i wlan0 --dport 1024:65535 -j ACCEPT#ICMP пакети$IPTABLES -A INPUT -p icmp -i wlan0 -m limit -m length --limit 3/second --limit-burst 6 --length :110 -j ACCEPT$IPTABLES -A OUTPUT -p icmp -o wlan0 -m limit -m length --limit 7/second --limit-burst 14 --length :110 -j ACCEPT#$IPTABLES -A INPUT -p icmp -j ACCEPT