* Is iptables kickin' that much?
@ 2002-09-06 13:40 wickedsun
2002-09-06 23:44 ` Anders Fugmann
0 siblings, 1 reply; 5+ messages in thread
From: wickedsun @ 2002-09-06 13:40 UTC (permalink / raw)
To: netfilter
I'm not sure I understood very well what you explained. But I have only one
thing to say, it works. Now the question is, will this work with any
protocol? (ftp, irc, etc). The thing is scary me a bit. I read in your email
that you have to load up a FTP module (which I have compiled in the kernel)
and it seems to me that it works with other protocol as well. (I was able to
enable Active in DC++ without having to forward manually each ports like I
used to do).
This was of a huge help for the iptables newbies (including me) and thanks.
Charles
-----------------------
Original Message:
As alot of others replies the problem is when ftp enters passive mode,
the server initiates a dataconnection to your machine.
Fortunatly, is a "port" command is send first over the command channel,
in order to let the client and server know how and where this new
connection will be established.
This can be caught by the netfilter code, and netfilter can allow this
connection to be accepted from the server in a quite clever way, because
netfilter is _statefull_. ipchans was not, and hence this was not possible.
The following gives an example of how netfilter can handle this:
Lets assume that you are sittin behind a iptables firewall doing nat,
and all you want is to allow users from the inside (eth0) to conenct to
the internet through the external link (ppp0)
# First load the heper modules for the ftp protocol connection tracking.
# Delete these lines, if the modules are compiled statically into the
# kernel.
modprobe ip_conntrack_ftp
# And the nat part for the ftp protocol.
modprobe ip_nat_ftp
# Set default policies.
iptables -P INPUT drop
iptables -P FORWARD drop
iptables -P OUTPUT accept
# NAT all connections
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUEADE
# Allow the mashine to make any kind of connections.
iptables -A INPUT -m state --state ESTABLISHED,RELATED \
-j ACCEPT
# Allow the same for machines located behind the firewall.
iptables -A FORWARD -i eth0 -o ppp0 -j ACCEPT
iptables -A FORWARD -o eth0 -i ppp0 -m state \
--state ESTABLISHED,RELATED -j ACCEPT
And we are all done. The trick is to use the 'state' match. The RELATED
state will match the first packet in the data-connection from the
ftp-server in passive mode. Any packets hereafter will be in the
ESTABLISHED state.
As you might have noticed, there is no protocol speicifer. So this also
works for e.g. DNS lookups (udp) and ICMP packets related to an already
esablished connection. Statefull firewalling is just sooo great.
There is no reason for you to patch the kernel in order to do this,
this has been possible for a long time.
Regards
Anders Fugmann
-----------------
Charles D'Aoust
wickedsun@phreaker.net
wicked@unraved.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Is iptables kickin' that much?
2002-09-06 13:40 Is iptables kickin' that much? wickedsun
@ 2002-09-06 23:44 ` Anders Fugmann
2002-09-07 2:12 ` wickedsun
2002-09-07 12:46 ` Mike D
0 siblings, 2 replies; 5+ messages in thread
From: Anders Fugmann @ 2002-09-06 23:44 UTC (permalink / raw)
To: wickedsun; +Cc: netfilter
wickedsun wrote:
> thing to say, it works.
Great.
> Now the question is, will this work with any
> protocol? (ftp, irc, etc).
as of today, only ftp and IRC is implemented in the vanilla tree. POM
may have connection tracking for other protocols.
A protocol that requests something and then receives an answer is
handled by basic connection tracking (Which is why you dont need
connection tracking modules for e.g. http and pop, since no new
connection are established). It is the RELATED packets that are hard to
find.
>The thing is scary me a bit. I read in your email
> that you have to load up a FTP module (which I have compiled in the kernel)
> and it seems to me that it works with other protocol as well. (I was able to
> enable Active in DC++ without having to forward manually each ports like I
> used to do).
Active DC++???? Never heard of it.
>
> This was of a huge help for the iptables newbies (including me) and thanks.
No problem.
Regards
Anders Fugmann
--
Author of FIAIF
FIAIF Is An Intelligent Firewall
http://fiaif.fugmann.dhs.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Is iptables kickin' that much?
2002-09-06 23:44 ` Anders Fugmann
@ 2002-09-07 2:12 ` wickedsun
2002-09-07 9:11 ` Anders Fugmann
2002-09-07 12:46 ` Mike D
1 sibling, 1 reply; 5+ messages in thread
From: wickedsun @ 2002-09-07 2:12 UTC (permalink / raw)
To: afu; +Cc: netfilter
[-- Attachment #1: Type: Text/Plain, Size: 1717 bytes --]
DC++ is a Direct Connect client. You can use either Passive or Active mode.
It's just like FTP. In passive you get the search responces from the server
where as Active, the users send you the responces directly thru port 1412. I
used to have to map the ports, but after flushing my forwards and adding
your rules to my IPtables, it worked.
Look on sourceforge for DC++.
-------Original Message-------
From: Anders Fugmann
Date: Friday, September 06, 2002 7:52:52 PM
To: wickedsun
Cc: netfilter
Subject: Re: Is iptables kickin' that much?
wickedsun wrote:
> thing to say, it works.
Great.
> Now the question is, will this work with any
> protocol? (ftp, irc, etc).
as of today, only ftp and IRC is implemented in the vanilla tree. POM
may have connection tracking for other protocols.
A protocol that requests something and then receives an answer is
handled by basic connection tracking (Which is why you dont need
connection tracking modules for e.g. http and pop, since no new
connection are established). It is the RELATED packets that are hard to
find.
>The thing is scary me a bit. I read in your email
> that you have to load up a FTP module (which I have compiled in the
kernel)
> and it seems to me that it works with other protocol as well. (I was able
to
> enable Active in DC++ without having to forward manually each ports like I
> used to do).
Active DC++???? Never heard of it.
>
> This was of a huge help for the iptables newbies (including me) and thanks
No problem.
Regards
Anders Fugmann
--
Author of FIAIF
FIAIF Is An Intelligent Firewall
http://fiaif.fugmann.dhs.org
.
[-- Attachment #2: Type: Text/HTML, Size: 3394 bytes --]
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="IncrediMail 1.0" name=GENERATOR>
<!--IncrdiXMLRemarkStart>
<IncrdiX-Info>
<X-FID>FLAVOR00-NONE-0000-0000-000000000000</X-FID>
<X-FVER></X-FVER>
<X-CNT>;</X-CNT>
</IncrdiX-Info>
<IncrdiXMLRemarkEnd-->
</HEAD>
<BODY style="BACKGROUND-POSITION: 0px 0px; FONT-SIZE: 12pt; MARGIN: 5px 10px 10px; FONT-FAMILY: Arial" bgColor=#ffffff background="" scroll=yes ORGYPOS="0" X-FVER="3.0">
<TABLE id=INCREDIMAINTABLE cellSpacing=0 cellPadding=2 width="100%" border=0>
<TBODY>
<TR>
<TD id=INCREDITEXTREGION style="FONT-SIZE: 12pt; CURSOR: auto; FONT-FAMILY: Arial" width="100%">
<DIV>DC++ is a Direct Connect client. You can use either Passive or Active mode. It's just like FTP. In passive you get the search responces from the server where as Active, the users send you the responces directly thru port 1412. I used to have to map the ports, but after flushing my forwards and adding your rules to my IPtables, it worked.</DIV>
<DIV> </DIV>
<DIV>Look on sourceforge for DC++.<BR> </DIV>
<DIV id=IncrediOriginalMessage><I>-------Original Message-------</I></DIV>
<DIV> </DIV>
<DIV id=receivestrings>
<DIV dir=ltr style="FONT-SIZE: 11pt" <i><B>From:</B></I> <A href="mailto:afu@fugmann.dhs.org">Anders Fugmann</A></DIV>
<DIV dir=ltr style="FONT-SIZE: 11pt" <i><B>Date:</B></I> Friday, September 06, 2002 7:52:52 PM</DIV>
<DIV dir=ltr style="FONT-SIZE: 11pt" <i><B>To:</B></I> <A href="mailto:wickedsun@phreaker.net">wickedsun</A></DIV>
<DIV dir=ltr style="FONT-SIZE: 11pt" <i><B>Cc:</B></I> <A href="mailto:netfilter@lists.netfilter.org">netfilter</A></DIV>
<DIV dir=ltr style="FONT-SIZE: 11pt" <i><B>Subject:</B></I> Re: Is iptables kickin' that much?</DIV></DIV>
<DIV> </DIV>wickedsun wrote:<BR>> thing to say, it works. <BR>Great.<BR><BR>> Now the question is, will this work with any<BR>> protocol? (ftp, irc, etc). <BR>as of today, only ftp and IRC is implemented in the vanilla tree. POM <BR>may have connection tracking for other protocols.<BR><BR>A protocol that requests something and then receives an answer is <BR>handled by basic connection tracking (Which is why you dont need <BR>connection tracking modules for e.g. http and pop, since no new <BR>connection are established). It is the RELATED packets that are hard to <BR>find.<BR><BR>>The thing is scary me a bit. I read in your email<BR>> that you have to load up a FTP module (which I have compiled in the kernel)<BR>> and it seems to me that it works with other protocol as well. (I was able to<BR>> enable Active in DC++ without having to forward manually each ports like I<BR>> used to do).<BR>Active DC++???? Never heard of it.<BR><BR>> <BR>> This was of a huge help for the iptables newbies (including me) and thanks.<BR>No problem.<BR><BR>Regards<BR>Anders Fugmann<BR><BR>--<BR>Author of FIAIF<BR>FIAIF Is An Intelligent Firewall<BR><A href="http://fiaif.fugmann.dhs.org">http://fiaif.fugmann.dhs.org</A><BR><BR><BR><BR>. </TD></TR>
<TR>
<TD id=INCREDIFOOTER width="100%">
<TABLE cellSpacing=0 cellPadding=0 width="100%">
<TBODY>
<TR>
<TD width="100%"></TD>
<TD id=INCREDISOUND vAlign=bottom align=middle></TD>
<TD id=INCREDIANIM vAlign=bottom align=middle></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></BODY></HTML>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Is iptables kickin' that much?
2002-09-07 2:12 ` wickedsun
@ 2002-09-07 9:11 ` Anders Fugmann
0 siblings, 0 replies; 5+ messages in thread
From: Anders Fugmann @ 2002-09-07 9:11 UTC (permalink / raw)
To: wickedsun, netfilter
wickedsun wrote:
> DC++ is a Direct Connect client. You can use either Passive or Active
> mode. It's just like FTP. In passive you get the search responces from
> the server where as Active, the users send you the responces directly
> thru port 1412. I used to have to map the ports, but after flushing my
> forwards and adding your rules to my IPtables, it worked.
>
If Active mode spawns a new connection, then I do not understand why it
works. Try to see if the port is always open by telnetting to it from a
host on the internet.
Also you should try to use NMAP (from a remote machine) to see what how
many ports are open on your machine.
Regards
Anders Fugmann
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Is iptables kickin' that much?
2002-09-06 23:44 ` Anders Fugmann
2002-09-07 2:12 ` wickedsun
@ 2002-09-07 12:46 ` Mike D
1 sibling, 0 replies; 5+ messages in thread
From: Mike D @ 2002-09-07 12:46 UTC (permalink / raw)
To: Anders Fugmann, wickedsun, unsubscribe; +Cc: netfilter
----- Original Message -----
From: "Anders Fugmann" <afu@fugmann.dhs.org>
To: "wickedsun" <wickedsun@phreaker.net>
Cc: "netfilter" <netfilter@lists.netfilter.org>
Sent: Friday, September 06, 2002 7:44 PM
Subject: Re: Is iptables kickin' that much?
> wickedsun wrote:
> > thing to say, it works.
> Great.
>
> > Now the question is, will this work with any
> > protocol? (ftp, irc, etc).
> as of today, only ftp and IRC is implemented in the vanilla tree. POM
> may have connection tracking for other protocols.
>
> A protocol that requests something and then receives an answer is
> handled by basic connection tracking (Which is why you dont need
> connection tracking modules for e.g. http and pop, since no new
> connection are established). It is the RELATED packets that are hard to
> find.
>
> >The thing is scary me a bit. I read in your email
> > that you have to load up a FTP module (which I have compiled in the
kernel)
> > and it seems to me that it works with other protocol as well. (I was
able to
> > enable Active in DC++ without having to forward manually each ports like
I
> > used to do).
> Active DC++???? Never heard of it.
>
> >
> > This was of a huge help for the iptables newbies (including me) and
thanks.
> No problem.
>
> Regards
> Anders Fugmann
>
> --
> Author of FIAIF
> FIAIF Is An Intelligent Firewall
> http://fiaif.fugmann.dhs.org
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-09-07 12:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-06 13:40 Is iptables kickin' that much? wickedsun
2002-09-06 23:44 ` Anders Fugmann
2002-09-07 2:12 ` wickedsun
2002-09-07 9:11 ` Anders Fugmann
2002-09-07 12:46 ` Mike D
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox