Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "Rob Sterenborg" <rob@sterenborg.info>
To: netfilter@lists.netfilter.org
Subject: RE: not able to ssh from the firewall
Date: Fri, 8 Sep 2006 07:29:21 +0200	[thread overview]
Message-ID: <001101c6d307$bcf914b0$0101000a@tanjian> (raw)
In-Reply-To: <1157682136.4889.4.camel@nirvana.aurokruti.in>

> OK, I had set :
> 
> -A OUTPUT -j DROP
> 
> So nothing worked.
> 
> If OUTPUT is set to :
> 
> -A OUTPUT -j ACCEPT
> 
> Then everthing works. I can ssh, ping to clients .
> 
> So how do I get it working with OUTPUT as DROP ?

I take it you have:
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
as your first INPUT rule to take care of returning packets.

An SSH server binds to port 22/tcp: you will be connecting to
destination port 22/tcp which is what you'll have to ACCEPT. Therefore
this should do it:

:OUTPUT DROP [80:13056]
-A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A OUTPUT -m state --state NEW -o lo -j ACCEPT
-A OUTPUT -m state --state NEW -p tcp --dport 22 -j ACCEPT

This way you'll be blocking *everything* else, including DNS lookups.
So, before you say it doesn't work, without these rules you'd only be
able to connect using an IP address:
-A OUTPUT -m state --state NEW -p tcp --dport 53 -j ACCEPT
-A OUTPUT -m state --state NEW -p udp --dport 53 -j ACCEPT

If it doesn't work , add this to see what packets get logged when you're
trying to connect to the SSH server:
-A OUTPUT -j LOG --log-prefix "IPT: "

If you want to be able to do *anything* else, you must write a rule to
accept it.


Gr,
Rob



  reply	other threads:[~2006-09-08  5:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-06  2:14 not able to ssh from the firewall varun
2006-09-06  5:31 ` Rob Sterenborg
2006-09-07 14:01   ` varun
2006-09-07 20:57     ` Rob Sterenborg
2006-09-08  2:22       ` varun
2006-09-08  5:29         ` Rob Sterenborg [this message]
2006-09-19 13:38           ` varun
2006-09-12 19:48         ` connrate and Linux 2.6.14 and 2.6.16 Pablo Sanchez
     [not found]       ` <1157854906.4748.4.camel@nirvana.aurokruti.in>
2006-09-11  8:29         ` not able to ssh from the firewall Rob Sterenborg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='001101c6d307$bcf914b0$0101000a@tanjian' \
    --to=rob@sterenborg.info \
    --cc=netfilter@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox