Thus spake [EMAIL PROTECTED] ([EMAIL PROTECTED]) [16/10/03 11:47]:
> Just use 'flags S keep state' on both rules. You might want to consider
> restricting tha flows to and from your box, rather than any.
> 
> pass in quick on dc0 proto tcp from any to [your_box_ip] port = 22 flags S keep state
> 
> pass out quick on dc0 proto tcp from [your_box_ip] to any port = 22 flags S keep 
> state

Don't forget 'keep frags' as well:

  pass in quick on dc0 proto tcp from any to [your_box_ip] port = 22 flags S keep 
state keep frags
  pass out quick on dc0 proto tcp from [your_box_ip] to any port = 22 flags S keep 
state keep frags

But I don't think this answers the original posters question:

Thus spake Adam Bozanich:
> > > Hi all.  I would like to allow ssh in and out of my
> > > box, without using state rules.

In the two rules above, we're using 'keep state'.  Adam has explicitly
stated that he doesn't want to use state rules.

> > > Here's what I've got:
> > > ...
> > > pass in quick on dc0 proto tcp from any to any port = 22
> > > ...
> > > pass out quick on dc0 proto tcp from any to any port = 22
> > > ...
> > > block in log on dc0
> > > block out log on dc0
> > > ...

And that's Adams problem.  You're allowing inbound port 22 connects, and
outbound port 22 connects.  You really should allow inbound port 22
connects, and outbound connects /from/ port 22.

But this is really a bad idea.  I'd use keep-state, unless you have a *very*
good reason not to.  However, I'll assume you know what you're doing, and
/do/ have a *very* good reason to not use keep-state.  So...

Here's the lazy answer:

   pass in quick on dc0 proto tcp from any to [your_box_ip] port = 22
   pass out quick on dc0 proto tcp from [your_box_ip] port = 22 to any

That allows remote connects in to your box.

> > > When I try to ssh out from the box (FreeBSD 5-1) I get
> > > The replies from outside server blocked
> > > (flags=SA,catches on "block in log on dc0")

And this is a whole other question.  You /then/ need to add these two rules:

   pass in quick on dc0 proto tcp from [your_box_ip] port = 22 to any
   pass out quick on dc0 proto tcp from any to [your_box_ip] port = 22
    
But why you would use these four rules, instead of two keep-state rules, is
beyond me.

Reply via email to