Linux Netfilter discussions
 help / color / mirror / Atom feed
From: MargoAndTodd <margoandtodd@gmail.com>
To: netfilter@vger.kernel.org
Subject: Re: passive mode ftp high ports driving me nuts
Date: Fri, 08 Jan 2010 18:59:41 -0800	[thread overview]
Message-ID: <4B47F11D.1000507@gmail.com> (raw)
In-Reply-To: <4B4707EA.9010301@chello.at>

On 01/08/2010 02:24 AM, Mart Frauenlob wrote:

>> It is the "--sport $unassgn --dport $unassgn" that is killing me.
>> How do I restrict the last three to just passive mode ftp?
>>
>
> use the 'helper' match extension. i.e: -m helper --helper ftp.
> if you need to distinguish between active and passive, you still can use
> the port and state matches for that.

Hi Mart,

Works perfectly.  Thank you!

-T

p.s. my new rules:

# ftp passive mode (browser) stuff.  Note: ftp_conntrack module is 
required, e.g.:
# /etc/sysconfig/iptables-config:
# IPTABLES_MODULES="ip_conntrack_ftp"
#
$tbls -A dsl-out  -o eth1  -p tcp  -s $eth1_addr --sport $unassgn 
--dport ftp         -m state --state NEW,ESTABLISHED           -j ACCEPT
$tbls -A dsl-in   -i eth1  -p tcp  ! --syn --sport ftp -d $eth1_addr 
--dport $unassgn -m state --state RELATED,ESTABLISHED       -j ACCEPT
$tbls -A dsl-for  -i eth1  -p tcp  ! --syn --sport ftp -d $internal_net 
  --dport $unassgn  -m state --state RELATED,ESTABLISHED  -j ACCEPT
# The "ftpdata" session is a "new" one when it sends the SYN.  However, 
the ftp_conntrack module marks it as related to its controlling
# ftp session, so that state=related matches.  This should deny any 
"ftpdata" session that doesn't have a controlling ftp session.
#$tbls -A dsl-out  -o eth1  -p tcp  -s $eth1_addr --sport $unassgn -d 
$ANY_IP --dport $unassgn -m state --state RELATED,ESTABLISHED 
      -j ACCEPT
#$tbls -A dsl-in   -i eth1  -p tcp  ! --syn  -s $ANY_IP --sport $unassgn 
-d $eth1_addr --dport $unassgn  -m state --state RELATED,ESTABLISHED 
   -j ACCEPT
#$tbls -A dsl-for  -i eth1  -p tcp  ! --syn  -s $ANY_IP --sport $unassgn 
-d $internal_net --dport $unassgn   -m state --state RELATED,ESTABLISHED 
  -j ACCEPT
$tbls -A dsl-out  -o eth1  -p tcp  -s $eth1_addr       -d $ANY_IP 
-m helper --helper ftp -m state --state RELATED,ESTABLISHED  -j ACCEPT
$tbls -A dsl-in   -i eth1  -p tcp  ! --syn  -s $ANY_IP -d $eth1_addr 
-m helper --helper ftp -m state --state RELATED,ESTABLISHED  -j ACCEPT
$tbls -A dsl-for  -i eth1  -p tcp  ! --syn  -s $ANY_IP -d $internal_net 
-m helper --helper ftp -m state --state RELATED,ESTABLISHED  -j ACCEPT



  parent reply	other threads:[~2010-01-09  2:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-07 19:13 passive mode ftp high ports driving me nuts MargoAndTodd
2010-01-08 10:24 ` Mart Frauenlob
2010-01-08 16:09   ` MargoAndTodd
2010-01-08 16:40     ` Mart Frauenlob
2010-01-09  2:59   ` MargoAndTodd [this message]
2010-01-09 13:55     ` Mart Frauenlob
2010-01-09 14:04       ` Mart Frauenlob
2010-01-09 16:33         ` MargoAndTodd

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=4B47F11D.1000507@gmail.com \
    --to=margoandtodd@gmail.com \
    --cc=netfilter@vger.kernel.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