Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Dieter Braun <dieter.braun@onevision.de>
To: netfilter@lists.netfilter.org
Subject: ftp connection tracking and frox proxy
Date: Tue, 28 Jan 2003 17:17:24 +0100	[thread overview]
Message-ID: <3E36AD14.4AAA111F@onevision.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 3288 bytes --]

Hi,

I just set up a transparent ftp proxy using frox 0.7.6. Works pretty
well, only state matching (iptables 1.2.5-58) for the connections
between the client and frox doesn't work as I would have expected. Here
are the rules that are necessary:

----------------------------------------------------------------------------

# Redirection to frox port
$PROG -t nat -A PREROUTING -p tcp -i br0 -s $INTRANET --sport 1024: -d !
$INTRANET --dport 21 -j REDIRECT --to-ports 2121

# ftp request client to frox
$PROG -A INPUT -p tcp -i br0 -s $INTRANET --sport 1024: -d $INT --dport
2121 -m state --state NEW,ESTABLISHED -j ACCEPT
$PROG -A OUTPUT -p tcp -s $INT --sport 2121 -o br0 -d $INTRANET --dport
1024: ! --syn -m state --state ESTABLISHED -j ACCEPT
                                # as expected

# data channel frox to client, passive ftp
$PROG -A INPUT -p tcp -i br0 -s $INTRANET --sport 1024: -d $INT --dport
1024: -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
$PROG -A OUTPUT -p tcp -s $INT --sport 1024: -o br0 -d $INTRANET --dport
1024: -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
                                # would expect to need only
ESTABLISHED,RELATED in the first line
                                # would expect to need only ESTABLISHED
in the second line
                                # (didn't try NEW,ESTABLISHED without
RELATED yet)

# data channel frox to client, active ftp
$PROG -A OUTPUT -p tcp -s $INT --sport 20 -o br0 -d $INTRANET --dport
1024: -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
$PROG -A INPUT -p tcp -i br0 -s $INTRANET --sport 1024: -d $INT --dport
20 ! --syn -m state --state ESTABLISHED -j ACCEPT
                                # would expect to need only
ESTABLISHED,RELATED in the first line

# ftp request frox to internet
$PROG -A OUTPUT -p tcp -s $EXT --sport 1024: -o eth2 -d 0/0 --dport 21
-m state --state NEW,ESTABLISHED -j ACCEPT
$PROG -A INPUT -p tcp -i eth2 -s 0/0 --sport 21 -d $EXT --dport 1024: !
--syn -m state --state ESTABLISHED -j ACCEPT

# data channel internet to frox, passive ftp
$PROG -A OUTPUT -p tcp -s $EXT --sport 1024: -o eth2 -d 0/0 --dport
1024: -m state --state ESTABLISHED,RELATED -j ACCEPT
$PROG -A INPUT -p tcp -i eth2 -s 0/0 --sport 1024: -d $EXT --dport 1024:
! --syn -m state --state ESTABLISHED -j ACCEPT

## data channel internet to frox, active ftp
#$PROG -A INPUT -p tcp -i eth2 -s 0/0 --sport 20 -d $EXT --dport 1024:
-m state --state ESTABLISHED,RELATED -j ACCEPT
#$PROG -A OUTPUT -p tcp -s $EXT --sport 1024: -o eth2 -d 0/0 --dport 20
! --syn -m state --state ESTABLISHED -j ACCEPT
----------------------------------------------------------------------------

(You might wonder about the device br0: frox works with bridging! .-)))

The state matching rules for the "external" connections to the internet
work as expected. But for the "internal" data connections between frox
and the clients, frox always needs to build a NEW data connection
instead of a RELATED one. Since this is only for the internal
connections, not for the external ones, I have the feeling that this
might be due to frox. (Didn't find any frox mailing list; does anybody
know one?) Or is there any problem with ip_conntrack_ftp for a ftp
server? Perhaps somebody has any better clue.

Greetings,
Dieter


[-- Attachment #2: Type: text/html, Size: 4597 bytes --]

                 reply	other threads:[~2003-01-28 16:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=3E36AD14.4AAA111F@onevision.de \
    --to=dieter.braun@onevision.de \
    --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