Skip to contentSkip to conversation

ftp server

DISCUSSION it clown 2 participants 2 messages May 29, 2005 – May 30, 2005

lore
Share & tools
lore

it clown

author
#0 lore raw

Hi All,

I have a ftp server running on the box connected to the internet with iptables. I would like to allow ftp passive connections.I have done the following and it does not want to work:

iptables -A INPUT -p tcp --sport 21 -m state --state ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp --dport 21 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -p tcp --sport 1024: --dport 1024: -m state --state ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp --sport 1024: --dport 1024: -m state --state ESTABLISHED,RELATED -j ACCEPT

I have done the following and it works but it is not passive:

iptables -A INPUT -p tcp -m multiport --dport 20 -j ACCEPT iptables -A INPUT -p tcp -m multiport --dport 21 -j ACCEPT iptables -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

What are the best rules to allow ftp passive connections?

I also did load ip_conntrack_ftp.

Thanks
Regards
_____________________________________________________________________
For super low premiums, click here http://www.dialdirect.co.za/quote

#1 lore raw

Hi,

Quoted 8 lines · it clown

Hi All,

I have a ftp server running on the box connected to the internet with iptables. I would like to allow ftp passive connections.I have done the following and it does not want to work:

Let me summarize this to be sure I got it. On your internet box runs a ftp server and
iptables and you want to allow passive FTP _to_ your box. Right ?

Quoted 10 lines

iptables -A INPUT -p tcp --sport 21 -m state --state ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp --dport 21 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -p tcp --sport 1024: --dport 1024: -m state --state ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp --sport 1024: --dport 1024: -m state --state ESTABLISHED,RELATED -j ACCEPT

If I'm right you should swap --sport and --dport to something like this:

iptables -A INPUT -p tcp -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -A INPUT -p tcp --dport 21 --syn -j ACCEPT
iptables -A OUTPUT -p tcp -m state --state RELATED,ESTABLISHED -j ACCEPT

This should work.

HTH and have a nice time,

Joerg