#!/bin/sh # # firewall-standalone-iptables This script sets up firewall rules for a standalone machine. # # Этот скрипт устанавливает правила фильтации пакетов. # # Copyright (C) 2002 ALT Linux Team. This software may be distributed under the terms # of the GNU General Public License, version 2 or any later version. # Interface to Internet EXTIF=ppp+ ANY=0.0.0.0/0 iptables -P INPUT DROP iptables -P OUTPUT ACCEPT iptables -P FORWARD DROP iptables -F INPUT iptables -F OUTPUT iptables -F FORWARD # Syn-flood protection. # Защита от Syn-flood. iptables -A INPUT -p tcp --syn -m limit --limit 1/s -j ACCEPT # Furtive port scanner. # Защита от скрытого сканирования портов. iptables -A INPUT -p tcp --tcp-flags SYN,ACK,FIN,RST RST -m limit --limit 1/s -j ACCEPT # Ping of death. # Защита от Ping of death. iptables -A INPUT -p icmp --icmp-type echo-request -m limit --limit 1/s -j ACCEPT # Deny NEW end INVALID incoming or required routings packets from ppp0 # Запрещаем NEW и INVALID входящие пакеты с ppp0. iptables -A INPUT -i $EXTIF -m state --state NEW,INVALID -j DROP # Allow a packets which is related to, and part of an existing connection. # Разрешаем пакеты принадлежащие и относящиеся к уже установленному соединению. iptables -N block iptables -A block -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -A block -m state --state NEW -i ! $EXTIF -j ACCEPT iptables -A block -j DROP iptables -A INPUT -j block