Re: IPFW Rule set question...

2004-01-26 Thread Drew Robertson
Thanks for your reply.

I don't understand what you mean when you say NAT modifications... meaning 
how the packets are changed on the gateway to allow them to be seen as 
transparent from behind??

When I do a netstat -an while connected remotley it shows the connection on 
SSH as coming from 203.10.10.38, but when I add a rule to allow everything 
from that net it still won't allow access...

I did add the rule before the divert, but i still couldn't connect until i 
added an allow all manually...

i also tried opening up the ssh port to everyone, with allow tcp from any to 
me 22 via tl0, but that wouldn't allow a connection either...

It's a bit confusing...

Thanks again,

D


From: Lowell Gilbert <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: "Drew Robertson" <[EMAIL PROTECTED]>
CC: [EMAIL PROTECTED]
Subject: Re: IPFW Rule set question...
Date: 24 Dec 2003 16:43:49 -0500
"Drew Robertson" <[EMAIL PROTECTED]> writes:

> I have enabled SSH, TELNET and FTP on my freeBSD 4.8 box at home... it
> is dual homed, 2 NICs one for the internal LAN one running my cable
> modem.  Everything works fine on the internal side.
>
> When accessing the box using any of those apps from work, the system
> looks to briefly connect and then returns a "Connection Lost" or
> "Connection closed by remote host error".
>
> The command setup to allow in access is as follows...
>
> 820 allow log tcp from any to me 22 limit src-addr 4 in recv tl0 setup
> 830 allow log tcp from any to me 23 limit src-addr 4 in recv tl0 setup
I assume these are supposed to have "keep-state" in them.
It *is* written that way in the full ruleset you posted lower down.
> when this didn't work I added another command at the start of the
> ruleset to just let everything in from a particular IP address range...
>
> 202 allow ip from 203.10.10.0/24 to any
>
> however this produced the same error...
>
> It wasn't until I allowed all from any to any that I was able to 
connect...

Then the packets aren't actually being seen as coming from that
address.  Maybe you're running into NAT modifications?
> When checking out the security log, it tells me that rule 820 is
> allowing access to my computer at home...
But only for SYN packets...

--
Lowell Gilbert, embedded/networking software engineer, Boston area:
resume/CV at http://be-well.ilk.org:8088/~lowell/resume/
username/password "public"
_
Hot chart ringtones and polyphonics. Go to  
http://ninemsn.com.au/mobilemania/default.asp

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: IPFW Rule set question...

2003-12-24 Thread Rob
Just a very quick suggestion - when you get an initial connection that
closes almost immediately, it is usually TCP wrappers rather than a
firewall. Have you checked /etc/hosts.allow?

- Original Message -
From: "Drew Robertson" <[EMAIL PROTECTED]>
Subject: IPFW Rule set question...


>
> Hi everyone,
>
> Thanks to those who take the time to read and reply to these emails.
>
> I have a strange issue regarding my firewall (IPFW)...
>
> I have enabled SSH, TELNET and FTP on my freeBSD 4.8 box at home... it
is
> dual homed, 2 NICs one for the internal LAN one running my cable
modem.
> Everything works fine on the internal side.
>
> When accessing the box using any of those apps from work, the system
looks
> to briefly connect and then returns a "Connection Lost" or "Connection
> closed by remote host error".
>
> The command setup to allow in access is as follows...
>
> 820 allow log tcp from any to me 22 limit src-addr 4 in recv tl0 setup
> 830 allow log tcp from any to me 23 limit src-addr 4 in recv tl0 setup
>
> when this didn't work I added another command at the start of the
ruleset to
> just let everything in from a particular IP address range...
>
> 202 allow ip from 203.10.10.0/24 to any
>
> however this produced the same error...
>
> It wasn't until I allowed all from any to any that I was able to
connect...
>
> When checking out the security log, it tells me that rule 820 is
allowing
> access to my computer at home...
>
>
> Ruleset is attached completely below
>
> /sbin/ipfw -q -f flush
>
> # Set rules command prefix
> # The -q option on the command is for quite mode.
> # Do not display rules as they load. Remove during development to see.
> cmd="/sbin/ipfw -q add"
>
> # Set defaults
> oif="tl0"# Nic card to cable modem public internet
> connection
> odns1="203.2.75.132"  # ISP's dns server IP address
>
> $cmd 00200 divert natd all from any to any via $oif
>
>
>   control section

> # Start of IPFW advanced Stateful Filtering using "dynamic" rules.
> # The check-state statement behavior is to match bi-directional packet
> traffic
> # flow between source and destination using protocol/IP/port/sequence
> number.
> # The dynamic rule has a limited lifetime which is controlled by a set
of
> # sysctl(8) variables. The lifetime is refreshed every time a matching
> # packet is found in the dynamic table.
>
> # Allow the packet through if it has previous been added to the
> # the "dynamic" rules table by an allow keep-state statement.
>
> $cmd 00202 allow log all from 203.10.10.0/24 to any
> $cmd 00203 allow log all from any to any via tun0
>
> $cmd 00400 check-state
>
>
> # SAMBA File/Printer Sharing on Internal LAN
> $cmd 0410 allow log tcp from 192.168.1.0/24 to 192.168.1.0/24
> $cmd 0411 allow log udp from 192.168.1.0/24 to 192.168.1.0/24
>
> # Run all private LAN xl0 packet traffic through the dynamic rules
> # table so the IP address are in sync with Natd.
> $cmd 00500 allow log all from any to any via sis0 keep-state
>
> # Deny all fragments as bogus packets
> $cmd 00530 deny log all from any to any frag in via $oif
>
> # Deny  ACK packets that did not match the dynamic rule table
> $cmd 00540 deny log tcp from any to any established in via $oif
>
>   outbound section

> # Interrogate packets originating from behind the firewall, private
net.
> # Upon a rule match, it's keep-state option will create a dynamic
rule.
>
> # Allow out non-secure standard http function
> $cmd 00600 allow log tcp  from any to any 80  out via $oif setup
keep-state
>
> # Allow out secure www function https over TLS SSL
> $cmd 00601 allow log tcp  from any to any 443 out via $oif setup
keep-state
>
> # Allow out access to my ISP's Domain name server.
> $cmd 00610 allow log tcp  from any to $odns1 53 out via $oif setup
> keep-state
> $cmd 00611 allow log udp  from any to $odns1 53 out via $oif
keep-state
>
> # Allow out send & get email function
> $cmd 00630 allow log tcp from any to any 25,110 out via $oif setup
> keep-state
>
> # Allow out & in FBSD (make install & CVSUP)  functions
> # Basically give user id [ROOT]  "GOD"  privileges.
> $cmd 00640 allow log tcp from me to any out via $oif setup keep-state
uid
> root
>
>   inbound section

> # Interrogate packets originating from in front of the firewall,
public net.
>
> # Allow in www http access to my apache server
> #$cmd 008

Re: IPFW Rule set question...

2003-12-24 Thread Lowell Gilbert
"Drew Robertson" <[EMAIL PROTECTED]> writes:

> I have enabled SSH, TELNET and FTP on my freeBSD 4.8 box at home... it
> is dual homed, 2 NICs one for the internal LAN one running my cable
> modem.  Everything works fine on the internal side.
> 
> When accessing the box using any of those apps from work, the system
> looks to briefly connect and then returns a "Connection Lost" or
> "Connection closed by remote host error".
> 
> The command setup to allow in access is as follows...
> 
> 820 allow log tcp from any to me 22 limit src-addr 4 in recv tl0 setup
> 830 allow log tcp from any to me 23 limit src-addr 4 in recv tl0 setup

I assume these are supposed to have "keep-state" in them.
It *is* written that way in the full ruleset you posted lower down.

> when this didn't work I added another command at the start of the
> ruleset to just let everything in from a particular IP address range...
> 
> 202 allow ip from 203.10.10.0/24 to any
> 
> however this produced the same error...
> 
> It wasn't until I allowed all from any to any that I was able to connect...

Then the packets aren't actually being seen as coming from that
address.  Maybe you're running into NAT modifications?

> When checking out the security log, it tells me that rule 820 is
> allowing access to my computer at home...

But only for SYN packets...


-- 
Lowell Gilbert, embedded/networking software engineer, Boston area: 
resume/CV at http://be-well.ilk.org:8088/~lowell/resume/
username/password "public"
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


IPFW Rule set question...

2003-12-23 Thread Drew Robertson
Hi everyone,

Thanks to those who take the time to read and reply to these emails.

I have a strange issue regarding my firewall (IPFW)...

I have enabled SSH, TELNET and FTP on my freeBSD 4.8 box at home... it is 
dual homed, 2 NICs one for the internal LAN one running my cable modem.  
Everything works fine on the internal side.

When accessing the box using any of those apps from work, the system looks 
to briefly connect and then returns a "Connection Lost" or "Connection 
closed by remote host error".

The command setup to allow in access is as follows...

820 allow log tcp from any to me 22 limit src-addr 4 in recv tl0 setup
830 allow log tcp from any to me 23 limit src-addr 4 in recv tl0 setup
when this didn't work I added another command at the start of the ruleset to 
just let everything in from a particular IP address range...

202 allow ip from 203.10.10.0/24 to any

however this produced the same error...

It wasn't until I allowed all from any to any that I was able to connect...

When checking out the security log, it tells me that rule 820 is allowing 
access to my computer at home...

Ruleset is attached completely below

/sbin/ipfw -q -f flush

# Set rules command prefix
# The -q option on the command is for quite mode.
# Do not display rules as they load. Remove during development to see.
cmd="/sbin/ipfw -q add"
# Set defaults
oif="tl0"# Nic card to cable modem public internet 
connection
odns1="203.2.75.132"  # ISP's dns server IP address

$cmd 00200 divert natd all from any to any via $oif

  control section  
# Start of IPFW advanced Stateful Filtering using "dynamic" rules.
# The check-state statement behavior is to match bi-directional packet 
traffic
# flow between source and destination using protocol/IP/port/sequence 
number.
# The dynamic rule has a limited lifetime which is controlled by a set of
# sysctl(8) variables. The lifetime is refreshed every time a matching
# packet is found in the dynamic table.

# Allow the packet through if it has previous been added to the
# the "dynamic" rules table by an allow keep-state statement.
$cmd 00202 allow log all from 203.10.10.0/24 to any
$cmd 00203 allow log all from any to any via tun0
$cmd 00400 check-state

# SAMBA File/Printer Sharing on Internal LAN
$cmd 0410 allow log tcp from 192.168.1.0/24 to 192.168.1.0/24
$cmd 0411 allow log udp from 192.168.1.0/24 to 192.168.1.0/24
# Run all private LAN xl0 packet traffic through the dynamic rules
# table so the IP address are in sync with Natd.
$cmd 00500 allow log all from any to any via sis0 keep-state
# Deny all fragments as bogus packets
$cmd 00530 deny log all from any to any frag in via $oif
# Deny  ACK packets that did not match the dynamic rule table
$cmd 00540 deny log tcp from any to any established in via $oif
  outbound section  
# Interrogate packets originating from behind the firewall, private net.
# Upon a rule match, it's keep-state option will create a dynamic rule.
# Allow out non-secure standard http function
$cmd 00600 allow log tcp  from any to any 80  out via $oif setup keep-state
# Allow out secure www function https over TLS SSL
$cmd 00601 allow log tcp  from any to any 443 out via $oif setup keep-state
# Allow out access to my ISP's Domain name server.
$cmd 00610 allow log tcp  from any to $odns1 53 out via $oif setup 
keep-state
$cmd 00611 allow log udp  from any to $odns1 53 out via $oif keep-state

# Allow out send & get email function
$cmd 00630 allow log tcp from any to any 25,110 out via $oif setup 
keep-state

# Allow out & in FBSD (make install & CVSUP)  functions
# Basically give user id [ROOT]  "GOD"  privileges.
$cmd 00640 allow log tcp from me to any out via $oif setup keep-state uid 
root

  inbound section  
# Interrogate packets originating from in front of the firewall, public net.
# Allow in www http access to my apache server
#$cmd 00800 allow log tcp from any to any 80 in via $oif setup keep-state 
limit src-addr 4

# Allow  TCP FTP control channel in & data channel out
$cmd 00810 allow log tcp from any to me 21  in via $oif setup keep-state 
limit src-addr 4
$cmd 00811 allow log tcp from any 20 to any 1024-49151 out via $oif setup 
keep limit src-addr 4

# Allow in ssh function
$cmd 00820 allow log tcp from any to me 22 in via $oif setup keep-state 
limit src-addr 4

# Allow in Telnet
$cmd 00830 allow log tcp from any to me 23 in via $oif setup keep-state 
limit src-addr 4

Thanks.

D

_
ninemsn Premium transforms your e-mail with colours, photos and animated 
text. Click here  http://ninemsn.com.au/premium/landing.asp

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED