Solved

FTP server and client behind firewall

Posted on 2003-11-18
12
3,400 Views
Last Modified: 2010-04-22
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
0
Comment
Question by:telman
  • 7
  • 5
12 Comments
 
LVL 1

Author Comment

by:telman
ID: 9774761
I did not mention that both firewalls has port 20 open.

Thanks,

Telman
0
 
LVL 14

Expert Comment

by:chris_calabrese
ID: 9780077
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
 
LVL 1

Author Comment

by:telman
ID: 9780987
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
 
LVL 1

Author Comment

by:telman
ID: 9781106
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
 
LVL 14

Expert Comment

by:chris_calabrese
ID: 9781144
Did loading ip_connetrack_ftp solve the problem? I'm not an ip tables expert, so I can't offer much more help.
0
 
LVL 1

Author Comment

by:telman
ID: 9781171
Chris,

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

Telman
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 14

Expert Comment

by:chris_calabrese
ID: 9781186
On both sides.
0
 
LVL 1

Author Comment

by:telman
ID: 9781217
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
 
LVL 1

Author Comment

by:telman
ID: 9781424
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
 
LVL 14

Accepted Solution

by:
chris_calabrese earned 300 total points
ID: 9781939
Most clients will have outbound setup already. If not, they may have to make changes.
0
 
LVL 1

Author Comment

by:telman
ID: 9781999
I just increased points. Thanks again.

Telman
0
 
LVL 14

Expert Comment

by:chris_calabrese
ID: 9782122
Glad I could help. Thanks.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

​Being a Managed Services Provider (MSP) has presented you  with challenges in the past— and by meeting those challenges you’ve reaped the rewards of success.  In 2014, challenges and rewards remain; but as the Internet and business environment evol…
Hello EE, Today we will learn how to send all your network traffic through Tor which is useful to get around censorship and being tracked all together to a certain degree. This article assumes you will be using Linux, have a minimal knowledge of …
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now