Skip to content

FTPES with TLS Session Reuse for FileZilla Server (need also BouncyCastle and a subclass). #321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
FTPES with TLS Session Reuse for FileZilla Server (need BouncyCastle …
…and a subclass).

Connecting to ftp.example.com on the command port and then to the corresponding IP x.x.x.x on the data port prevents the server from accepting the same TLS session.
Therefore, the Filezilla server needs to set peerHost before socket.connect to allow TLS session resumption.
  • Loading branch information
MGuich committed Jan 15, 2025
commit 9b3105cfe9ca10f21c53128577993ec296989ed0
7 changes: 5 additions & 2 deletions src/main/java/org/apache/commons/net/ftp/FTPSClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ protected Socket _openDataConnection_(final int command, final String arg) throw
@Override
protected Socket _openDataConnection_(final String command, final String arg) throws IOException {
final Socket socket = openDataSecureConnection(command, arg);
_prepareDataSocket_(socket);
if (socket instanceof SSLSocket) {
final SSLSocket sslSocket = (SSLSocket) socket;

Expand Down Expand Up @@ -313,7 +312,7 @@ protected Socket _openDataConnection_(final String command, final String arg) th
*/
protected void _prepareDataSocket_(final Socket socket) throws IOException {
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No extra whitespace please.

/**
* Check the value that can be set in PROT Command value.
*
Expand Down Expand Up @@ -831,6 +830,8 @@ private Socket openDataSecureConnection(final String command, final String arg)
}
socket = server.accept();

_prepareDataSocket_(socket);

// Ensure the timeout is set before any commands are issued on the new socket
if (soTimeoutMillis >= 0) {
socket.setSoTimeout(soTimeoutMillis);
Expand Down Expand Up @@ -871,6 +872,8 @@ private Socket openDataSecureConnection(final String command, final String arg)
socket = _socketFactory_.createSocket();
}

_prepareDataSocket_(socket);

if (getReceiveDataSocketBufferSize() > 0) {
socket.setReceiveBufferSize(getReceiveDataSocketBufferSize());
}
Expand Down
Loading