Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 02 Aug 2000 14:56:08 -0500
From:      Jeff <jeff@kreska.org>
To:        freebsd-questions@freebsd.org
Subject:   ipfw and enabling ftp from outside??
Message-ID:  <39887CD8.DA87F900@kreska.org>

next in thread | raw e-mail | index | archive | help
I have a dual homed configuration with one interface 24.x.x.x.(outside
validIp)  and the other 192.168.0.1 (Inside)

When I ftp using netscape/ie from an inside machine all works fine.  If
I try and ftp from an outside machine it fails.  In the status window I
see contacted blah....:49152 but no response.

I am sure that something is configured wrong with my ifpw rules, but I
am not sure what.  I tryed the rc.firewall entry's listed on FreeBSD
cheats with no success.

here is what I have for ipfw (rc.firewall):
    # set these to your outside interface network and netmask and ip
    oif="ed0"
    onet="24.x.x..0"
    omask="255.255.255.128"
    oip="24.x.x.x"

    # set these to your inside interface network and netmask and ip
    iif="vr0"
    inet="192.168.0.0"
    imask="255.255.255.0"
    iip="192.168.0.1"

    # My ISP's DNS servers
     dns1="24.x.x.x"
     dns2="24.x.x.x"

             # Stop spoofing
             ${fwcmd} add deny log all from ${inet}:${imask} to any in
via ${oif}
             ${fwcmd} add deny log all from ${onet}:${omask} to any in
via ${iif}

             # 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 any to 10.0.0.0/8 via ${oif}
             ${fwcmd} add deny all from 172.16.0.0/12 to any via ${oif}
             ${fwcmd} add deny all from any to 172.16.0.0/12 via ${oif}
             ${fwcmd} add deny all from 192.168.0.0/16 to any via ${oif}

             ${fwcmd} add deny all from any to 192.168.0.0/16 out via
${oif}

             # Stop draft-manning-dsua-01.txt nets on the outside
interface
             ${fwcmd} add deny log all from 0.0.0.0/8 to any via ${oif}
             ${fwcmd} add deny log all from any to 0.0.0.0/8 via ${oif}
             ${fwcmd} add deny log all from 169.254.0.0/16 to any via
${oif}
             ${fwcmd} add deny log all from any to 169.254.0.0/16 via
${oif}
             ${fwcmd} add deny log all from 192.0.2.0/24 to any via
${oif}
             ${fwcmd} add deny log all from any to 192.0.2.0/24 via
${oif}
             ${fwcmd} add deny log all from 224.0.0.0/4 to any via
${oif}
             ${fwcmd} add deny log all from any to 224.0.0.0/4 via
${oif}
             ${fwcmd} add deny log all from 240.0.0.0/4 to any via
${oif}
             ${fwcmd} add deny log all from any to 240.0.0.0/4 via
${oif}

             # Allow established connections
             ${fwcmd} add pass tcp from any to any established

             # Allow IP fragments to pass through
             ${fwcmd} add pass all from any to any frag


             ### TCP SETUP RULES

             # HTTP - Allow access to our web server
             ${fwcmd} add pass tcp from any to any 80 setup

             # SMTP - Allow access to sendmail for incoming e-mail
             ${fwcmd} add pass tcp from any to any 25 setup

             # FTP - Allow incoming data channel for outgoing
connections,
             # Reject&Log all incoming control connections
             ${fwcmd} add pass tcp from any 20 to any 1024-65535 setup
#             ${fwcmd} add deny log tcp from any to any 21 in via ${oif}
setup
             ${fwcmd} add pass log tcp from any to any 21 in via ${oif}
setup

             # SSH Login - Allow & Log all incoming
             ${fwcmd} add pass log tcp from any to any 22 in via ${oif}
setup

             # IDENT - Reset incoming connections
             ${fwcmd} add reset tcp from any to any 113 in via ${oif}
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


             ### UDP RULES

             # DNS - Allow queries out in the world
#             ${fwcmd} add pass udp from any to ${dns1} 53
#             ${fwcmd} add pass udp from any to ${dns2} 53
#             ${fwcmd} add pass udp from ${dns1} 53 to any
#             ${fwcmd} add pass udp from ${dns2} 53 to any
             ${fwcmd} add pass udp from any to any 53
             ${fwcmd} add pass udp from any 53 to any

             # SMB - Allow local traffic
             ${fwcmd} add pass udp from any to any 137-139 via ${iif}

             # NTP - Allow server-to-server on outside interface,
client-to-server
             # on inside interface
             ${fwcmd} add pass udp from any 123 to any 123 via ${oif}
             ${fwcmd} add pass udp from any 123 to any via ${iif}
             ${fwcmd} add pass udp from any to any 123 via ${iif}

             # TRACEROUTE - Allow outgoing, but not incoming
             ${fwcmd} add pass udp from any to any 33434-33523 out via
${oif}


             ### ICMP RULES

             # ICMP packets
             # Allow all ICMP packets on internal interface
             ${fwcmd} add pass icmp from any to any via ${iif}

            # ICMP - Allow ping, et. al., for testing
            ${fwcmd} add pass icmp from any to any

             # Allow outgoing pings, but not incoming
             ${fwcmd} add pass icmp from any to any icmptypes 8 out via
${oif}
             ${fwcmd} add pass icmp from any to any icmptypes 0 in via
${oif}

             # Allow Destination Unreachable, Source Quench, Time
Exceeded, and Bad Header
             ${fwcmd} add pass icmp from any to any icmptypes 3,4,11,12
via ${oif}

             # Deny the rest of them
             ${fwcmd} add deny icmp from any to any


             ### MISCELLANEOUS REJECT RULES

             # Reject broadcasts from outside interface
             ${fwcmd} add 63000 deny ip from any to 0.0.0.255:0.0.0.255
in via ${oif}

             # Reject&Log SMB connections on outside interface
             ${fwcmd} add 64000 deny log udp from any to any 137-139 via
${oif}

             # Reject&Log all other connections from outside interface
             ${fwcmd} add 65000 deny log ip from any to any via ${oif}



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?39887CD8.DA87F900>