All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Cannings <lists@edeca.net>
To: netfilter@lists.netfilter.org
Subject: Re: Allowing FTP and internal but nothing else
Date: Wed, 3 Mar 2004 17:18:12 +0000	[thread overview]
Message-ID: <200403031718.12761.lists@edeca.net> (raw)
In-Reply-To: <4A8849EC2E153F41B6CECD20C81BC63BD11E66@wolfcreek.skld.net>

On Wednesday 03 March 2004 16:55, Paul Harlow wrote:
> I have an FTP server that I would like to filter out all external
> traffic except ftp and ftp-data. This same server has an internal
> interface that I would like to allow everything on the inside to have
> access to. Given what I've read I have come up with this general idea
> of what to put into a filter table for now. Please let me know what
> your gurus of netfilter think. Thanks!

I am no guru but here is my 2c.

> iptables -I INPUT -i eth0 -j ACCEPT

This would accept any packet coming in on eth0, this is fine as long as 
you didn't want to be more restrictive about this interface.

> iptables -I INPUT -i eth1 -d port 21 -j ACCEPT
> iptables -I INPUT -i eth1 -d port 20 -j ACCEPT

Both should be "--dport", "-d" is destination, for hosts.  You'd use -d 
like this:

iptables -I INPUT -d 192.168.0.1 -j ACCEPT

Your rule above could be rewritten as:

iptables -I INPUT -i eth1 --dport 21 -j ACCEPT

> iptables -I INPUT -i eth1 -j deny

Note that "deny" isn't a valid target, unless you've definied your own 
chain called "deny".  From the manual page, the correct target would be 
"DROP".

> I am assuming this is similar to Cisco access lists in that it will
> read along the filter list until a hit is made then take action. Please
> correct me if I am wrong.

iptables is "first match", yes.  The first rule that matches a packet will 
be the one that controls the fate of it.  This can, however, include 
jumping through other chains.

For FTP, you might like to look into the FTP connection tracking helpers.  
Also, you may well need rules to allow established or related packets.

Hope this helps,

David


  reply	other threads:[~2004-03-03 17:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-03 16:55 Allowing FTP and internal but nothing else Paul Harlow
2004-03-03 17:18 ` David Cannings [this message]
2004-03-03 17:24   ` Antony Stone
2004-03-03 17:20 ` Cedric Blancher
  -- strict thread matches above, loose matches on Subject: below --
2004-03-03 17:54 Paul Harlow

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=200403031718.12761.lists@edeca.net \
    --to=lists@edeca.net \
    --cc=david@edeca.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.