telman
asked on
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
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
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
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
ASKER
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
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
ASKER
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]
-------------------------- ---------- --------
--------------------------
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]
--------------------------
Did loading ip_connetrack_ftp solve the problem? I'm not an ip tables expert, so I can't offer much more help.
ASKER
Chris,
Also I assumed I should be making changes on the server side firewall. right?
Telman
Also I assumed I should be making changes on the server side firewall. right?
Telman
On both sides.
ASKER
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
-----------
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
ASKER
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I just increased points. Thanks again.
Telman
Telman
Glad I could help. Thanks.
ASKER
Thanks,
Telman