LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 06-22-2012, 06:00 AM   #1
lynckmeister
LQ Newbie
 
Registered: Jun 2012
Posts: 3

Rep: Reputation: Disabled
FTP Server Passive Firewall (iptables) Question


Dear Forum ,

im trying to secure my ftp server with an iptables firewall. After connection establishing I cant open the releated highport data channels whats wron ?
here the related script lines:

/sbin/modprobe ip_conntrack
/sbin/modprobe ip_conntrack_ftp

$IPTAB -P INPUT DROP
$IPTAB -P OUTPUT DROP
$IPTAB -P FORWARD DROP

$IPTAB -A OUTPUT -p TCP -s 0/0 --sport 21 --dport $HIGHP -o eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTAB -A INPUT -p TCP -s 0/0 --sport $HIGHP --dport 21 -i eth0 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
$IPTAB -A OUTPUT -p TCP -s 0/0 --sport $HIGHP --dport $HIGHP -o eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTAB -A INPUT -p TCP -s 0/0 --sport $HIGHP --dport $HIGHP -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT

I expected the mods to notice the related data ports so they can be accepted here?

Thanks for any ideas. ...

regards,

Filip
 
Old 06-22-2012, 06:48 AM   #2
Linux_Kidd
Member
 
Registered: Jan 2006
Location: USA
Posts: 737

Rep: Reputation: 78
can we start with which flavor of iptables, and, what do the logs say?
 
Old 06-22-2012, 08:15 AM   #3
lynckmeister
LQ Newbie
 
Registered: Jun 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
its the version iptables v1.4.2-rc1
which logs do you mean ?
my ftp client can open the connection but if it tries to get the directory content the passive mode cant geht the connection...
all the policies are on drop so the packets are not logged...
 
Old 06-22-2012, 04:45 PM   #4
Linux_Kidd
Member
 
Registered: Jan 2006
Location: USA
Posts: 737

Rep: Reputation: 78
the logs that iptables generates

do you have a wireshark cap from client side while you try and connect??
 
Old 06-23-2012, 07:01 AM   #5
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
Two suggestions:
1 - verify that the conntrack module is actually present
2 - start with a simple script, such as allowing high port 1024 in addition to the standard ports 20,21 as in this how to: http://www.cyberciti.biz/faq/iptable...s-not-working/

This will at least help isolate what part of your iptables configuration is causing you trouble.
 
Old 06-24-2012, 04:44 AM   #6
lynckmeister
LQ Newbie
 
Registered: Jun 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
OK I will verify if the module is present, but for me the rest seems pretty clear:
if i open the 1024: ports , everything works fine, so it seems, that the rule which only lets related,established connections above 1024 causes the trouble. the ftp conntrack module should handle these connections but it seems that it doesnt do it.


Quote:
Originally Posted by Noway2 View Post
Two suggestions:
1 - verify that the conntrack module is actually present
2 - start with a simple script, such as allowing high port 1024 in addition to the standard ports 20,21 as in this how to: http://www.cyberciti.biz/faq/iptable...s-not-working/

This will at least help isolate what part of your iptables configuration is causing you trouble.
 
  


Reply



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
iptables / Passive FTP Jay_Drummond Linux - Software 4 03-19-2013 07:49 PM
passive ftp behind firewall mad_penguin Linux - Newbie 3 02-23-2011 07:41 AM
iptables and passive ftp gabsik Linux - Networking 8 01-28-2007 04:15 AM
FTP server stuck in passive with iptables running. TheRealDeal Linux - Security 5 02-24-2005 04:57 PM
IPtables and Passive FTP MatrixIII007 Linux - Security 2 10-16-2003 08:10 AM

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

All times are GMT -5. The time now is 04:45 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