jenkinsci / publish-over-ftp-plugin

https://plugins.jenkins.io/publish-over-ftp/
21 stars 33 forks source link

Set proper data channel protection for Implicit FTPS #6

Closed cjanz closed 5 years ago

cjanz commented 6 years ago

Some servers respond with an error response "550 The message received was unexpected or badly formatted." when not setting Data Channel Protection Level (PROT) to "Private (P)" and not setting a value of 0 for Protection Buffer Size (PBSZ)

Unfortunately I encountered this problem after creating my previous pull request (https://github.com/jenkinsci/publish-over-ftp-plugin/pull/5), so I have to create this new pull request. Sorry for the inconvenience.

slide commented 6 years ago

I need to research this more, this is a part of FTP I don't understand well.

andygraphite commented 5 years ago

Hi there - are there any plans to include this pull request in a release, as I am currently experiencing the same problem as this, and I believe this will fix it?

andygraphite commented 5 years ago

Hi, that's great, will you be releasing a new version to use in Jenkins at all please?

slide commented 5 years ago

Yes, I'll try and get to it this week.

andygraphite commented 5 years ago

Thank you

carlmon commented 5 years ago

Thanks! This should solve the "521 PROT P required" error when using FTP over TLS and the server requires files to be encrypted.

Looking forward to the release 👍

carlmon commented 5 years ago

@cjanz, I installed the latest build from https://ci.jenkins.io/blue/organizations/jenkins/Plugins%2Fpublish-over-ftp-plugin/detail/master/15/artifacts into my Jenkins instance. Your change is noted in the list of inclusions.

When I set Use Implicit TLS, I get the following error. ERROR: Exception when publishing, exception message [Failed to connect and initialize FTP connection. Message: [javax.net.ssl.SSLException: Unsupported or unrecognized SSL message]]

When uploading a file to FTP without Use Implicit TLS, it still results in a "521 PROT P required" error.

FTP: Connecting from host [<redacted>]
FTP: Connecting with configuration [<redacted>] ...
220-FileZilla Server 0.9.60 beta
220 Welcome to the <redacted> FTPS Site
AUTH TLS
234 Using authentication type TLS
FTP: Logging in, command printing disabled
FTP: Logged in, command printing enabled
FTP: Remote root is not absolute, getting absolute directory from PWD
PWD
257 "/" is current directory.
TYPE I
200 Type set to I
CWD /
250 CWD successful. "/" is current directory.
CWD <redacted>
250 CWD successful. "/<redacted>" is current directory.
PASV
227 Entering Passive Mode (<redacted>)
STOR test.txt
521 PROT P required
ERROR: Exception when publishing, exception message [Could not write file. Server message: [521 PROT P required
]]

Am I missing something? My Java is nonexistent, otherwise I would debug this myself 😢.

carlmon commented 5 years ago

FYI I resolved this by asking my IT admin to disable TLS session resume requirement on FileZilla FTP over TLS settings.

image