liximomo / vscode-sftp

Super fast sftp/ftp extension for VS Code
MIT License
1.5k stars 261 forks source link

FTPS not working #499

Open trashbytes opened 5 years ago

trashbytes commented 5 years ago

Do you read the FAQ?

Describe the bug FTPS does not work, although it should be supported since February 2nd of last year as stated here: Issue 41

To Reproduce Steps to reproduce the behavior:

  1. set protocol to FTPS (warning)
  2. try to upload a file (error: protocol not supported)
  3. set protocol to FTP (no warning)
  4. try to upload a file again (error: must use encryption)

Expected behavior FTPS should work without errors.

Desktop (please complete the following information):

Extension Logs from Startup - required

Protocol set to ftps:

[debug] register command "Config" from "./commandConfig.ts"
[debug] register command "List Active Folder" from "./commandListActiveFolder.ts"
[debug] register command "Open Ssh Connection" from "./commandOpenSshConnection.ts"
[debug] register command "Set Profile" from "./commandSetProfile.ts"
[debug] register command "Toggle Output Panel" from "./commandToggleOutputPanel.ts"
[debug] register command "Upload Changed Files" from "./commandUploadChangedFiles.ts"
[debug] register command "Delete Remote" from "./fileCommandDeleteRemote.ts"
[debug] register command "Diff" from "./fileCommandDiff.ts"
[debug] register command "Diff Active File" from "./fileCommandDiffActiveFile.ts"
[debug] register command "Download" from "./fileCommandDownload.ts"
[debug] register command "Download Active File" from "./fileCommandDownloadActiveFile.ts"
[debug] register command "Download Active Folder" from "./fileCommandDownloadActiveFolder.ts"
[debug] register command "Download File" from "./fileCommandDownloadFile.ts"
[debug] register command "Download Folder" from "./fileCommandDownloadFolder.ts"
[debug] register command "Download Force" from "./fileCommandDownloadForce.ts"
[debug] register command "Download Project" from "./fileCommandDownloadProject.ts"
[debug] register command "Edit In Local" from "./fileCommandEditInLocal.ts"
[debug] register command "List" from "./fileCommandList.ts"
[debug] register command "List All" from "./fileCommandListAll.ts"
[debug] register command "Reveal In Explorer" from "./fileCommandRevealInExplorer.ts"
[debug] register command "Reveal In Remote Explorer" from "./fileCommandRevealInRemoteExplorer.ts"
[debug] register command "Sync Both Directions" from "./fileCommandSyncBothDirections.ts"
[debug] register command "Sync Local To Remote" from "./fileCommandSyncLocalToRemote.ts"
[debug] register command "Sync Remote To Local" from "./fileCommandSyncRemoteToLocal.ts"
[debug] register command "Upload" from "./fileCommandUpload.ts"
[debug] register command "Upload Active File" from "./fileCommandUploadActiveFile.ts"
[debug] register command "Upload Active Folder" from "./fileCommandUploadActiveFolder.ts"
[debug] register command "Upload File" from "./fileCommandUploadFile.ts"
[debug] register command "Upload Folder" from "./fileCommandUploadFolder.ts"
[debug] register command "Upload Force" from "./fileCommandUploadForce.ts"
[debug] register command "Upload Project" from "./fileCommandUploadProject.ts"
[info] config at d:\Documents\experia\demo {"remotePath":"/","uploadOnSave":false,"downloadOnOpen":false,"ignore":[],"concurrency":4,"protocol":"ftps","connectTimeout":10000,"interactiveAuth":false,"secure":false,"remoteTimeOffsetInHours":0,"name":"demo","host":"demo.experia.eu","port":115,"username":"******","password":"******","encryption":true}
[trace] run command 'Upload File'
[error] Error: Config validation fail: prop "protocol" fails because ["protocol" must be one of [sftp, ftp, local]].
    at module.exports.t.default.getConfig (C:\Users\Tobi\.vscode\extensions\liximomo.sftp-1.9.5\dist\extension.js:70:64343)
    at Object.u [as handleCtxFromUri] (C:\Users\Tobi\.vscode\extensions\liximomo.sftp-1.9.5\dist\extension.js:1:41708)
    at module.exports.t.createFileCommand.<anonymous> (C:\Users\Tobi\.vscode\extensions\liximomo.sftp-1.9.5\dist\extension.js:1:4045)
    at Generator.next (<anonymous>)
    at module.exports.r (C:\Users\Tobi\.vscode\extensions\liximomo.sftp-1.9.5\dist\extension.js:1:3325)
    at new Promise (<anonymous>)
    at module.exports.r (C:\Users\Tobi\.vscode\extensions\liximomo.sftp-1.9.5\dist\extension.js:1:3102)
    at module.exports.t.createFileCommand.doCommandRun.a.map.t (C:\Users\Tobi\.vscode\extensions\liximomo.sftp-1.9.5\dist\extension.js:1:3987)
    at Array.map (<anonymous>)
    at module.exports.t.createFileCommand.<anonymous> (C:\Users\Tobi\.vscode\extensions\liximomo.sftp-1.9.5\dist\extension.js:1:3980)
    at Generator.next (<anonymous>)
    at s (C:\Users\Tobi\.vscode\extensions\liximomo.sftp-1.9.5\dist\extension.js:1:3158)

Protocol set to ftp:

[debug] register command "Config" from "./commandConfig.ts"
[debug] register command "List Active Folder" from "./commandListActiveFolder.ts"
[debug] register command "Open Ssh Connection" from "./commandOpenSshConnection.ts"
[debug] register command "Set Profile" from "./commandSetProfile.ts"
[debug] register command "Toggle Output Panel" from "./commandToggleOutputPanel.ts"
[debug] register command "Upload Changed Files" from "./commandUploadChangedFiles.ts"
[debug] register command "Delete Remote" from "./fileCommandDeleteRemote.ts"
[debug] register command "Diff" from "./fileCommandDiff.ts"
[debug] register command "Diff Active File" from "./fileCommandDiffActiveFile.ts"
[debug] register command "Download" from "./fileCommandDownload.ts"
[debug] register command "Download Active File" from "./fileCommandDownloadActiveFile.ts"
[debug] register command "Download Active Folder" from "./fileCommandDownloadActiveFolder.ts"
[debug] register command "Download File" from "./fileCommandDownloadFile.ts"
[debug] register command "Download Folder" from "./fileCommandDownloadFolder.ts"
[debug] register command "Download Force" from "./fileCommandDownloadForce.ts"
[debug] register command "Download Project" from "./fileCommandDownloadProject.ts"
[debug] register command "Edit In Local" from "./fileCommandEditInLocal.ts"
[debug] register command "List" from "./fileCommandList.ts"
[debug] register command "List All" from "./fileCommandListAll.ts"
[debug] register command "Reveal In Explorer" from "./fileCommandRevealInExplorer.ts"
[debug] register command "Reveal In Remote Explorer" from "./fileCommandRevealInRemoteExplorer.ts"
[debug] register command "Sync Both Directions" from "./fileCommandSyncBothDirections.ts"
[debug] register command "Sync Local To Remote" from "./fileCommandSyncLocalToRemote.ts"
[debug] register command "Sync Remote To Local" from "./fileCommandSyncRemoteToLocal.ts"
[debug] register command "Upload" from "./fileCommandUpload.ts"
[debug] register command "Upload Active File" from "./fileCommandUploadActiveFile.ts"
[debug] register command "Upload Active Folder" from "./fileCommandUploadActiveFolder.ts"
[debug] register command "Upload File" from "./fileCommandUploadFile.ts"
[debug] register command "Upload Folder" from "./fileCommandUploadFolder.ts"
[debug] register command "Upload Force" from "./fileCommandUploadForce.ts"
[debug] register command "Upload Project" from "./fileCommandUploadProject.ts"
[info] config at d:\Documents\experia\demo {"remotePath":"/","uploadOnSave":false,"downloadOnOpen":false,"ignore":[],"concurrency":4,"protocol":"ftp","connectTimeout":10000,"interactiveAuth":false,"secure":false,"remoteTimeOffsetInHours":0,"name":"demo","host":"demo.experia.eu","port":115,"username":"******","password":"******","encryption":true}
[trace] run command 'Upload File'
[trace] handle upload file for d:\Documents\experia\demo\website\themes\kits\scss\_custom.scss
[debug] < '220 Monitored experia FTP service.\r\n'
[debug] > USER demo
[debug] < '530 Non-anonymous sessions must use encryption.\r\n'
[error] Error: Non-anonymous sessions must use encryption.
    at v (C:\Users\Tobi\.vscode\extensions\liximomo.sftp-1.9.5\dist\extension.js:70:110272)
    at d.<anonymous> (C:\Users\Tobi\.vscode\extensions\liximomo.sftp-1.9.5\dist\extension.js:70:110995)
    at d.emit (events.js:182:13)
    at d.module.exports.d._write (C:\Users\Tobi\.vscode\extensions\liximomo.sftp-1.9.5\dist\extension.js:70:123817)
    at doWrite (_stream_writable.js:410:12)
    at writeOrBuffer (_stream_writable.js:394:5)
    at d.Writable.write (_stream_writable.js:294:11)
    at Socket.p (C:\Users\Tobi\.vscode\extensions\liximomo.sftp-1.9.5\dist\extension.js:70:113366)
    at Socket.emit (events.js:182:13)
    at addChunk (_stream_readable.js:279:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at Socket.Readable.push (_stream_readable.js:219:10)
    at TCP.onread (net.js:636:20)
liximomo commented 5 years ago

https://github.com/liximomo/vscode-sftp/wiki/config#secure

trashbytes commented 5 years ago

Thanks, I still get errors.

To get around "unable to verify first certificate" I've disabled rejectUnauthorized in secureOptions.

With secure set to true I'm stuck at

[info] config at d:\Documents\experia\demo {"remotePath":"/","uploadOnSave":false,"downloadOnOpen":false,"ignore":[],"concurrency":4,"protocol":"ftp","connectTimeout":10000,"interactiveAuth":false,"secure":true,"remoteTimeOffsetInHours":0,"name":"demo","host":"demo.experia.eu","port":115,"username":"******","password":"******","secureOptions":{"rejectUnauthorized":false}}
[trace] run command 'Diff'
[trace] handle diff for d:\Documents\experia\demo\website\themes\kits\scss\_custom.scss
[debug] < '220 Monitored experia FTP service.\r\n'
[debug] > AUTH TLS
[debug] < '234 Proceed with negotiation.\r\n'
[debug] > PBSZ 0
[debug] < '200 PBSZ set to 0.\r\n'
[debug] > PROT P
[debug] < '200 PROT now Private.\r\n'
[debug] > USER demo
[debug] < '331 Please specify the password.\r\n'
[debug] > PASS ******
[debug] < '230 Login successful.\r\n'
[debug] > FEAT
[debug] < '211-Features:\r\n'
[debug] < ' AUTH TLS\r\n'
[debug] < ' UTF8\r\n'
[debug] < ' EPRT\r\n'
[debug] < ' EPSV\r\n'
[debug] < ' MDTM\r\n'
[debug] < ' PASV\r\n'
[debug] < ' PBSZ\r\n'
[debug] < ' PROT\r\n'
[debug] < ' REST STREAM\r\n'
[debug] < ' SIZE\r\n'
[debug] < ' TVFS\r\n'
[debug] < '211 End\r\n'
[debug] > TYPE I
[debug] < '200 Switching to Binary mode.\r\n'
[debug] > PASV
[debug] < '227 Entering Passive Mode (85,237,88,214,156,150).\r\n'
[debug] > RETR /website/themes/kits/scss/_custom.scss
[debug] < '150 Opening BINARY mode data connection for /website/themes/kits/scss/_custom.scss (8216 bytes).\r\n'

With secure set to implicit:

[info] config at d:\Documents\experia\demo {"remotePath":"/","uploadOnSave":false,"downloadOnOpen":false,"ignore":[],"concurrency":4,"protocol":"ftp","connectTimeout":10000,"interactiveAuth":false,"secure":"implicit","remoteTimeOffsetInHours":0,"name":"demo","host":"demo.experia.eu","port":115,"username":"******","password":"******","secureOptions":{"rejectUnauthorized":false}}
[trace] run command 'Diff'
[trace] handle diff for d:\Documents\experia\demo\website\themes\kits\scss\_custom.scss
[error] Error: Timeout while connecting to server
    at Timeout.module.exports.t.default._doConnect.setTimeout [as _onTimeout] (C:\Users\Tobi\.vscode\extensions\liximomo.sftp-1.10.0\dist\extension.js:70:109185)
    at ontimeout (timers.js:427:11)
    at tryOnTimeout (timers.js:289:5)
    at listOnTimeout (timers.js:252:5)
    at Timer.processTimers (timers.js:212:10) 

and with it set to control:

[info] config at d:\Documents\experia\demo {"remotePath":"/","uploadOnSave":false,"downloadOnOpen":false,"ignore":[],"concurrency":4,"protocol":"ftp","connectTimeout":10000,"interactiveAuth":false,"secure":"control","remoteTimeOffsetInHours":0,"name":"demo","host":"demo.experia.eu","port":115,"username":"******","password":"******","secureOptions":{"rejectUnauthorized":false}}
[trace] run command 'Diff'
[trace] handle diff for d:\Documents\experia\demo\website\themes\kits\scss\_custom.scss
[debug] < '220 Monitored experia FTP service.\r\n'
[debug] > AUTH TLS
[debug] < '234 Proceed with negotiation.\r\n'
[debug] > USER demo
[debug] < '331 Please specify the password.\r\n'
[debug] > PASS ******
[debug] < '230 Login successful.\r\n'
[debug] > FEAT
[debug] < '211-Features:\r\n'
[debug] < ' AUTH TLS\r\n'
[debug] < ' UTF8\r\n'
[debug] < ' EPRT\r\n'
[debug] < ' EPSV\r\n'
[debug] < ' MDTM\r\n'
[debug] < ' PASV\r\n'
[debug] < ' PBSZ\r\n'
[debug] < ' PROT\r\n'
[debug] < ' REST STREAM\r\n'
[debug] < ' SIZE\r\n'
[debug] < ' TVFS\r\n'
[debug] < '211 End\r\n'
[debug] > TYPE I
[debug] < '200 Switching to Binary mode.\r\n'
[debug] > PASV
[debug] < '227 Entering Passive Mode (85,237,88,214,156,124).\r\n'
[debug] > RETR /website/themes/kits/scss/_custom.scss
[debug] < '522 Data connections must be encrypted.\r\n'
[error] Error: Data connections must be encrypted.
    at v (C:\Users\Tobi\.vscode\extensions\liximomo.sftp-1.10.0\dist\extension.js:70:110347)
    at d.<anonymous> (C:\Users\Tobi\.vscode\extensions\liximomo.sftp-1.10.0\dist\extension.js:70:111070)
    at d.emit (events.js:182:13)
    at d.module.exports.d._write (C:\Users\Tobi\.vscode\extensions\liximomo.sftp-1.10.0\dist\extension.js:70:123892)
    at doWrite (_stream_writable.js:410:12)
    at writeOrBuffer (_stream_writable.js:394:5)
    at d.Writable.write (_stream_writable.js:294:11)
    at TLSSocket.p (C:\Users\Tobi\.vscode\extensions\liximomo.sftp-1.10.0\dist\extension.js:70:113441)
    at TLSSocket.emit (events.js:182:13)
    at addChunk (_stream_readable.js:279:12)
    at readableAddChunk (_stream_readable.js:260:13)
    at TLSSocket.Readable.push (_stream_readable.js:219:10)
    at TLSWrap.onread (net.js:636:20) 
[debug] > NOOP
trashbytes commented 5 years ago

Any idea how to fix or work around this?

urosu commented 5 years ago

@trashbytes,

having those lines in sftp.json should work (and work for me):

"protocol": "ftp",
"secure": true

If you're having certificate problems, include (and you already have, but just in case):

"secureOptions": {
    "rejectUnauthorized": false
}

and FTPS should work. Apart from that, make sure your hostname and port are set correctly.

If you're still unable to connect, there might be a server-side issue. In that case inspect the server logs to see what is happening.

khoazero123 commented 5 years ago

@urki0x Thank you very much.

soekarmana commented 5 years ago

same problem here, cannot connect to Cpanel FTP account sftp.json has been edited according to @urki0x debug log shows nothing regarding of failed connection got popup notification : "Connecting failed, Error: Connecting failed, Error: Timed out while waiting for handshake" here i attach some packet capture from wireshark ftps-failed.zip

sorinsfirlogea commented 5 years ago

I'm having the same problem. I am using FTPS with "secure": true, "secureOptions": { "rejectUnauthorized": false }, "passive": true,

but it hangs on the same place: '200 Switching to Binary mode.\r\n' [08-21 09:24:09] [debug] > PASV [08-21 09:24:09] [debug] < '227 Entering Passive Mode (94,237,29,109,250,195).\r\n' [08-21 09:24:09] [debug] > PASV [08-21 09:24:09] [debug] < '227 Entering Passive Mode (94,237,29,109,250,17).\r\n' [08-21 09:24:09] [debug] > LIST /var/www/html/cm/wp-content/themes/scrawl [08-21 09:24:09] [debug] < '150 Here comes the directory listing.\r\n' [08-21 09:24:09] [debug] < '226 Directory send OK.\r\n' [08-21 09:24:09] [debug] > PASV [08-21 09:24:09] [debug] < '227 Entering Passive Mode (94,237,29,109,250,213).\r\n' [08-21 09:24:09] [debug] > RETR /var/www/html/cm/wp-content/themes/scrawl/style.css [08-21 09:24:09] [debug] < '150 Opening BINARY mode data connection for /var/www/html/cm/wp-content/themes/scrawl/style.css (53339 bytes).\r\n'

I cannot use VSCode because of this and I am deeply unhappy. I am using the same settings in FileZilla and it's working perfectly. Is there a solution to this issue?

ghost commented 5 years ago

@trashbytes,

having those lines in sftp.json should work (and work for me):

"protocol": "ftp",
"secure": true

If you're having certificate problems, include (and you already have, but just in case):

"secureOptions": {
    "rejectUnauthorized": false
}

and FTPS should work. Apart from that, make sure your hostname and port are set correctly.

If you're still unable to connect, there might be a server-side issue. In that case inspect the server logs to see what is happening.

Thank you, @urki0x ! It really works! And your picture is the best on GitHub I think ;)

gargashwani commented 4 years ago

@trashbytes,

having those lines in sftp.json should work (and work for me):

"protocol": "ftp",
"secure": true

If you're having certificate problems, include (and you already have, but just in case):

"secureOptions": {
    "rejectUnauthorized": false
}

and FTPS should work. Apart from that, make sure your hostname and port are set correctly.

If you're still unable to connect, there might be a server-side issue. In that case inspect the server logs to see what is happening.

Saved Hell lot of time.

as1414 commented 4 years ago

Worked for me as well

brando90 commented 4 years ago

@liximomo what does

[07-08 11:40:28] [debug] Client: none auth failed

mean? Is this the reason It doesn't work?

I am also having issues uploading on save. I will provide more details soon as soon as I figure out what might be useful to share here.

brando90 commented 4 years ago

@trashbytes,

having those lines in sftp.json should work (and work for me):

"protocol": "ftp",
"secure": true

If you're having certificate problems, include (and you already have, but just in case):

"secureOptions": {
    "rejectUnauthorized": false
}

and FTPS should work. Apart from that, make sure your hostname and port are set correctly.

If you're still unable to connect, there might be a server-side issue. In that case inspect the server logs to see what is happening.

@urki0x Why do I need to change it to that?

I always had it like this and worked fine:

    "protocol": "sftp",
brando90 commented 4 years ago

@trashbytes,

having those lines in sftp.json should work (and work for me):

"protocol": "ftp",
"secure": true

If you're having certificate problems, include (and you already have, but just in case):

"secureOptions": {
    "rejectUnauthorized": false
}

and FTPS should work. Apart from that, make sure your hostname and port are set correctly.

If you're still unable to connect, there might be a server-side issue. In that case inspect the server logs to see what is happening.

This doesn't seem to work anyway with all changes you suggested.

That gives me new errors:

[07-08 11:44:56] [info] Using profile: prod
[07-08 11:44:56] [info] [file-save] /Users/brando/automl-meta-learning/automl-proj/experiments_meta_learning/meta_learning_experiments_submission.py
[07-08 11:44:56] [info] Using profile: prod
[07-08 11:44:56] [trace] handle upload file for /Users/brando/automl-meta-learning/automl-proj/experiments_meta_learning/meta_learning_experiments_submission.py
[07-08 11:44:58] [debug] < 'SSH-2.0-OpenSSH_7.4\r\n'
[07-08 11:45:06] [error] Error: Timeout while connecting to server
    at Timeout._onTimeout (/Users/brando/.vscode/extensions/liximomo.sftp-1.12.9/dist/extension.js:70:109790)
    at listOnTimeout (internal/timers.js:531:17)
    at processTimers (internal/timers.js:475:7) download /Users/brando/automl-meta-learning/automl-proj/experiments_meta_learning/meta_learning_experiments_submission.py
[07-08 11:45:15] [info] Using profile: prod
[07-08 11:45:15] [info] [file-save] /Users/brando/automl-meta-learning/automl-proj/experiments_meta_learning/meta_learning_experiments_submission.py
[07-08 11:45:15] [info] Using profile: prod
[07-08 11:45:15] [trace] handle upload file for /Users/brando/automl-meta-learning/automl-proj/experiments_meta_learning/meta_learning_experiments_submission.py
[07-08 11:45:15] [debug] < 'SSH-2.0-OpenSSH_7.4\r\n'
[07-08 11:45:25] [error] Error: Timeout while connecting to server
    at Timeout._onTimeout (/Users/brando/.vscode/extensions/liximomo.sftp-1.12.9/dist/extension.js:70:109790)
    at listOnTimeout (internal/timers.js:531:17)
    at processTimers (internal/timers.js:475:7) download /Users/brando/automl-meta-learning/automl-proj/experiments_meta_learning/meta_learning_experiments_submission.py
brando90 commented 4 years ago

https://github.com/liximomo/vscode-sftp/wiki/config#secure

Why is this link here? I read but I didn't know what to do with it. What do I do with it?

as1414 commented 4 years ago

@brando90 is this a new connection?

I always had it like this and worked fine:

"protocol": "sftp",

