我已经使用vsftp运行了一段时间的FTP服务,使用被动模式没有任何问题。
我最近使用openvpnbuild立了一个VPN,据我所知,我已经正确地configuration了一切。 我能够使用本地IP等(包括FTP服务器)连接到服务器,并浏览互联网。
出于某种原因,我无法通过VPN使用FTP,我可以连接并login,但当客户端(filezilla)发出LIST时,它会卡住。 我相信这是一个围绕被动的问题,虽然我能够从networking内部的其他服务器(使用被动)连接到FTP。
有没有人有过这个,或有任何想法,我可能已经错过了?
仅供参考使用cent os 6.5的AWS VPC!
谢谢!
FTP日志,欢迎信息,用户名和外部IPreplace为#;
Thu Feb 19 17:03:24 2015 [pid 29762] CONNECT: Client "10.0.0.17" Thu Feb 19 17:03:24 2015 [pid 29762] FTP response: Client "10.0.0.17", "220 Welcome to #############." Thu Feb 19 17:03:24 2015 [pid 29762] FTP command: Client "10.0.0.17", "AUTH TLS" Thu Feb 19 17:03:24 2015 [pid 29762] FTP response: Client "10.0.0.17", "530 Please login with USER and PASS." Thu Feb 19 17:03:24 2015 [pid 29762] FTP command: Client "10.0.0.17", "AUTH SSL" Thu Feb 19 17:03:24 2015 [pid 29762] FTP response: Client "10.0.0.17", "530 Please login with USER and PASS." Thu Feb 19 17:03:24 2015 [pid 29762] FTP command: Client "10.0.0.17", "USER ##############" Thu Feb 19 17:03:24 2015 [pid 29762] [##############] FTP response: Client "10.0.0.17", "331 Please specify the password." Thu Feb 19 17:03:25 2015 [pid 29762] [##############] FTP command: Client "10.0.0.17", "PASS <password>" Thu Feb 19 17:03:25 2015 [pid 29761] [##############] OK LOGIN: Client "10.0.0.17" Thu Feb 19 17:03:25 2015 [pid 29766] [##############] FTP response: Client "10.0.0.17", "230 Login successful." Thu Feb 19 17:03:25 2015 [pid 29766] [##############] FTP command: Client "10.0.0.17", "SYST" Thu Feb 19 17:03:25 2015 [pid 29766] [##############] FTP response: Client "10.0.0.17", "215 UNIX Type: L8" Thu Feb 19 17:03:25 2015 [pid 29766] [##############] FTP command: Client "10.0.0.17", "FEAT" Thu Feb 19 17:03:25 2015 [pid 29766] [##############] FTP response: Client "10.0.0.17", "211-Features:" Thu Feb 19 17:03:25 2015 [pid 29766] [##############] FTP response: Client "10.0.0.17", " EPRT??" Thu Feb 19 17:03:25 2015 [pid 29766] [##############] FTP response: Client "10.0.0.17", " EPSV??" Thu Feb 19 17:03:25 2015 [pid 29766] [##############] FTP response: Client "10.0.0.17", " MDTM??" Thu Feb 19 17:03:25 2015 [pid 29766] [##############] FTP response: Client "10.0.0.17", " PASV??" Thu Feb 19 17:03:25 2015 [pid 29766] [##############] FTP response: Client "10.0.0.17", " REST STREAM??" Thu Feb 19 17:03:25 2015 [pid 29766] [##############] FTP response: Client "10.0.0.17", " SIZE??" Thu Feb 19 17:03:25 2015 [pid 29766] [##############] FTP response: Client "10.0.0.17", " TVFS??" Thu Feb 19 17:03:25 2015 [pid 29766] [##############] FTP response: Client "10.0.0.17", " UTF8??" Thu Feb 19 17:03:25 2015 [pid 29766] [##############] FTP response: Client "10.0.0.17", "211 End" Thu Feb 19 17:03:25 2015 [pid 29766] [##############] FTP command: Client "10.0.0.17", "OPTS UTF8 ON" Thu Feb 19 17:03:25 2015 [pid 29766] [##############] FTP response: Client "10.0.0.17", "200 Always in UTF8 mode." Thu Feb 19 17:03:25 2015 [pid 29766] [##############] FTP command: Client "10.0.0.17", "PWD" Thu Feb 19 17:03:25 2015 [pid 29766] [##############] FTP response: Client "10.0.0.17", "257 "/"" Thu Feb 19 17:03:25 2015 [pid 29766] [##############] FTP command: Client "10.0.0.17", "TYPE I" Thu Feb 19 17:03:25 2015 [pid 29766] [##############] FTP response: Client "10.0.0.17", "200 Switching to Binary mode." Thu Feb 19 17:03:25 2015 [pid 29766] [##############] FTP command: Client "10.0.0.17", "PASV" Thu Feb 19 17:03:25 2015 [pid 29766] [##############] FTP response: Client "10.0.0.17", "227 Entering Passive Mode (#############)." Thu Feb 19 17:03:25 2015 [pid 29766] [##############] FTP command: Client "10.0.0.17", "LIST" Thu Feb 19 17:04:25 2015 [pid 29766] [##############] FTP response: Client "10.0.0.17", "425 Failed to establish connection."
在被动FTP模式下,服务器向客户端发送IP地址和客户端需要连接的端口以打开数据传输连接(用于文件传输和目录列表)。
如果这是一个与实际需要用于连接服务器的IP地址不同的IP地址(例如,由于NATing),则连接将失败。
如果在服务器端networking上发生NAT,FTP服务器应configuration其外部IP地址。
就像在你的情况那样,在客户端networking上发生NAT(如果我理解正确的话),服务器端无法完成更改,因为这会导致所有其他用户中断FTP服务器。
智能NAT将尝试检查FTPstream量并转换PASV响应中的IP地址。 但是,如果FTPstream量被encryption(TLS / SSL),那么这是行不通的,我希望你的情况也是如此!
我所知道的唯一替代解决scheme是强制您的FTP客户端忽略PASV响应中的IP地址,并使用用于连接到FTP服务器的原始IP地址。
例如,使用WinSCP FTP / SFTP客户端,可以通过将被动模式连接的会话选项强制IP地址设置为开 :
https://winscp.net/eng/docs/ui_login_ftp
(我是WinSCP的作者)
还有一种select是使用支持更多现代EPSV命令(而不是PASV )的FTP客户端,因为它允许服务器仅提供端口(不是IP地址),所以它不存在问题。 vsftpd确实支持它。
有关从networkingconfigurationangular度来看FTP被动模式的详细信息,请参阅(我的)文章。