Portál AbcLinuxu, 9. května 2025 06:09
#!/bin/sh #část za = nastav na místo, kde je IPTABLES IPTABLES=/sbin/iptables #zrušit existující pravidla $IPTABLES -F INPUT #Unožnit odpovídat odchozím připojením z tohoto PC $IPTABLES -A INPUT -j ACCEPT -m state --state \ ESTABLISHED -i eth0 -p icmp $IPTABLES -A INPUT -j ACCEPT -m state --state \ ESTABLISHED -i eth0 -p tcp $IPTABLES -A INPUT -j ACCEPT -m state --state \ ESTABLISHED -i eth0 -p udp #Povolit příchozí požadavky SSH $IPTABLES -A INPUT -p tcp --dport 22 -j ACCEPT #Povolit příchozí DNS $IPTABLES -A INPUT -p udp --dport 53 -j ACCEPT $IPTABLES -A INPUT -p tcp --dport 53 -j ACCEPT #Povolit příchozí požadavky HTTP $IPTABLES -A INPUT -p tcp --dport 80 -j ACCEPT $IPTABLES -A INPUT -p tcp --dport 443 -j ACCEPT #Povolit echo příkazu PING $IPTABLES -A INPUT -p icmp -j ACCEPT #Nahrát moduly: insmod ip_conntrack_ftp insmod ipt_LOG insmod ipt_REJECT insmod ipt_limit insmod ipt_state #Logování je nastaveno tak, že je-li vypuštěno více než 5 paketů za 3 sekundy, tak budou ignorovány #Tím se zabraňuje DOS útoku $IPTABLES -A INPUT -m limit --limit 3/second \ --limit-burst 5 -i ! lo -j LOG #Vypustit a logovat všechna ostatní data $IPTABLES -A INPUT -i ! lo -j DROPOvšem pokud to spustím, tak se mi vypíše:
iptables v1.4.9: Bad state " ESTABLISHED" Try `iptables -h' or 'iptables --help' for more information. iptables v1.4.9: Bad state " ESTABLISHED" Try `iptables -h' or 'iptables --help' for more information. iptables v1.4.9: Bad state " ESTABLISHED" Try `iptables -h' or 'iptables --help' for more information. insmod: can't read 'ip_conntrack_ftp': No such file or directory insmod: can't read 'ipt_LOG': No such file or directory insmod: can't read 'ipt_REJECT': No such file or directory insmod: can't read 'ipt_limit': No such file or directory insmod: can't read 'ipt_state': No such file or directory Bad argument ` --limit-burst' Try `iptables -h' or 'iptables --help' for more information. Using intrapositioned negation (`--option ! this`) is deprecated in favor of extrapositioned (`! --option this`).Můžete mi prosím poradit co s tím? Jak to upravit aby to fungovalo? Děkuji za pomoc.
Řešení dotazu:
/
", pripadne "\
". teda napriklad:
$IPTABLES -A INPUT -m limit --limit 3second --limit-burst 5 -i ! lo -j LOG
insmod: can't read 'ip_conntrack_ftp': No such file or directory insmod: can't read 'ipt_LOG': No such file or directory insmod: can't read 'ipt_REJECT': No such file or directory insmod: can't read 'ipt_limit': No such file or directory insmod: can't read 'ipt_state': No such file or directory Using intrapositioned negation (`--option ! this`) is deprecated in favor of extrapositioned (`! --option this`). Using intrapositioned negation (`--option ! this`) is deprecated in favor of extrapositioned (`! --option this`).
insmod
. moduly si iptables
loaduje sam, vyhod tie riadky, tj:
insmod ip_conntrack_ftp
insmod ipt_LOG
insmod ipt_REJECT
insmod ipt_limit
insmod ipt_state
vymaz.
! -i loMisto vsech tech 'insmod' staci bohate dva:
modprobe ip_conntrack modrpobe ip_conntrack_ftpMisto vsech tech ESTABLISHED staci:
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPTNN
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.