Как ни старался все равно порт который я пытаюсь прикрыть остается open
INET_IP="xxxxxxxxxxx" INET_IFACE="eth0" INET_BROADCAST="xxxxxxxxxxx"
LAN_IP="192.168.144.44" LAN_IP_RANGE="192.168.144.0/24"
LO_IFACE="lo" LO_IP="127.0.0.1"
# /sbin/depmod -a
/sbin/modprobe ip_tables /sbin/modprobe ip_conntrack /sbin/modprobe iptable_filter /sbin/modprobe iptable_mangle /sbin/modprobe iptable_nat /sbin/modprobe ipt_LOG /sbin/modprobe ipt_limit /sbin/modprobe ipt_state
echo "1" > /proc/sys/net/ipv4/ip_forward
#echo "1" > /proc/sys/net/ipv4/conf/all/rp_filter #echo "1" > /proc/sys/net/ipv4/conf/all/proxy_arp #echo "1" > /proc/sys/net/ipv4/ip_dynaddr
$IPTABLES -P INPUT DROP $IPTABLES -P OUTPUT DROP $IPTABLES -P FORWARD DROP
$IPTABLES -N bad_tcp_packets
$IPTABLES -N allowed $IPTABLES -N tcp_packets $IPTABLES -N udp_packets $IPTABLES -N icmp_packets
# bad_tcp_packets chain #
$IPTABLES -A bad_tcp_packets -p tcp --tcp-flags SYN,ACK SYN,ACK \ -m state --state NEW -j REJECT --reject-with tcp-reset $IPTABLES -A bad_tcp_packets -p tcp ! --syn -m state --state NEW -j LOG \ --log-prefix "New not syn:" $IPTABLES -A bad_tcp_packets -p tcp ! --syn -m state --state NEW -j DROP
# # allowed chain #
$IPTABLES -A allowed -p TCP --syn -j ACCEPT $IPTABLES -A allowed -p TCP -m state --state ESTABLISHED,RELATED -j ACCEPT $IPTABLES -A allowed -p TCP -j DROP
# # TCP rules #
#$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 21 -j allowed $IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 22 -j allowed #$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 137:139 -j allowed #$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 445 -j allowed # up to 5 Bit-torrent connections $IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 6881:6886 -j allowed #$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 554 -j bad_tcp_packets
# # UDP ports #
$IPTABLES -A udp_packets -p UDP -s 0/0 --destination-port 53 -j ACCEPT $IPTABLES -A udp_packets -p UDP -s 0/0 --destination-port 123 -j ACCEPT $IPTABLES -A udp_packets -p UDP -s 0/0 --destination-port 2074 -j ACCEPT $IPTABLES -A udp_packets -p UDP -s 0/0 --destination-port 4000 -j ACCEPT
$IPTABLES -A icmp_packets -p ICMP -s 0/0 --icmp-type 8 -j ACCEPT $IPTABLES -A icmp_packets -p ICMP -s 0/0 --icmp-type 11 -j ACCEPT
$IPTABLES -A INPUT -p tcp -j bad_tcp_packets
# # Rules for special networks not part of the Internet #
#$IPTABLES -A INPUT -p ALL -s $LAN_IP_RANGE -j ACCEPT #$IPTABLES -A INPUT -p ALL -s $LAN_IP_RANGE -j ACCEPT $IPTABLES -A INPUT -p ALL -i $LO_IFACE -s $LO_IP -j ACCEPT $IPTABLES -A INPUT -p ALL -i $LO_IFACE -s $LAN_IP -j ACCEPT $IPTABLES -A INPUT -p ALL -i $LO_IFACE -s $INET_IP -j ACCEPT $IPTABLES -A INPUT -p ALL -d $LAN_IP_RANGE -j ACCEPT
$IPTABLES -A INPUT -p ALL -d $INET_IP -m state --state ESTABLISHED,RELATED \ -j ACCEPT $IPTABLES -A INPUT -p TCP -i $INET_IFACE -j tcp_packets $IPTABLES -A INPUT -p UDP -i $INET_IFACE -j udp_packets $IPTABLES -A INPUT -p ICMP -i $INET_IFACE -j icmp_packets
$IPTABLES -A FORWARD -p tcp -j bad_tcp_packets
$IPTABLES -A FORWARD -i $LAN_IP -j ACCEPT $IPTABLES -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -m limit --limit 3/minute --limit-burst 3 -j LOG \ --log-level DEBUG --log-prefix "IPT FORWARD packet died: "
# # Bad TCP packets we don't want. #
$IPTABLES -A OUTPUT -p tcp -j bad_tcp_packets
# # Special OUTPUT rules to decide which IP's to allow. #
$IPTABLES -A OUTPUT -p ALL -s $LO_IP -j ACCEPT #$IPTABLES -A OUTPUT -p ALL -s $LAN_IP -j ACCEPT $IPTABLES -A OUTPUT -p ALL -s $INET_IP -j ACCEPT #$IPTABLES -A OUTPUT -p ALL -s $LAN_IP_RANGE -j ACCEPT
То есть вот например там закомментировал строчку которая отвечает за ftp-21 порт.Пробовал и $IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 21 -j DROP,но с другого компа nmap пишет что он open.