FTP server and client behind firewall

Dear Experts,

I have finished setting up firewall for our DMZ. I placed first windows server behind the firewall for testing. I can access all ports on the firewall and ports which are being forwarded to my DMZ. I can access to FTP server on windows server too,  when client computer is behind firewall it will connect but fail with the following error messages:

257 "/username" is current directory.
SYST
215 Windows_NT
Host type (S): Microsoft NT
PORT xxx,xxx,xx,x,10,60
200 PORT command successful.
LIST
150 Opening ASCII mode data connection for /bin/ls.
! Timer cancelled blocking call
! Accept error: Blocking call cancelled
! Retrieve of folder listing failed (0)

Please note I have tried enabling and disabling passive transfers. The same time client server can connect servers on unprotected network.

I am using Linux and iptables to protect my network.

Please advise.

Thanks a lot!

Telman
LVL 1
telmanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

telmanAuthor Commented:
I did not mention that both firewalls has port 20 open.

Thanks,

Telman
0
chris_calabreseCommented:
FTP uses port 20 for the "control" connection, but negotiates other ports for the "data" connections. Thus, opening port 20 allows the control connection, but not the data transfers (including the directory listing).

Using passive mode will solve the problem if only the "client" side has a firewall (and it allows all outbound TCP connections), but not if the "server" side also has a firewall.

You need to specifically tell the iptables rules that you're running FTP, rather than just opening port 20.

There is a good explanation of how to do this at http://www.sns.ias.edu/~jns/security/iptables/iptables_conntrack.html
0
telmanAuthor Commented:
Hi Chris,
Thanks for the info.

Acording to lsmod I have the following modules loaded.
The url you sent me explains that I should have "ip_conntrack_ftp" module loaded and the following rule set up
iptables -A INPUT     -p tcp --sport 1024: --dport 1024:  -m state --state ESTABLISHED -j ACCEPT
I do have similar rule.  
$IPTABLES -A FORWARD -i $EXTERNAL_INTERFACE -o $DMZ_INTERFACE -m state --state ESTABLISHED,RELATED -j ACCEPT
I guess my problem is ip_conntrack_ftp not loaded? Is that correct?

---------------------------------------------
Module                  Size  Used by    Not tainted
ip_conntrack_ftp        5232   0  (unused)
parport_pc             19076   1  (autoclean)
lp                      9028   0  (autoclean)
parport                37088   1  (autoclean) [parport_pc lp]
autofs                 13364   0  (autoclean) (unused)
8139too                18056   1
mii                     3976   0  [8139too]
crc32                   3712   0  [8139too]
3c59x                  30928   1
ipt_LOG                 4248   4  (autoclean)
ipt_limit               1560   2  (autoclean)
ipt_state               1080   2  (autoclean)
ip_conntrack           27304   2  (autoclean) [ip_conntrack_ftp ipt_state]
iptable_filter          2412   1  (autoclean)
ip_tables              15776   4  [ipt_LOG ipt_limit ipt_state iptable_filter]
floppy                 58160   0  (autoclean)
microcode               4724   0  (autoclean)
keybdev                 2976   0  (unused)
mousedev                5524   0  (unused)
hid                    22212   0  (unused)
input                   5888   0  [keybdev mousedev hid]
ehci-hcd               20104   0  (unused)
usb-uhci               26412   0  (unused)
usbcore                79392   1  [hid ehci-hcd usb-uhci]
ext3                   91592   2
jbd                    52336   2  [ext3]
---------------------------------------------

Thanks,

Telman
0
How do you know if your security is working?

Protecting your business doesn’t have to mean sifting through endless alerts and notifications. With WatchGuard Total Security Suite, you can feel confident that your business is secure, meaning you can get back to the things that have been sitting on your to-do list.

telmanAuthor Commented:
I maid few changes. Here is the updates info
-------------------------------------------------
Module                  Size  Used by    Not tainted
parport_pc             19076   1  (autoclean)
lp                      9028   0  (autoclean)
parport                37088   1  (autoclean) [parport_pc lp]
autofs                 13364   0  (autoclean) (unused)
8139too                18056   1
mii                     3976   0  [8139too]
crc32                   3712   0  [8139too]
3c59x                  30928   1
ipt_LOG                 4248   4  (autoclean)
ipt_limit               1560   2  (autoclean)
ipt_state               1080   2  (autoclean)
ip_conntrack_ftp        5232   0  (autoclean) (unused)
ip_conntrack           27304   2  (autoclean) [ipt_state ip_conntrack_ftp]
iptable_filter          2412   1  (autoclean)
ip_tables              15776   4  [ipt_LOG ipt_limit ipt_state iptable_filter]
floppy                 58160   0  (autoclean)
microcode               4724   0  (autoclean)
keybdev                 2976   0  (unused)
mousedev                5524   0  (unused)
hid                    22212   0  (unused)
input                   5888   0  [keybdev mousedev hid]
ehci-hcd               20104   0  (unused)
usb-uhci               26412   0  (unused)
usbcore                79392   1  [hid ehci-hcd usb-uhci]
ext3                   91592   2
jbd                    52336   2  [ext3]
--------------------------------------------
0
chris_calabreseCommented:
Did loading ip_connetrack_ftp solve the problem? I'm not an ip tables expert, so I can't offer much more help.
0
telmanAuthor Commented:
Chris,

Also I assumed I should be making changes on the server side firewall. right?

Telman
0
chris_calabreseCommented:
On both sides.
0
telmanAuthor Commented:
It still fails. I  did not make any changes to the client side firewall. Since I will not be able to change firewall setting for all users. They may have own firewall which we do not control.

-----------
connecting to xxx.xxx.xxx.xxx:21
Connected to xxx.xxx.xxx.xxx port 21
220 Microsoft FTP Service
USER xxxxxxx
331 Password required for xxxxxxxx.230 User xxxxxxx logged in.
PWD
257 "/xxxxxxx" is current directory.
SYST
215 Windows_NT
Host type (S): Microsoft NT
PORT xxxx,xxx,xxx,xxxx,136
200 PORT command successful.
PASS (hidden)

LIST
150 Opening ASCII mode data connection for /bin/ls.
! Timer cancelled blocking call
! Accept error: Blocking call cancelled
! Retrieve of folder listing failed (0)


Thanks.

Telman
0
telmanAuthor Commented:
It worked just fine!!!

Thanks a lot! Do you think if client has any other firewall it will work with out any changes? or they should make changes.

Telman
0
chris_calabreseCommented:
Most clients will have outbound setup already. If not, they may have to make changes.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
telmanAuthor Commented:
I just increased points. Thanks again.

Telman
0
chris_calabreseCommented:
Glad I could help. Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Security

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.