LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 07-21-2004, 09:18 AM   #1
Pastorino
Member
 
Registered: Jul 2004
Distribution: RHEL 6.2
Posts: 35

Rep: Reputation: 17
ip_conntrack_ftp: active ftp doesn't work


Hello everyone,

I'm using Fedora Core 1. I'm trying to use ip_conntrack_ftp and ip_nat_ftp to make active FTP work, but without success.

Here's an excerpt of the firewall script I'm using:

========== BEGIN

INT=eth0
DMZ=eth1
FTPSERVER=192.168.0.4

/sbin/modprobe ip_conntrack
/sbin/modprobe ip_conntrack_ftp
/sbin/modprobe ip_nat_ftp

iptables -A FORWARD -p tcp -i $DMZ -o $INT --sport 20 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -p tcp -i $INT -o $DMZ --dport 20 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -p tcp -i $INT -o $DMZ -s 0/0 -d $FTPSERVER --syn --dport 21 -j ACCEPT
iptables -t nat -A PREROUTING -p tcp -i $INT -d $VALID_IP --dport 21 -j DNAT --to-destination $FTPSERVER

========== END

When someone tries to connect to the FTP server using active mode, I get:

kernel: FORWARD blocked: IN=eth1 OUT=eth0 SRC=192.168.0.4 DST=(valid ip) (...) PROTO=TCP SPT=20 DPT=50918 WINDOW=65535 RES=0x00 SYN URGP=0

Does anyone know how to make it work right?

Thanks,

Carlos Pastorino

Last edited by Pastorino; 07-25-2004 at 07:31 PM.
 
Old 07-25-2004, 07:31 PM   #2
Pastorino
Member
 
Registered: Jul 2004
Distribution: RHEL 6.2
Posts: 35

Original Poster
Rep: Reputation: 17
By the way, I used Mr. Stephens' document as inspiration:

http://www.sns.ias.edu/~jns/security...track.html#FTP
 
Old 07-25-2004, 09:06 PM   #3
qwijibow
LQ Guru
 
Registered: Apr 2003
Location: nottingham england
Distribution: Gentoo
Posts: 2,672

Rep: Reputation: 47
you have written rules to allow ESTABLISHED and RELATED packets to the FTP server.... but you seem to have forgotten to allow NEW state packets to the server. could this be the problem ?
 
Old 08-11-2004, 08:36 AM   #4
Pastorino
Member
 
Registered: Jul 2004
Distribution: RHEL 6.2
Posts: 35

Original Poster
Rep: Reputation: 17
That's the point of my questioning. The documentation I read said that I shouldn't need the NEW status, because that's the whole idea about the ip_conntrack_ftp: to make iptables understand that the NEW 20/tcp IN packet is RELATED to the 21/tcp OUT packet.

It seems then that ip_conntrack_ftp doesn't do what it promises to do. Or does it? And if it does, how to make it work?

Carlos Pastorino
 
Old 08-11-2004, 04:09 PM   #5
qwijibow
LQ Guru
 
Registered: Apr 2003
Location: nottingham england
Distribution: Gentoo
Posts: 2,672

Rep: Reputation: 47
Quote:
That's the point of my questioning. The documentation I read said that I shouldn't need the NEW status, because that's the whole idea about the ip_conntrack_ftp: to make iptables understand that the NEW 20/tcp IN packet is RELATED to the 21/tcp OUT packet.
this is normally true because all output is allowed.
so then an established or related packet in input, is accepted, because the FIRST packet gets out through the OUTPUT chain.

but you seem to be using the linux machine as a router (whch is why u put rules in FORWARD i assume ?)
because both input and output goes through forward, the first packet does not get through.

you dont seem to understand iptables fully... why not try an automatic firewall rule generator like firestarter.
it will ask you simple questions, and generate very secure rule sets for you.
 
Old 08-12-2004, 04:26 PM   #6
Pastorino
Member
 
Registered: Jul 2004
Distribution: RHEL 6.2
Posts: 35

Original Poster
Rep: Reputation: 17
Because I want to learn.
 
Old 08-13-2004, 05:30 AM   #7
qwijibow
LQ Guru
 
Registered: Apr 2003
Location: nottingham england
Distribution: Gentoo
Posts: 2,672

Rep: Reputation: 47
well then... read 'man iptables'
its a long read, but by the end of it, all is simple.

reading the manual should have been the first step if you wanted to learn about the application.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
A active FTP server muppski Linux - Networking 6 07-27-2005 01:07 PM
Active ftp, konqueror Hamsjael Linux - Networking 4 06-10-2005 10:01 AM
Another iptables Active FTP Issue tnolte Linux - Networking 4 09-28-2003 11:34 AM
ip_conntrack_ftp... I can't get PASSV ftp? satellite Linux - Security 2 12-16-2002 02:28 AM
Active and Passive FTP sancho5 Linux - Networking 3 11-24-2001 09:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 03:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration