From owner-freebsd-questions Fri Dec 28 14:13:21 2001 Delivered-To: freebsd-questions@freebsd.org Received: from mail.mango-bay.com (mail.mango-bay.com [208.206.15.12]) by hub.freebsd.org (Postfix) with ESMTP id 940F437B41A for ; Fri, 28 Dec 2001 14:13:11 -0800 (PST) Received: from barbish ([63.70.155.113]) by mail.mango-bay.com (Post.Office MTA v3.5.3 release 223 ID# 0-52377U2500L250S0V35) with SMTP id com; Fri, 28 Dec 2001 17:15:26 -0500 From: "Joe & Fhe Barbish" To: "Jonathan Chen" Cc: "FBSD Questions" Subject: RE: avoid ping Date: Fri, 28 Dec 2001 17:13:06 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <20011229100814.A24652@grimoire.chen.org.nz> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Importance: Normal Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Thanks for the fast reply. Your answer helped me add rules to stop ping echo attacks. I built my rules set from the rc.firewall simple default. I still working on adding the following functions yet. Allow pings on internal net and out to internet. Allow telenet access from tun1, local net, and from outside internet. Allow ftp access from tun1, local net, and from outside internet. Would you please critique my rules file below for completeness that in general that all the common attack doors are closed? Thanks for your expert help. Joe ############ # # Define IPFW firewall rules for gateway.a1poweruser.com # # user ppp tun0 dial out to ISP with dynamic IP addresses assigned # user ppp tun1 dial in to this box with dynamic IP addresses assigned # User ppp nat not used. natd used. Private Ip address used inside # 3 winx boxes on LAN with static IP address hard coded. # protect the whole private network from loss of service attacks # ############ # Set rules command prefix # fwcmd="/sbin/ipfw" # Flush out the list before we begin. # ${fwcmd} -f flush # Set defaults # set these to your outside interface network and netmask and ip # for dynamic IP address from ISP use there range oif="tun0" onet="62.70.155.1/24" # dynamic IP address range issued by ISP omask="62.70.155.0" # mask 62.70.155.0 thru 62.70.155.255 oip="62.70.155.1/24" odns="208.206.15.11" # ISP's dns IP address # set these to your inside interface network and netmask and ip iif="xl0" # Nic card inet="10.0.10.1" # IP address of Nic card imask="10.0.10.0" # mask 10.0.10.0 thru 10.0.10.255 iip="10.0.10.1" # Don't know what these are doing ${fwcmd} add pass all from any to any via lo0 ${fwcmd} add deny all from any to 127.0.0.0/8 ${fwcmd} add deny ip from 127.0.0.0/8 to any # Stop spoofing ${fwcmd} add deny all from ${inet}:${imask} to any in via ${oif} ${fwcmd} add deny all from ${onet}:${omask} to any in via ${iif} # Stop ping echo attacks # deny echo reply (ICMP type 0), and echo request (type 8). ${fwcmd} add deny icmp from any to ${onet}:${omask} icmptype 0 in via ${oif} ${fwcmd} add deny icmp from any to ${onet}:${omask} icmptype 8 in via ${oif} # Stop RFC1918 nets on the outside interface ${fwcmd} add deny all from any to 10.0.0.0/8 via ${oif} ${fwcmd} add deny all from any to 172.16.0.0/12 via ${oif} ${fwcmd} add deny all from any to 192.168.0.0/16 via ${oif} # Stop draft-manning-dsua-03.txt (1 May 2000) nets (includes RESERVED-1, # DHCP auto-configuration, NET-TEST, MULTICAST (class D), and class E) # on the outside interface ${fwcmd} add deny all from any to 0.0.0.0/8 via ${oif} ${fwcmd} add deny all from any to 169.254.0.0/16 via ${oif} ${fwcmd} add deny all from any to 192.0.2.0/24 via ${oif} ${fwcmd} add deny all from any to 224.0.0.0/4 via ${oif} ${fwcmd} add deny all from any to 240.0.0.0/4 via ${oif} # Network Address Translation. This rule is placed here deliberately. # All rules above check traffic from public internet before nat does it # thing. # All the rules following the nat check the private net. ${fwcmd} add divert natd all from any to any via ${oif} # Stop RFC1918 nets on the outside interface ${fwcmd} add deny all from 10.0.0.0/8 to any via ${oif} ${fwcmd} add deny all from 172.16.0.0/12 to any via ${oif} ${fwcmd} add deny all from 192.168.0.0/16 to any via ${oif} # Stop draft-manning-dsua-03.txt (1 May 2000) nets (includes RESERVED-1, # DHCP auto-configuration, NET-TEST, MULTICAST (class D), and class E) # on the outside interface ${fwcmd} add deny all from 0.0.0.0/8 to any via ${oif} ${fwcmd} add deny all from 169.254.0.0/16 to any via ${oif} ${fwcmd} add deny all from 192.0.2.0/24 to any via ${oif} ${fwcmd} add deny all from 224.0.0.0/4 to any via ${oif} ${fwcmd} add deny all from 240.0.0.0/4 to any via ${oif} # Allow TCP through if setup succeeded ${fwcmd} add pass tcp from any to any established # Allow IP fragments to pass through ${fwcmd} add pass all from any to any frag # Allow setup of incoming email ${fwcmd} add pass tcp from any to ${oip} 25 setup # Allow access to our DNS ${fwcmd} add pass tcp from any to ${odns} 53 setup ${fwcmd} add pass udp from any to ${odns} 53 ${fwcmd} add pass udp from ${odns} 53 to any # Allow access to our WWW ${fwcmd} add pass tcp from any to ${oip} 80 setup # Reject&Log all setup of incoming connections from the outside ${fwcmd} add deny log tcp from any to any in via ${oif} setup # Allow setup of any other TCP connection ${fwcmd} add pass tcp from any to any setup # Allow DNS queries out in the world ${fwcmd} add pass udp from ${oip} to any 53 keep-state # Allow NTP queries out in the world ${fwcmd} add pass udp from ${oip} to any 123 keep-state # Everything else is denied by default -----Original Message----- From: Jonathan Chen [mailto:jonc@chen.org.nz] Sent: Friday, December 28, 2001 4:08 PM To: Joe & Fhe Barbish Cc: FBSD Questions Subject: Re: avoid ping On Fri, Dec 28, 2001 at 01:10:21PM -0500, Joe & Fhe Barbish wrote: > You responded > ipfw add 400 deny icmp from any to ${you} icmptype 8 > Where ${you} is the public IP address of your machine, or network > address of your subnet. > > I respond. > ${you} is the static IP address issued by your ISP. How do I get > this value if my ISP does dynamic IP assignments? You could write it like this: ipfw add 400 deny icmp from any to me icmptype 8 via ${IF} where ${IF} is the interface involved (eg: xl0, fxp0, etc). Cheers. -- Jonathan Chen ---------------------------------------------------------------------- If you're right 90% of the time, why quibble about the remaining 3%? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message