Skip to content

NIFI-6740: Add configuration options to specify NiFi/Bootstrap communication ports#5746

Closed
stevedlawrence wants to merge 2 commits intoapache:mainfrom
stevedlawrence:NIFI-6740
Closed

NIFI-6740: Add configuration options to specify NiFi/Bootstrap communication ports#5746
stevedlawrence wants to merge 2 commits intoapache:mainfrom
stevedlawrence:NIFI-6740

Conversation

@stevedlawrence
Copy link
Member

Description of PR

The NiFi and NiFi Bootstrap processes both bind to random ephemeral
ports to allow for inter-process communication (e.g. shutdown, port,
ping, etc.). However, the randomness of these ephemeral ports can pose
challenges for some security policies and firewall rules.

This adds two configuration options, nifi.bootstrap.listen.port and
nifi.listener.bootstrap.port, that allow an administrator to define
which ports the two processes should bind to for this communication,
making it easier to define security policies. The options default to
zero to maintain the current ephemeral port behavior.

fixes bug NIFI-6740

For all changes:

  • Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?

  • Does your PR title start with NIFI-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.

  • Has your PR been rebased against the latest commit within the target branch (typically main)?

  • Is your initial contribution a single, squashed commit? Additional commits in response to PR reviewer feedback should be made on this branch and pushed to allow change tracking. Do not squash or use --force when pushing to allow for clean monitoring of changes.

For code changes:

  • Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder?
  • Have you written or updated unit tests to verify your changes? manual testing performed
  • Have you verified that the full build is successful on JDK 8?
  • Have you verified that the full build is successful on JDK 11?
  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0? no new depenencies
  • If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly? not applicable
  • If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly? not applicable
  • If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties? not applicable

For documentation related changes:

  • Have you ensured that format looks appropriate for the output in which it is rendered?

…ication ports

The NiFi and NiFi Bootstrap processes both bind to random ephemeral
ports to allow for inter-process communication (e.g. shutdown, port,
ping, etc.). However, the randomness of these ephemeral ports can pose
challenges for some security policies and firewall rules.

This adds two configuration options, nifi.bootstrap.listen.port and
nifi.listener.bootstrap.port, that allow an administrator to define
which ports the two processes should bind to for this communication,
making it easier to define security policies. The options default to
zero to maintain the current ephemeral port behavior.
# nifi.security.group.mapping.transform.anygroup=LOWER

# listener bootstrap properties
nifi.listener.bootstrap.port=${nifi.listener.bootstrap.port}
Copy link
Contributor

Choose a reason for hiding this comment

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

This always has to match the one in bootstrap, right? It will get sent to the NiFi process when the bootstrap starts it, so I don't think we need the property on the NiFi side.

Copy link
Member Author

Choose a reason for hiding this comment

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

My understanding is that they must be different.

Bootstrap will start and listen on nifi.bootstrap.listen.port. It will then start the main NiFi process and pass an argument that tells that main NiFi process what port Bootstrap is listening on.

Then when NiFi starts, it will start listening on nifi.listener.bootstrap.port, and send a message to Bootstrap (to the port bootstrap is listening on, i.e. nifi.bootstrap.listen.port) telling it what this port it started listening on. At this point, each process is listening on a different port and knows which port the other is listening on to send commands.

By default these ports are random ephemeral ports, hence this communication needed to tell each other what the ports the other is listening on. This patch just makes it so you can optionally specify non-random ports.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I conflated the names nifi.bootstrap.listen.port and nifi.listener.bootstrap.port, my bad

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe more detail in the comment about what the port property means/does?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, the names are a bit confusing, I'm open to other suggestions that might be more clear.

I've added a comment as suggested.

@mattyb149 mattyb149 closed this in 4815df2 Feb 15, 2022
@mattyb149
Copy link
Contributor

+1 LGTM, verified the expected behavior. Thanks for the improvement! Merged to main

krisztina-zsihovszki pushed a commit to krisztina-zsihovszki/nifi that referenced this pull request Jun 28, 2022
…ication ports

The NiFi and NiFi Bootstrap processes both bind to random ephemeral
ports to allow for inter-process communication (e.g. shutdown, port,
ping, etc.). However, the randomness of these ephemeral ports can pose
challenges for some security policies and firewall rules.

This adds two configuration options, nifi.bootstrap.listen.port and
nifi.listener.bootstrap.port, that allow an administrator to define
which ports the two processes should bind to for this communication,
making it easier to define security policies. The options default to
zero to maintain the current ephemeral port behavior.

NIFI-6740: Add configuration options to specify NiFi/Bootstrap communication ports

Signed-off-by: Matthew Burgess <mattyb149@apache.org>

This closes apache#5746
Lehel44 pushed a commit to Lehel44/nifi that referenced this pull request Jul 1, 2022
…ication ports

The NiFi and NiFi Bootstrap processes both bind to random ephemeral
ports to allow for inter-process communication (e.g. shutdown, port,
ping, etc.). However, the randomness of these ephemeral ports can pose
challenges for some security policies and firewall rules.

This adds two configuration options, nifi.bootstrap.listen.port and
nifi.listener.bootstrap.port, that allow an administrator to define
which ports the two processes should bind to for this communication,
making it easier to define security policies. The options default to
zero to maintain the current ephemeral port behavior.

NIFI-6740: Add configuration options to specify NiFi/Bootstrap communication ports

Signed-off-by: Matthew Burgess <mattyb149@apache.org>

This closes apache#5746
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