-1
我想配置我的防火牆後面的pureftpd作爲一個被動的ftp/TLS服務器。 代理機:PureFtpd被動端口範圍不提供監聽地址給客戶端
- 服務器:192.168.3.220(內網,默認路由到192.168.3.1路由器) 配置:pureftpd與PassivePorts 64000 64300,MasqueradeAddress ww.xx.yy.zz(這個人是配置在路由器上)
- 路由器:內部:192.168.3.1,DNAT規則(PREROUTING鏈)ww.xx.yy.zz tcp/21,64000:64300 NAT到地址192.168.3.220,FORWARD鏈接受這些數據包雙向。
- 客戶端1:有固定的公網IP外部服務器
- 客戶機2:轉換後的機器的地方 - 192.168.5.x網絡
Scenario1上:
- Client1: connect OK, login OK, command 'ls':
gets OK, after PASV:
---> PASV
GNUTLS: REC[0x28ecce0]: Sending Packet[9] Application Data(23) with length: 6
GNUTLS: REC[0x28ecce0]: Sent Packet[10] Application Data(23) with length: 37
GNUTLS: ASSERT: gnutls_buffers.c:322
GNUTLS: ASSERT: gnutls_buffers.c:322
GNUTLS: REC[0x28ecce0]: Expected Packet[9] Application Data(23) with length: 65536
GNUTLS: REC[0x28ecce0]: Received Packet[9] Application Data(23) with length: 64
GNUTLS: REC[0x28ecce0]: Decrypted Packet[9] Application Data(23) with length: 31
<--- 200 Protection set to Private
---> LIST
---> ABOR
有趣的事情:227服務器,我從pureftpd的偏執日誌中看到,我沒有在客戶端看到 - 只有200 Protection設置爲Private ...等待cca 30秒並使用ACTIVE(!!)模式重新連接 - > ls
Scenario2:
- using Client2 (sorry for czech locales):
---> USER xxxxxx
<--- 331 Password required for xxxxxx
---> PASS XXXX
<--- 230 User xxxxxx logged in
---> PWD
<--- 230 Ls oi a:2013-01-03 21:19:00
---> PBSZ 0
<--- 257 "/" is the current directory
---> PROT P
<--- 200 PBSZ 0 successful
---> PASV
<--- 200 Protection set to Private
---> LIST
---> ABOR
---- Přerušený datový socket bude uzavřen (means closing data socket)
---- Řídicí socket bude uzavřen (means closing control socket)
---- Pasivní režim bude vypnut (means Passive will be turned off)
---- dns cache hit
---- Navazuje se spojení na ftp1.xxxxxxxxx.cz (ww.xx.yy.zz) port 21
<--- 220 ww.xx.yy.zz FTP server ready
...的NAT機器上
---> USER xxxxxx
<--- 331 Password required for xxxxxx
---> PASS XXXX
<--- 230 User xxxxxx logged in
---> PWD
<--- 230 Ls oi a:2013-01-03 21:19:22
---> PBSZ 0
<--- 257 "/" is the current directory
---> PROT P
<--- 200 PBSZ 0 successful
---> PORT 192,168,5,xx,185,136
<--- 200 Protection set to Private
---> LIST
<--- 500 Illegal PORT command
---- Closing data socket
---> QUIT
ls: Nepřekonatelná chyba: 500 Illegal PORT command
<--- 425 Unable to build data connection: Connection refused
的iptables不增加端口64000我的會計櫃檯:64300,所以我希望有再沒被動連接在所有。
可能還有一條評論:路由器的WAN接口上有更多的IP地址。在情景1中,當活動連接起作用時,它不是來自ww.xx.yy.zz:20,而是aa.bb.cc.dd:45678(僞裝成一個)。這可以通過防火牆上的SNAT規則修復,SNATting從192.168.3.220到ww.xx.yy.zz的數據包,但不應影響被動連接。對?謝謝你的提示。 – tloudev