Can't transfer via script with Explicit TLS over FTP

Advertisement

airricks
Guest

Can't transfer via script with Explicit TLS over FTP

I'm trying to create a script that will simply transfer a file to a remote server. The server requires explicit ftp over tls. I'm able to create a connection in the GUI and transfer files fine, however, when I use a script the transfer hangs at 0% and eventually times out.

Successful Transfer in GUI:

. 2013-04-02 15:15:23.579 File: "C:\Mailers\test.zip"
. 2013-04-02 15:15:23.581 Copying "C:\Mailers\test.zip" to remote directory started.
. 2013-04-02 15:15:23.581 Binary transfer mode selected.
. 2013-04-02 15:15:23.581 Starting upload of C:\Mailers\test.zip
> 2013-04-02 15:15:23.581 TYPE I
< 2013-04-02 15:15:23.651 200 Type set to I.
> 2013-04-02 15:15:23.651 PASV
< 2013-04-02 15:15:23.735 227 Entering Passive Mode (172,16,1,10,117,48)
. 2013-04-02 15:15:23.735 Using host address x.x.x.x instead of the one suggested by the server: x.x.x.x
> 2013-04-02 15:15:23.735 STOR test.zip
< 2013-04-02 15:15:23.849 150 Opening BINARY mode data connection for test.zip.
. 2013-04-02 15:15:23.901 SSL connection established
< 2013-04-02 15:15:23.972 226 Transfer complete.
. 2013-04-02 15:15:23.972 Upload successful
. 2013-04-02 15:15:23.974 Retrieving directory listing...
> 2013-04-02 15:15:23.974 TYPE A
< 2013-04-02 15:15:24.081 200 Type set to A.
> 2013-04-02 15:15:24.082 PASV
< 2013-04-02 15:15:24.146 227 Entering Passive Mode (172,16,1,10,117,49)
. 2013-04-02 15:15:24.146 Using host address x.x.x.x instead of the one suggested by the server: x.x.x.x
> 2013-04-02 15:15:24.146 MLSD
< 2013-04-02 15:15:24.412 150 Opening BINARY mode data connection for MLSD.
. 2013-04-02 15:15:24.557 SSL connection established
< 2013-04-02 15:15:24.643 226 Transfer complete.
. 2013-04-02 15:15:24.777 Type=cdir;Modify=20130402191522;Win32.ea=0x00000010; /
. 2013-04-02 15:15:24.777 Type=dir;Modify=20130401155921;Win32.ea=0x00000010; pickup
. 2013-04-02 15:15:24.777 Type=file;Size=118;Modify=20130402191523;Win32.ea=0x00000020; test.zip
. 2013-04-02 15:15:24.777 Directory listing successful
. 2013-04-02 15:15:28.450 Disconnected from server

Failed via script:

. 2013-04-02 15:16:17.766 File: "test.zip"
. 2013-04-02 15:16:17.766 Copying "test.zip" to remote directory started.
. 2013-04-02 15:16:17.766 Binary transfer mode selected.
. 2013-04-02 15:16:17.766 Starting upload of test.zip
> 2013-04-02 15:16:17.766 TYPE A
< 2013-04-02 15:16:17.840 200 Type set to A.
> 2013-04-02 15:16:17.840 PASV
< 2013-04-02 15:16:17.907 227 Entering Passive Mode (172,16,1,10,117,50)
> 2013-04-02 15:16:17.908 MLSD
. 2013-04-02 15:16:38.912 Transfer channel can't be opened. Reason: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
. 2013-04-02 15:17:08.255 Timeout detected.
. 2013-04-02 15:17:08.255 Copying files to remote side failed.
. 2013-04-02 15:17:08.255 Connection was lost, asking what to do.

Here's the script:

option confirm off
open ftps://user:pass@server:21 -explicittls -passive=on -rawsettings FtpForcePasvIp=1 -certificate="certificate" -timeout=30
lcd "c:\Mailers\"
option transfer binary
put test.zip /
close

Any help would be appreciated!

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: Can't transfer via script with Explicit TLS over FTP

By setting FtpForcePasvIp=1 you prevent WinSCP from correctly wrong IP address sent by the server. See the "Using host address x.x.x.x instead of the one suggested by the server: x.x.x.x" in GUI log.
See also https://winscp.net/eng/docs/rawsettings for values of FtpForcePasvIp

Reply with quote

Advertisement

You can post new topics in this forum