If everything was working fine before, has it suddenly stopped today?
Have you checked all of the network pieces of the puzzle? Are you able to connect to this FTP using something like filezilla? Are there any new firewall rules stopping it? (I know I've blocked myself before by accident by installing a FW management tool)

brando90 commented 4 years ago

@brando90 is this a new connection?

I always had it like this and worked fine:

"protocol": "sftp",

If everything was working fine before, has it suddenly stopped today?

yes

Have you checked all of the network pieces of the puzzle?

I'm sure I've not check them all, I'm not even sure what to check.

Though, I tried connecting to the server. That didn't worked. I tried rsyncing to it from the command line. That didn't worked. I had the administrators help me. We check the server's logs. That didn't work. I re-installed vscode, tried different versions of sftp...nothing worked.

Are you able to connect to this FTP using something like filezilla?

Is filezilla another extensions?

Are there any new firewall rules stopping it? (I know I've blocked myself before by accident by installing a FW management tool)

It says my firewall is off...

Any suggestions are appreciated. Thanks for replying.

as1414 commented 4 years ago

I would download filezilla, or some other free ftp client, and try to make the connection. If you can't make it from a different ftp client either, odds are you won't be able to make it from this one.

Adam

This email was sent from a mobile device. Please excuse spelling and grammar.

On Wed, Jul 8, 2020 at 2:18 PM -0700, "brando90" notifications@github.com wrote:

@brando90 is this a new connection?

I always had it like this and worked fine:

"protocol": "sftp",

If everything was working fine before, has it suddenly stopped today?

yes

Have you checked all of the network pieces of the puzzle?

I'm sure I've not check them all, I'm not even sure what to check.

Though, I tried connecting to the server. That didn't worked. I tried rsyncing to it from the command line. That didn't worked. I had the administrators help me. We check the server's logs. That didn't work. I re-installed vscode, tried different versions of sftp...nothing worked.

Are you able to connect to this FTP using something like filezilla?

Is filezilla another extensions?

Are there any new firewall rules stopping it? (I know I've blocked myself before by accident by installing a FW management tool)

It says my firewall is off...

Any suggestions are appreciated. Thanks for replying.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.