LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-26-2004, 10:16 AM   #1
supreme2k
LQ Newbie
 
Registered: Jan 2004
Posts: 7

Rep: Reputation: 0
Glftpd + Iptables + Passive Mode


Hi,

i installed glftpd on my redhat9 machine which has 2 nics ( eth0 is 10.0.0.1 and makes the internet connection ) and the other nic is 192.168.0.100 ( which makes my lan connection to the rest of the network ).

on the same server, which is directly connected to the internet, i installed arno´s iptables. which works just great.

no the problem:

if somebody is connecting to my glftpd server on port 9000 he gets no dirlisting cause of passive mode errors. i added a passive mode port range at the glftp.conf and i nat ip forwarded the same at the iptables script.

does it make any diffrence if i forward it to 192.168.0.100 or 10.0.0.1 ? both are connected to the linux pc.

who can help !!! need fast help !
 
Old 01-26-2004, 10:41 AM   #2
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 48
There are 2 ip netfilter modules which must be manually loaded,
insmod ip_conntrack_ftp &
insmod ip_nat_ftp

to catch the passive port connection properly.
Add these to the script

If glftpd is on the server, the nat rule is -j REDIRECT to send it to localhost

Check the tutorial.

Last edited by peter_robb; 01-26-2004 at 10:43 AM.
 
Old 01-26-2004, 11:29 AM   #3
supreme2k
LQ Newbie
 
Registered: Jan 2004
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by peter_robb
There are 2 ip netfilter modules which must be manually loaded,
insmod ip_conntrack_ftp &
insmod ip_nat_ftp

to catch the passive port connection properly.
Add these to the script

If glftpd is on the server, the nat rule is -j REDIRECT to send it to localhost

Check the tutorial.

glftpd is on the same pc where iptables is running. into this machine there are 2 nics, one is 192.168.0.100 which makes my lan connection and one nic which makes via ppp0 my internet connection ( 10.0.0.1 )

to which adress i should forward the ports ? to 192.168.0.100 or 10.0.0.1 ?

can u please tell me the full command i should at to my script ? btw, if i add this command, it will be lost the next time i restart my pc, isnt it ?
 
Old 01-26-2004, 11:52 AM   #4
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 48
Whatever rule you are using to DNAT, change it to just -j REDIRECT.
 
Old 01-26-2004, 12:18 PM   #5
supreme2k
LQ Newbie
 
Registered: Jan 2004
Posts: 7

Original Poster
Rep: Reputation: 0
if i think bout this forwarding:

does it make sense at all to forward ports at all ? it makes no sense for me to forward the port to the server its installed ON. i think i should just open up the ports for passive and done or ?

( cant do it right now, cause iam at work )
 
Old 01-26-2004, 12:24 PM   #6
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 48
Quite true...

Try first with the 2 modules loaded and the firewall off,
if it's ok, then start the firewall..
 
Old 01-26-2004, 12:49 PM   #7
supreme2k
LQ Newbie
 
Registered: Jan 2004
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by peter_robb
Quite true...

Try first with the 2 modules loaded and the firewall off,
if it's ok, then start the firewall..
did i have to download these modules first or can i just do insmod ?
are they perm or temp installed then ?!


Last edited by supreme2k; 01-26-2004 at 12:52 PM.
 
Old 01-26-2004, 01:02 PM   #8
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 48
They are already to use, just insmod them and you need to add them to your start script, usually before any rules.
 
Old 01-26-2004, 01:12 PM   #9
supreme2k
LQ Newbie
 
Registered: Jan 2004
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by supreme2k
did i have to download these modules first or can i just do insmod ?
are they perm or temp installed then ?!
so there arent permanent i have to put them at rc5 or so to boot up...

is it ok to just add insmod <name> or fully path ?
 
Old 01-26-2004, 01:23 PM   #10
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 48
Put them into the beginning of your iptables script...
Mine are in /etc/init.d/iptables...

]# cat /etc/init.d/iptables
#!/bin/sh
#
# iptables Start iptables firewall
#
# chkconfig: 2345 08 92
# description: Starts, stops and saves iptables firewall
#
# config: /etc/sysconfig/iptables
# config: /etc/sysconfig/iptables-config

# Source function library.
. /etc/init.d/functions

IPTABLES=iptables
IPTABLES_DATA=/etc/sysconfig/$IPTABLES
IPTABLES_CONFIG=/etc/sysconfig/${IPTABLES}-config
IPV=${IPTABLES%tables} # ip for ipv4 | ip6 for ipv6
PROC_IPTABLES_NAMES=/proc/net/${IPV}_tables_names
VAR_SUBSYS_IPTABLES=/var/lock/subsys/$IPTABLES

if [ ! -x /sbin/$IPTABLES ]; then
echo -n $"/sbin/$IPTABLES does not exist."; warning; echo
exit 0
fi

if lsmod 2>/dev/null | grep -q ipchains ; then
echo -n $"ipchains and $IPTABLES can not be used together."; warning; echo
exit 0
fi

# Default firewall configuration:
IPTABLES_MODULES="ip_conntrack_ftp ip_nat_ftp"
IPTABLES_SAVE_ON_STOP="no"
IPTABLES_SAVE_ON_RESTART="no"
IPTABLES_SAVE_COUNTER="no"
IPTABLES_STATUS_NUMERIC="no"
 
Old 01-27-2004, 08:56 AM   #11
supreme2k
LQ Newbie
 
Registered: Jan 2004
Posts: 7

Original Poster
Rep: Reputation: 0
nope..no insmod was needed. just open the tcp ports and it works brilliant!

thx dude !!
 
  


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
ProFTPd, Redhat 8.0 and passive mode Slasher Linux - Networking 10 05-09-2008 05:08 PM
passive+active connections and fxp+glftpd NonSumPisces Linux - Newbie 0 08-27-2004 02:39 PM
yet another glftpd/passive/iptables question ratty007 Linux - Networking 0 01-26-2004 06:54 PM
ftp passive mode ? lenlutz Linux - Networking 1 11-05-2003 02:11 PM
kermit in passive mode? bbeers Linux - Software 1 08-23-2002 08:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:38 AM.

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