All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aleksandar Milivojevic <amilivojevic@pbl.ca>
To: vincent.blondel@chello.be
Cc: netfilter@lists.netfilter.org
Subject: Re: FTP Connection problems.
Date: Wed, 25 Aug 2004 09:13:36 -0500	[thread overview]
Message-ID: <412C9E90.90902@pbl.ca> (raw)
In-Reply-To: <1093428637.1781.17.camel@lbedlbxl.dev.xtra-net.org>

Vincent Blondel wrote:
> Thanks a lot for all the details but I still get some problems. As I
> said it all the netfilter source code is compiled in a custom kernel
> without any modules. 
> 
> Concerning the little iptables script I have written, I updated it with
> your comments and now I get the next script 

[snip]

> if [ "$CONN_TRACK" = "1" ]; then
>         $fw -A INPUT -m state --state ESTABLISHED -j ACCEPT
>         $fw -A OUTPUT -m state --state ESTABLISHE -j ACCEPT
>         $fw -A FORWARD -m state --state ESTABLISHED -j ACCEPT
>         $fw -A INPUT -p icmp -m state --state RELATED -j ACCEPT
> fi

Add these too:

$fw -A OUTPUT -p icmp -m state --state RELATED -j ACCEPT
$fw -A FORWARD -p icmp -m state --state RELATED -j ACCEPT

> ... but the connection takes a long time to terminate. If I disable all
> the rules, ftp connection goes directly but with iptables enabled it
> takes such 8 seconds to accomplish the annonymomus connection ( with
> data port and passive models ).
> 
> What is this all about ???

You could use a bit of logging.  Add these as last rules (at the very 
end of your script):

iptables -A INPUT -j LOG --log-prefix "INPUT "
iptables -A OUTPUT -j LOG --log-prefix "OUTPUT "
iptables -A FORWARD -j LOG --log-prefix "FORWARD "

Logs will go wherever your kernel logs go.  Usually /var/log/messages.

Since these will be at the end of your rules, they will log all packets 
dropped by policy just before they are dropped.  My guess is that you 
will either find TCP SYN packets to port 113 (ident) or UDP packets to 
port 53 (DNS).

To silently disable ident (incoming and outgoing) on FTP server, you 
could do something like this (you can add line for FORWARDED packets, if 
you wish):

iptables -A INPUT -p tcp --sport 1024: --dport 113 \
    -j REJECT --reject-with tcp-reset
iptables -A OUTPUT -p tcp --sport 1024: --dport 113 \
    -j REJECT --reject-with tcp-reset
iptables -A OUTPUT -p tcp --sport 113 --dport 1024: \
    -m state --state RELATED -j ACCEPT

If you want your FTP server to be able to resolve names and reverse 
lookup IP addresses:

iptables -A OUTPUT -p udp --sport 1024: --dport 53 \
    -m state --state NEW -j ACCEPT
iptables -A OUTPUT -p tcp --sport 1024: --dport 53 \
    -m state --state NEW -j ACCEPT

(you can add IP address(es) of your DNS server(s) there)

-- 
Aleksandar Milivojevic <amilivojevic@pbl.ca>    Pollard Banknote Limited
Systems Administrator                           1499 Buffalo Place
Tel: (204) 474-2323 ext 276                     Winnipeg, MB  R3T 1L7


  parent reply	other threads:[~2004-08-25 14:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-24 13:07 FTP Connection problems Vincent Blondel
2004-08-24 13:17 ` a.ledvinka
2004-08-24 16:10 ` Aleksandar Milivojevic
2004-08-25 10:10   ` Vincent Blondel
2004-08-25 11:11     ` a.ledvinka
2004-08-25 11:29       ` Vincent Blondel
2004-08-25 14:13     ` Aleksandar Milivojevic [this message]
2004-08-25 14:58       ` Vincent Blondel
2004-08-25 15:51       ` Vincent Blondel
  -- strict thread matches above, loose matches on Subject: below --
2004-08-24 13:19 Jason Opperisano
2004-08-24 14:04 Jason Opperisano
2004-08-25 11:48 Jason Opperisano
2004-08-25 12:34 ` Vincent Blondel
2004-08-25 12:49 Jason Opperisano
2004-08-25 13:58 ` Vincent Blondel
2004-08-25 14:16   ` Aleksandar Milivojevic
2004-08-25 14:14 Jason Opperisano

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=412C9E90.90902@pbl.ca \
    --to=amilivojevic@pbl.ca \
    --cc=netfilter@lists.netfilter.org \
    --cc=vincent.blondel@chello.be \
    /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.