Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
07-21-2004, 09:18 AM
|
#1
|
Member
Registered: Jul 2004
Distribution: RHEL 6.2
Posts: 35
Rep:
|
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.
|
|
|
07-25-2004, 09:06 PM
|
#3
|
LQ Guru
Registered: Apr 2003
Location: nottingham england
Distribution: Gentoo
Posts: 2,672
Rep:
|
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 ?
|
|
|
08-11-2004, 08:36 AM
|
#4
|
Member
Registered: Jul 2004
Distribution: RHEL 6.2
Posts: 35
Original Poster
Rep:
|
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
|
|
|
08-11-2004, 04:09 PM
|
#5
|
LQ Guru
Registered: Apr 2003
Location: nottingham england
Distribution: Gentoo
Posts: 2,672
Rep:
|
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.
|
|
|
08-12-2004, 04:26 PM
|
#6
|
Member
Registered: Jul 2004
Distribution: RHEL 6.2
Posts: 35
Original Poster
Rep:
|
Because I want to learn.
|
|
|
08-13-2004, 05:30 AM
|
#7
|
LQ Guru
Registered: Apr 2003
Location: nottingham england
Distribution: Gentoo
Posts: 2,672
Rep:
|
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.
|
|
|
All times are GMT -5. The time now is 03:40 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|