From: varun <varun_saa@rediffmail.com>
To: Rob Sterenborg <rob@sterenborg.info>
Cc: netfilter@lists.netfilter.org
Subject: RE: not able to ssh from the firewall
Date: Thu, 07 Sep 2006 19:31:22 +0530 [thread overview]
Message-ID: <1157637682.4771.1.camel@nirvana.aurokruti.in> (raw)
In-Reply-To: <001801c6d175$bed33790$0101000a@tanjian>
On Wed, 2006-09-06 at 07:31 +0200, Rob Sterenborg wrote:
> > Hello,
> >
> > Basically I am allowing internet on the
> > firewall as well as nating to 2 clients.
> >
> > I am not able to ssh from the firewall
> > to a client. Though the reverse is
> > working.
> >
> > I would also like to put :
> >
> > -A OUTPUT -j DROP
> >
> > But if I do that clients are not able to connect
> > to the net. I need add a rule which I could
> > not figure out.
>
> You should allow SSH out when you want to be able to use it.
> SSH listens on port 22, so this should do it:
>
> -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
> -A OUTPUT -p tcp --dport 22 -j ACCEPT
> -A OUTPUT -j DROP
No that did not work.
>
> > Please comment and correct.
> >
> > My rules as follows.
> >
> >
> > # Generated by iptables-save v1.3.3 on Sat Jul 22 13:14:10 2006
> > *nat
> >: OUTPUT ACCEPT [0:0]
> >: PREROUTING ACCEPT [0:0]
> >: POSTROUTING ACCEPT [0:0]
> > -A POSTROUTING -o eth0 -s 192.168.15.0/24 -j MASQUERADE
> > COMMIT
> > # Completed on Sat Jul 22 13:14:10 2006
> > # Generated by iptables-save v1.3.3 on Sat Jul 22 13:14:10 2006
> > *mangle
> >: PREROUTING ACCEPT [80:13056]
> >: INPUT ACCEPT [80:13056]
> >: FORWARD ACCEPT [0:0]
> >: OUTPUT ACCEPT [80:13056]
> >: POSTROUTING ACCEPT [80:13056]
> > COMMIT
> > # Completed on Sat Jul 22 13:14:10 2006
> > # Generated by iptables-save v1.3.3 on Sat Jul 22 13:14:10 2006
> > *filter
> >: INPUT ACCEPT [80:13056]
> > -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
>
> It looks like eth0 is connected to the internet and eth1 to your LAN.
> Check if outgoing ssh works using:
>
> -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
>
> > -A INPUT -i lo -j ACCEPT
> > -A INPUT -p icmp -j ACCEPT
> > -A INPUT -p tcp -i eth0 --dport 80 -j ACCEPT
> > -A INPUT -p tcp -i eth0 --dport 53 -j ACCEPT
> > -A INPUT -p udp -i eth0 --dport 53 -j ACCEPT
> > -A INPUT -i eth1 -p tcp --dport 22 -j ACCEPT
> > -A INPUT -i eth1 -p tcp --dport 21 -j ACCEPT
>
> So, you are accepting ftp for the firewall on eth1. See below (FORWARD).
>
> > -A INPUT -j DROP
> >: FORWARD ACCEPT [0:0]
> >: OUTPUT ACCEPT [80:13056]
> > -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED
> > -j ACCEPT
>
> I would make that:
>
> -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
>
> > -A FORWARD -i eth1 -o eth0 -s 192.168.15.5 -j ACCEPT
> > -A FORWARD -i eth1 -o eth0 -s 192.168.15.9 -j ACCEPT
> > -A FORWARD -i eth1 -o eth0 -p tcp --dport 21 -j ACCEPT
>
> And you allow ftp forwarding on eth1 to eth0.
> Either one (see above) is going to work, not both. Since you are
> masquerading everything from 192.168.15.0/24 via eth0, I'd say this rule
> has hits and the rule in the INPUT chain doesn't.
> (Check with "iptables -nvL INPUT" and "iptables -nvL FORWARD".)
>
> > -A FORWARD -i eth1 -o eth0 -p tcp --dport 25 -j ACCEPT
> > -A FORWARD -i eth1 -o eth0 -p tcp --dport 110 -j ACCEPT
> > -A FORWARD -i eth1 -o eth0 -p tcp --dport 119 -j ACCEPT
> > -A FORWARD -p udp --dport 53 -j ACCEPT
> > -A FORWARD -j DROP
> > -A OUTPUT -j ACCEPT
> > -A OUTPUT -o lo -j ACCEPT
>
> This seems useless to me. There are no DROP rules in the OUTPUT chain
> and policy is set to ACCEPT. These packets would be accepted anyway.
>
> > COMMIT
> > # Completed on Sat Jul 22 13:14:10 2006
> >
> > ---------- end rules --------------
>
> Instead of have a last rule with a DROP target, you can also just set
> the chain policy to DROP.
>
>
> Gr,
> Rob
>
>
>
next prev parent reply other threads:[~2006-09-07 14:01 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 [this message]
2006-09-07 20:57 ` Rob Sterenborg
2006-09-08 2:22 ` varun
2006-09-08 5:29 ` Rob Sterenborg
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=1157637682.4771.1.camel@nirvana.aurokruti.in \
--to=varun_saa@rediffmail.com \
--cc=netfilter@lists.netfilter.org \
--cc=rob@sterenborg.info \
/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