[轉帖]一個 ipchains 的設定範例 ......

Home Home
引用 | 編輯 pigpig5442
2005-03-23 01:50
樓主
推文 x0
# Firewall configuration written by lokkit
# Manual customization of this file is not recommended.
# Note: ifup-post will punch the current nameservers through the
# firewall; such entries will *not* be listed here.

:input ACCEPT
:forward ACCEPT
:output ACCEPT

# SMTP
-A input -p tcp -s 0/0 -d 0/0 25 -y -j ACCEPT
-A input -p udp -s 0/0 -d 0/0 25 -j ACCEPT

# POP3
-A input -p tcp -s 0/0 -d 0/0 110 -y -j ACCEPT
-A input -p udp -s 0/0 -d 0/0 110 -j ACCEPT

# FTP
-A input -p tcp -s 0/0 -d 0/0 12345 -y -j ACCEPT
-A input -p udp -s 0/0 -d 0/0 12345 -j ACCEPT

# SSH
-A input -p tcp -s 0/0 -d 0/0 22 -y -j ACCEPT
-A input -p udp -s 0/0 -d 0/0 22 -j ACCEPT

# Telnet
-A input -p tcp -s 0/0 -d 0/0 23 -y -j ACCEPT
-A input -p udp -s 0/0 -d 0/0 23 -j ACCEPT

# DNS
-A input -p tcp -s 0/0 -d 0/0 53 -y -j ACCEPT
-A input -p udp -s 0/0 -d 0/0 53 -j ACCEPT

# WWW
-A input -p tcp -s 0/0 -d 0/0 80 -y -j ACCEPT
-A input -p udp -s 0/0 -d 0/0 80 -j ACCEPT
-A input -p tcp -s 0/0 -d 0/0 6085 -y -j ACCEPT
-A input -p udp -s 0/0 -d 0/0 6085 -j ACCEPT
-A input -p tcp -s 0/0 -d 0/0 6086 -y -j ACCEPT
-A input -p udp -s 0/0 -d 0/0 6086 -j ACCEPT

# Samba
-A input -p tcp -s 0/0 -d 0/0 137 -y -j ACCEPT
-A input -p udp -s 0/0 -d 0/0 137 -j ACCEPT
-A input -p tcp -s 0/0 -d 0/0 138 -y -j ACCEPT
-A input -p udp -s 0/0 -d 0/0 138 -j ACCEPT
-A input -p tcp -s 0/0 -d 0/0 139 -y -j ACCEPT
-A input -p udp -s 0/0 -d 0/0 139 -j ACCEPT

# SNP
-A input -p tcp -s 0/0 -d 0/0 970 -y -j ACCEPT
-A input -p tcp -s 0/0 -d 0/0 971 -y -j ACCEPT
-A input -p tcp -s 0/0 -d 0/0 972 -y -j ACCEPT
-A input -p tcp -s 0/0 -d 0/0 973 -y -j ACCEPT
-A input -p tcp -s 0/0 -d 0/0 976 -y -j ACCEPT
-A input -p tcp -s 0/0 -d 0/0 977 -y -j ACCEPT

# Default Input
-A input -s 0/0 -d 0/0 -I lo -j ACCEPT
-A input -p tcp -s 0/0 -d 0/0 0:1023 -y -j REJECT
-A input -p tcp -s 0/0 -d 0/0 2049 -y -j REJECT
-A input -p udp -s 0/0 -d 0/0 0:1023 -j REJECT
-A input -p udp -s 0/0 -d 0/0 2049 -j REJECT
-A input -p tcp -s 0/0 -d 0/0 6000:6009 -y -j REJECT
-A input -p tcp -s 0/0 -d 0/0 7100 -y -j REJECT

# Default Input
#-A input -s 0/0 -d 0/0 -I lo -j ACCEPT
-A input -p udp -s 140.110.4.1 53 -d 0/0 -j ACCEPT
-A input -p udp -s 140.110.16.1 53 -d 0/0 -j ACCEPT
-A input -p udp -s 140.110.60.1 53 -d 0/0 -j ACCEPT
-A input -p udp -s 168.95.192.1 53 -d 0/0 -j ACCEPT
#-A input -p tcp -s 0/0 -d 0/0 -y -j REJECT
-A input -p udp -s 0/0 -d 0/0 -j REJECT

# BackDoor
-A input -p udp -s 0/0 -d 0/0 57000 -j REJECT
-A output -p udp -s 0/0 57000 -d 0/0 -j REJECT
-A input -p udp -s 0/0 -d 0/0 57036 -j REJECT
-A output -p udp -s 0/0 57036 -d 0/0 -j REJECT
-A input -p udp -s 0/0 -d 0/0 58126 -j REJECT
-A output -p udp -s 0/0 58126 -d 0/0 -j REJECT

# Default Output

獻花 x0