# IP-Filter rules for misys # :input ACCEPT :forward DENY :output ACCEPT :out-ill - :in-ill - :out-forw - :in-forw - :in-out - :out-in - :icmp-acc - :out-if - :out-ifm - :in-if - :in-ifm - # # Top Level Rules # * When forwarding, at first, do input filters, # and next, do forward filters. # All Input Monitor #-A input -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 -l # DHCP request, maybe -A input -s 0.0.0.0/255.255.255.255 -d 0.0.0.0/0.0.0.0 -i eth0 -j out-ifm -A input -s 0.0.0.0/255.255.255.255 -d 0.0.0.0/0.0.0.0 -i eth1 -j in-if # Illigal IP -A input -s 127.0.0.0/255.0.0.0 -d 0.0.0.0/0.0.0.0 -i eth0 -j out-ill -A input -s 192.168.0.0/255.255.0.0 -d 0.0.0.0/0.0.0.0 -i eth0 -j out-ill -A input -s 127.0.0.0/255.0.0.0 -d 0.0.0.0/0.0.0.0 -i ! lo -j in-ill -A input -s ! 192.168.0.0/255.255.0.0 -d 0.0.0.0/0.0.0.0 -i eth1 -j in-ill # Own Input Filter -A input -s 0.0.0.0/0.0.0.0 -d 172.x.x.100/255.255.255.255 -i eth0 -j out-if -A input -s 0.0.0.0/0.0.0.0 -d 172.x.x.100/255.255.255.255 -i eth1 -j out-if -A input -s x.x.x.29/255.255.255.255 -d 192.168.1.1/255.255.255.255 -i eth0 -j in-if -A input -s 172.x.x.91/255.255.255.255 -d 192.168.1.1/255.255.255.255 -i eth0 -j in-if -A input -s x.x.x.26/255.255.255.255 -d 192.168.1.1/255.255.255.255 -i eth0 -j in-if -A input -s 172.x.x.92/255.255.255.255 -d 192.168.1.1/255.255.255.255 -i eth0 -j in-if -A input -s x.x.x.41/255.255.255.255 -d 192.168.1.1/255.255.255.255 -i eth0 -j in-if -A input -s 0.0.0.0/0.0.0.0 -d 192.168.1.1/255.255.255.255 -i eth1 -j in-if # Monitoring -A input -s 192.168.0.0/255.255.0.0 -d 192.168.0.0/255.255.0.0 -i eth1 -j in-ifm -A input -s x.x.0.0/255.255.0.0 -d ! 192.168.0.0/255.255.0.0 -i eth0 -j out-ifm -A input -s 172.16.0.0/255.240.0.0 -d ! 192.168.0.0/255.255.0.0 -i eth0 -j out-ifm # All Forwarding Monitor #-A forward -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 -l # Permit Forwarding -A forward -s 192.168.0.0/255.255.0.0 -d x.x.0.0/255.255.0.0 -i eth0 -j in-out -A forward -s 192.168.0.0/255.255.0.0 -d 172.16.0.0/255.240.0.0 -i eth0 -j in-out -A forward -s x.x.0.0/255.255.0.0 -d 192.168.0.0/255.255.0.0 -i eth1 -j out-in -A forward -s 172.16.0.0/255.240.0.0 -d 192.168.0.0/255.255.0.0 -i eth1 -j out-in # Illigal Forwarding -A forward -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 -i eth0 -j out-forw -A forward -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 -i eth1 -j in-forw # default rule -A forward -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 -j DENY -l # # Deny and Logging # -A out-ill -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 -j DENY -A in-ill -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 -j DENY -l -A out-forw -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 -j DENY -l -A in-forw -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 -j DENY -l # # # Gateway rules # # ftp -A in-out -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 20:20 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 21:21 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d x.x.x.0/255.255.255.0 38624:38655 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d 172.x.x.0/255.255.255.0 38624:38655 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d x.x.x.0/255.255.255.0 34512:34559 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d 172.x.x.0/255.255.255.0 34512:34559 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d x.x.x.41/255.255.255.255 1024:65535 -p 6 -j MASQ # ssh -A in-out -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 22:22 -p 6 -j MASQ # telnet -A in-out -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 23:23 -p 6 -j MASQ # printer -A in-out -s 0.0.0.0/0.0.0.0 -d x.x.x.0/255.255.255.0 170:170 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d 172.x.x.0/255.255.255.0 170:170 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d x.x.x.0/255.255.255.0 515:515 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d 172.x.x.0/255.255.255.0 515:515 -p 6 -j MASQ # mail(send) -A in-out -s 0.0.0.0/0.0.0.0 -d x.x.x.0/255.255.255.0 25:25 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d 172.x.x.0/255.255.255.0 25:25 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d x.x.137.14/255.255.255.255 25:25 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d x.x.x.0/255.255.255.0 465:465 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d 172.x.x.0/255.255.255.0 465:465 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d x.x.137.14/255.255.255.255 465:465 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d x.x.x.0/255.255.255.0 587:587 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d 172.x.x.0/255.255.255.0 587:587 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d x.x.137.14/255.255.255.255 587:587 -p 6 -j MASQ # mail(recv) -A in-out -s 0.0.0.0/0.0.0.0 -d x.x.x.0/255.255.255.0 110:110 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d 172.x.x.0/255.255.255.0 110:110 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d x.x.137.2/255.255.255.255 110:110 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d x.x.x.0/255.255.255.0 995:995 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d 172.x.x.0/255.255.255.0 995:995 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d x.x.137.2/255.255.255.255 995:995 -p 6 -j MASQ # DNS -A in-out -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 53:53 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 53:53 -p 17 -j MASQ # proxy -A in-out -s 0.0.0.0/0.0.0.0 -d x.x.x.29/255.255.255.255 3128:3128 -p 6 -j REJECT -l -A in-out -s 0.0.0.0/0.0.0.0 -d 172.x.x.91/255.255.255.255 3128:3128 -p 6 -j REJECT -l -A in-out -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 3128:3128 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d x.x.x.29/255.255.255.255 8080:8080 -p 6 -j REJECT -l -A in-out -s 0.0.0.0/0.0.0.0 -d 172.x.x.91/255.255.255.255 8080:8080 -p 6 -j REJECT -l -A in-out -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 8080:8080 -p 6 -j MASQ # HTTP -A in-out -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 443:443 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 80:80 -p 6 -j MASQ # rsync -A in-out -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 873:873 -p 6 -j MASQ # Wnn -A in-out -s 0.0.0.0/0.0.0.0 -d x.x.x.0/255.255.255.0 22273:22273 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d 172.x.x.0/255.255.255.0 22273:22273 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d x.x.x.0/255.255.255.0 22289:22289 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d 172.x.x.0/255.255.255.0 22289:22289 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d x.x.x.0/255.255.255.0 22321:22321 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d 172.x.x.0/255.255.255.0 22321:22321 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d x.x.x.0/255.255.255.0 22305:22305 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d 172.x.x.0/255.255.255.0 22305:22305 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d x.x.x.0/255.255.255.0 26208:26208 -p 17 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d 172.x.x.0/255.255.255.0 26208:26208 -p 17 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d x.x.x.0/255.255.255.0 26208:26208 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d 172.x.x.0/255.255.255.0 26208:26208 -p 6 -j MASQ # ntp -A in-out -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 123:123 -p 17 -j MASQ # traceroute -A in-out -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 33434:33500 -p 17 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 8:8 -d 0.0.0.0/0.0.0.0 -p 1 -j MASQ -l -A in-out -s 0.0.0.0/0.0.0.0 0:0 -d 0.0.0.0/0.0.0.0 -p 1 -j MASQ -l # ICMP -A in-out -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 -p 1 -j icmp-acc # PGP keyserver -A in-out -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 11371:11371 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 11371:11371 -p 17 -j MASQ # cvs -A in-out -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 5999:5999 -p 6 -j MASQ # MS-Windows NETBIOS Samba-File-System -A in-out -s 0.0.0.0/0.0.0.0 1024:1152 -d 172.x.x.99/255.255.255.255 135:135 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 137:137 -d 172.x.x.99/255.255.255.255 137:137 -p 17 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 1024:4999 -d 172.x.x.99/255.255.255.255 139:139 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 1024:4999 -d 172.x.x.107/255.255.255.255 139:139 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 1024:1152 -d 172.x.x.108/255.255.255.255 135:135 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 137:137 -d 172.x.x.108/255.255.255.255 137:137 -p 17 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 1024:4999 -d 172.x.x.108/255.255.255.255 139:139 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 1024:4999 -d x.x.x.57/255.255.255.255 139:139 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 135:139 -p 17 -j REJECT -l # SNMP from MS-Windows to Printer. -A in-out -s 0.0.0.0/0.0.0.0 -d 172.x.x.109/255.255.255.255 161:161 -p 17 -j REJECT # Scanner-Driver from MS-Windows to Scanner. -A in-out -s 0.0.0.0/0.0.0.0 -d 172.x.x.110/255.255.255.255 110:110 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 -d 172.x.x.110/255.255.255.255 1865:1865 -p 6 -j MASQ # some MS-Windows port, but unknown detail... -A in-out -s 0.0.0.0/0.0.0.0 1024:4999 -d 172.x.x.107/255.255.255.255 445:445 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 1024:4999 -d 172.x.x.108/255.255.255.255 445:445 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 1024:4999 -d 172.x.x.108/255.255.255.255 8000:8000 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 1024:4999 -d 172.x.x.108/255.255.255.255 8500:8500 -p 6 -j MASQ -A in-out -s 0.0.0.0/0.0.0.0 1024:4999 -d x.x.x.57/255.255.255.255 445:445 -p 6 -j MASQ # Others, Reject. -A in-out -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 -j REJECT -l # # -A out-in -s x.x.x.29/255.255.255.255 -d 192.168.0.0/255.255.0.0 -j MASQ -A out-in -s 172.x.x.91/255.255.255.255 -d 192.168.0.0/255.255.0.0 -j MASQ -A out-in -s x.x.x.26/255.255.255.255 -d 192.168.0.0/255.255.0.0 -j MASQ -A out-in -s 172.x.x.92/255.255.255.255 -d 192.168.0.0/255.255.0.0 -j MASQ -A out-in -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 -j DENY -l # # -A icmp-acc -s 0.0.0.0/0.0.0.0 8:8 -d 0.0.0.0/0.0.0.0 -p 1 -j ACCEPT -l -A icmp-acc -s 0.0.0.0/0.0.0.0 0:0 -d 0.0.0.0/0.0.0.0 -p 1 -j ACCEPT -l -A icmp-acc -s 0.0.0.0/0.0.0.0 3:3 -d 0.0.0.0/0.0.0.0 -p 1 -j ACCEPT -l -A icmp-acc -s 0.0.0.0/0.0.0.0 4:4 -d 0.0.0.0/0.0.0.0 -p 1 -j ACCEPT -l -A icmp-acc -s 0.0.0.0/0.0.0.0 11:11 -d 0.0.0.0/0.0.0.0 -p 1 -j ACCEPT -l -A icmp-acc -s 0.0.0.0/0.0.0.0 12:12 -d 0.0.0.0/0.0.0.0 -p 1 -j ACCEPT -l # # # Connection to misys # # NAT -A out-if -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 61000:65095 -p 6 -j ACCEPT -A out-if -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 61000:65095 -p 17 -j ACCEPT # ICMP -A out-if -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 -p 1 -j icmp-acc # etc... -A out-if -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 22:22 -p 6 -j ACCEPT -A out-if -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 20:20 -p 6 -j ACCEPT -A out-if -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 21:21 -p 6 -j ACCEPT -A out-if -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 22:22 -p 6 -j ACCEPT -A out-if -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 23:23 -p 6 -j ACCEPT -A out-if -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 170:170 -p 6 -j ACCEPT -A out-if -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 515:515 -p 6 -j ACCEPT -A out-if -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 53:53 -p 6 -j ACCEPT -A out-if -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 53:53 -p 17 -j ACCEPT -A out-if -s x.x.x.29/255.255.255.255 53:53 -d 0.0.0.0/0.0.0.0 -p 17 -j ACCEPT -A out-if -s 172.x.x.91/255.255.255.255 53:53 -d 0.0.0.0/0.0.0.0 -p 17 -j ACCEPT -A out-if -s x.x.x.29/255.255.255.255 22:22 -d 0.0.0.0/0.0.0.0 -p 6 -j ACCEPT -A out-if -s 172.x.x.91/255.255.255.255 22:22 -d 0.0.0.0/0.0.0.0 -p 6 -j ACCEPT -A out-if -s x.x.x.26/255.255.255.255 22:22 -d 0.0.0.0/0.0.0.0 -p 6 -j ACCEPT -A out-if -s 172.x.x.92/255.255.255.255 22:22 -d 0.0.0.0/0.0.0.0 -p 6 -j ACCEPT -A out-if -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 3128:3128 -p 6 -j ACCEPT -A out-if -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 8080:8080 -p 6 -j ACCEPT -A out-if -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 443:443 -p 6 -j ACCEPT -A out-if -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 80:80 -p 6 -j ACCEPT -A out-if -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 873:873 -p 6 -j ACCEPT -A out-if -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 123:123 -p 17 -j ACCEPT # others... -A out-if -s 172.x.x.100/255.255.255.255 -d 172.x.x.100/255.255.255.255 -j ACCEPT -A out-if -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 -j DENY -l # # # NAT -A in-if -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 61000:65095 -p 6 -j ACCEPT -A in-if -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 61000:65095 -p 17 -j ACCEPT # ICMP -A in-if -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 -p 1 -j icmp-acc # ssh -A in-if -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 22:22 -p 6 -j ACCEPT -A in-if -s 0.0.0.0/0.0.0.0 22:22 -d 0.0.0.0/0.0.0.0 -p 6 -j ACCEPT # tftp #-A in-if -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 69:69 -p 17 -j ACCEPT # DHCP -A in-if -s 0.0.0.0/0.0.0.0 68:68 -d 0.0.0.0/0.0.0.0 67:67 -p 17 -j ACCEPT # others... -A in-if -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 -j DENY -l # # # Packet Monitoring # -A out-ifm -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 -j DENY # -A in-ifm -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 20:23 -p 6 -j DENY -A in-ifm -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 137:138 -p 17 -j DENY -A in-ifm -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 139:139 -p 6 -j DENY -A in-ifm -s 0.0.0.0/0.0.0.0 -d 0.0.0.0/0.0.0.0 -j DENY -l #