Skip to content

NIFI-14719 Added Passive Port Range property to ListenFTP - #11784

Open
Vinz2168 wants to merge 2 commits into
apache:mainfrom
Vinz2168:NIFI-14719
Open

Vinz2168 wants to merge 2 commits into
apache:mainfrom
Vinz2168:NIFI-14719

Conversation

@Vinz2168

@Vinz2168 Vinz2168 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Summary

NIFI-14719

Adds an optional Passive Port Range property to ListenFTP (format <start>-<end>, e.g. 50000-50099) that restricts the ports the embedded FTP server uses for passive mode data connections. This makes it possible to open a narrow, predictable set of ports on firewalls and to publish them from containers such as Docker. When the property is not set, the current behavior (any available port) is unchanged.

Changes:

  • ListenFTP: new Passive Port Range property supporting Environment Expression Language, with a validator that checks the <start>-<end> format, the 1-65535 bounds and that start <= end
  • NifiFtpServer: the listener always builds a single DataConnectionConfiguration, applying the passive ports and, when an SSL Context Service is configured, the implicit TLS settings for data connections, so the two options combine correctly
  • additionalDetails.md: documented the new property
  • TestListenFTP: validation tests and a test that starts the server and checks that the PASV reply advertises a port within the configured range

Tracking

Please complete the following tracking steps prior to pull request creation.

Issue Tracking

Pull Request Tracking

  • Pull Request title starts with Apache NiFi Jira issue number, such as NIFI-00000
  • Pull Request commit message starts with Apache NiFi Jira issue number, as such NIFI-00000
  • Pull request contains commits signed with a registered key indicating Verified status

Pull Request Formatting

  • Pull Request based on current revision of the main branch
  • Pull Request refers to a feature branch with one commit containing changes

Verification

Please indicate the verification steps performed prior to pull request creation.

Build

  • Build completed using ./mvnw clean install -P contrib-check
    • JDK 21
    • JDK 25

nifi-standard-processors verified with -P contrib-check (checkstyle, PMD, RAT) and TestListenFTP passing.

Licensing

  • New dependencies are compatible with the Apache License 2.0 according to the License Policy
  • New dependencies are documented in applicable LICENSE and NOTICE files

No new dependencies.

Documentation

  • Documentation formatting appears as expected in rendered files

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@exceptionfactory exceptionfactory left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for proposing this new property @Vinz2168. The basic concept and implementation look good. I noted a few recommendations.

.description("The range of ports, in the format <start>-<end> (e.g. 50000-50099), that the FTP server uses for data connections in passive mode. "
+ "Restricting the range simplifies firewall and container port mapping configurations. "
+ "If not set, any available port is used for each passive data connection.")
.required(false)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Instead of making this property optional, what do you think about having a default of 1025-65534?


public static final PropertyDescriptor PASSIVE_PORT_RANGE = new PropertyDescriptor.Builder()
.name("Passive Port Range")
.description("The range of ports, in the format <start>-<end> (e.g. 50000-50099), that the FTP server uses for data connections in passive mode. "

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A multiline string should be used instead of concatenation for descriptions.

} else {
explanation = "Port range must be in the format <start>-<end>, e.g. 50000-50099";
}
return new ValidationResult.Builder().subject(subject).input(input).explanation(explanation).valid(explanation == null).build();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For readability, it would be helpful to have each method call on one line.

- Set default Passive Port Range to 1025-65534 and made the property required
- Used multiline string for property description
- Placed builder method calls on separate lines

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Vinz2168

Copy link
Copy Markdown
Contributor Author

Thanks for the review @exceptionfactory! I pushed a new commit addressing the recommendations:

  • Made Passive Port Range required with a default value of 1025-65534, and updated the documentation accordingly
  • Changed the property description to use a multiline string
  • Placed each method call on a separate line in the ValidationResult.Builder chains

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants