设为首页 收藏本站
查看: 1049|回复: 0

[经验分享] SSL FTP through the firewall using FileZilla

[复制链接]

尚未签到

发表于 2016-6-9 08:25:00 | 显示全部楼层 |阅读模式
SSL FTP through the firewall using FileZilla
I've confirmed that the firewall is the issue here. I can make the SSL FTP connection, but when FileZilla tries to do a directory listing, it's blocked because that (random) port isn't open. When I try the connection behind the firewall, everything's hunky dory.

Has anyone else experienced this, and if you did, were you able to get past it?
******************************************************************************

Normally, FTP control connection is on port 21. Though, there's another port that's sometimes used for SSL FTP. (but, not always!)

In active FTP, the "origin" (or "source") port number for data connections should always be 20 -- so if that's allowed through your firewall, you should be okay.

Unfortunately, many people will read my previous statement and assume that I mean something different from what I just said. Whenever you make a TCP connection (regardless of what application protocol you're using) there's always TWO ports involved. There's the origin port (the port used by the program that's originating the connection) and the destination port (the port that it's connecting to.)

Normally, we don't give much thought to the origin port. Usually, the firewalls are configured according to the destination port. That would be port 21 for FTP control channel, port 23 for telnet, port 80 for HTTP, etc. These are the well-known port numbers. Normally the origin port is selected by the operating system at random, and it's not used, certainly never used in a firewall configuration.

However, FTP is one exception. FTP's data channels, when in ACTIVE mode, will always have an ORIGIN of 20, and use a random port for the destiantion. That's backwards of the way everything else works! But, you SHOULD be able to configure your firewall so that anything that's going FROM port 20 on the Internet, to a random port on your network is allowed. (As opposed to the normal circumstance of FROM a random port on your network TO a fixed port on the Internet )

Unfortunately, I only know for sure that plain-text FTP works that way, I don't know for sure that SSL FTP works that way, but I would assume so. (You should be able to tell by looking at the connection statuses)

The more common alternative (which I already suggested) is to allow ALL outgoing connections from your network, but only block incoming ones. In that scenario, passive mode will work just fine.

Note that if you're using NAT, the passive mode solution will work, but the active mode (port 20) solution WON'T because NAT will re-map the IP addresses and ports, which will confuse FTP. A good NAT implementation will sniff the packets looking for the port number being sent, and will change it in the TCP packets as well, but this doesn't work with SSL because of the encryption.

So if you're using NAT, you'll want to use passive mode, and allow all outgoing connections from your firewall.

I guess the final alternative is to figure out the range of ephemeral ports that IBM uses in their FTP software, and open them all through your firewall. I know that FreeBSD (a free variant of Unix, much like Linux) lets you control what the ephemeral port range is -- but as far as I know, IBM doesn't let you control that in i5/OS, nor do they tell you what the range is. So that's hard to work with.

This is one reason why so many people use SSH or HTTP instead of FTP/SSL for sending secure documents. This port number business really messes up firewalls.

******************************************************************************
You might also be interested in the following APAR from IBM:

Abstract
FTP Clear Command Channel

Error Description
With the support of FTP using SSL/TLS, a NAT firewall can no   
longer look at/change the information passed on an FTP control  
connection.                                                   

Problem Summary
With the support of FTP using SSL/TLS, a NAT firewall can no   
longer look at/change the information passed on an FTP control  
connection.                                                   

Problem Conclusion
FTP client subcommand CCC                                      
                                                               
FTP supports two kinds of transmission modes: the clear text   
mode and the encrypted mode. If you use the clear text mode in  
an FTP control connection, you take the risk of exposing your  
sensitive information to an intruder. If you use the encrypted  
mode, the firewall is not able to monitor or change the        
information sent within the FTP control connection. Thus the   
firewall cannot perform some functions such as network address  
translation.                                                   
                                                               
The Clear Command Channel (CCC) subcommand changes the         
transmission mode in a control connection from the encrypted   
mode to the clear text mode. Thus, you can secure sensitive   
information including your user name and password by sending   
them in the encrypted mode in the control connection. Then you  
can use the CCC subcommand to change to clear text mode to      
send the port and IP information.                              
                                                               
Note: After using the CCC subcommand, you will send all your   
information in the clear text mode in the control connection.  
If the names of files or directories on your system contain   
sensitive information, be aware that any names sent on the      
control connection after running the CCC subcommand are not   
protected. However, the data connection transmission mode      
remains intact and the data transfer that happens afterward is  
still secure.                                                  
                                                               
Customers can either allow or disallow an individual user to use
                                                               
CCC by granting the private authority to                        
QIBM_QTMF_CLIENT_REQ_10                                       
via the CHGFCNUSG command or via iSeries Navigator Application  
Administration support.                                       
                                                               
For example:                                                   
CHGFCNUSG FCNID(QIBM_QTMF_CLIENT_10) USER(user) USAGE(*ALLOWED)
                                                               
FTP Server Subcommand CCC                                      
                                                               
When FTP server receives a Clear Command Channel (CCC)         
subcommand,                                                   
it first checks whether or not the current user has the        
authority                                                      
to perform the CCC command. If the user has the authority, it  
then                                                            
accepts the command by sending a confirm message back to the FTP
                                                               
client                                                         
side, then the FTP server changes the transmission mode in a   
control                                                        
connection from the encrypted mode to the clear text mode.      
                                                               
The Clear Command Channel (CCC) subcommand changes the         
transmission mode                                             
in a control connection from the encrypted mode to the clear   
text mode.                                                      
Thus, you can secure sensitive information including your user  
name and                                                        
password by sending them in the encrypted mode in the control  
connection.                                                   
Then you can use the CCC subcommand to change to the clear text
                                                               
mode and                                                        
send the port and IP information.                              
                                                               
Security Concerns:                                             
                                                               
Note that there are potential security/integrity exposures with
                                                               
using the CCC approach as compared to full encryption of the   
control                                                        
connection.                                                   
                                                               
First, this results in file and directory names on the FTP      
server to be subject to interception. It is possible that such  
names                                                         
themselves could contain sensitive or confidential information.
                                                               
Second, IP address/port information transferred on the control  
connection is subject to interception by hackers.              
                                                               
Finally, some other "direct" TCP attacks on an FTP server, or  
using an FTP server to attack other systems, are completely   
eliminated when a secure control connection                    
is used. Some of those are now again possible when the         
control connection                                             
reverts to "clear" mode.                                       
                                                               
Because of these concerns, usage of the CCC subcommand is      
controlled using the i5/OS Function Usage interface, and the   
default setting for                                            
CCC is *DENIED for the FTP server.                              
                                                               
To allow an individual user logged into the FTP server to use  
the CCC subcommand for ending protection of the control        
connection, give *ALLOWED                                      
usage to the QIBM_QTMF_SERVER_REQ_10 function via the CHGFCNUSG
                                                               
command or                                                      
iSeries Navigator Application Administration support. For      
example:                                                        
                                                               
CHGFCNUSG FCNID(QIBM_QTMF_SERVER_REQ_10)  USER(user)            
USAGE(*ALLOWED)                                                
                                                               
To allow all users to perform this function, change the default
                                                               
authority of this function to *ALLOWED.                        
                                                               
RFC 4217 Securing FTP with TLS, talks about Clear Command      
Channel.     


It discusses the CCC FTP Command that can be used to disable encryption so that NAT can see the port numbers and adjust them accordingly. (With the obvious drawback that encryption has been turned off, and therefore the filenames and stuff like that are visible unencrypted).

It provides a PTF for V5R4 that enables this CCC command -- which isn't available in i5/OS, otherwise.

(Though, since you're using FileZilla, you might look to see if FileZilla already supports CCC)
Reply With Quote

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-228030-1-1.html 上篇帖子: FTP系列:(三)vsftp安装包安装 下篇帖子: Java的ftp上传下载工具
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表