Skip to content

Patch NiFi to allow disabling the host header check #694

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

Merged
merged 6 commits into from
Jun 24, 2024

Conversation

soenkeliebau
Copy link
Member

Description

NiFi has the configuration option 'nifi.web.proxy.host' which controls allowed
values for the host header field in any incoming request for the web ui.

This frequently causes issues when trying to expose the NiFi UI via for example
an ingress, loadbalancer or any similar type of mechanism.

NiFi does not allow to disable this behavior, so at the moment the nifi operator
simply hardcodes all even remotely possible values into this field.
But in order to allow putting for example in ingress in front of NiFi this means
using config overrides to change the value of this option, copy all the values
the operator put in there and add the extra value you need.

This is less than ideal, the proper solution would probably be
stackabletech/nifi-operator#604

But until that is merged this is a simple workaround that allows overriding the list of allowed
hostnames by just setting it to "*" and this will effectively bypass the hostname check entirely if set.

This allows us to keep the default behavior in place for those users where it works and not remove
security features, but also enables users to disable this check if they know what they are doing.

Definition of Done Checklist

  • Not all of these items are applicable to all PRs, the author should update this template to only leave the boxes in that are relevant
  • Please make sure all these things are done and tick the boxes
- [ ] Changes are OpenShift compatible
- [ ] All added packages (via microdnf or otherwise) have a comment on why they are added
- [ ] Things not downloaded from Red Hat repositories should be mirrored in the Stackable repository and downloaded from there
- [ ] All packages should have (if available) signatures/hashes verified
- [ ] Add an entry to the CHANGELOG.md file
- [ ] Integration tests ran successfully
TIP: Running integration tests with a new product image

The image can be built and uploaded to the kind cluster with the following commands:

bake --product <product> --image-version <stackable-image-version>
kind load docker-image <image-tagged-with-the-major-version> --name=<name-of-your-test-cluster>

See the output of bake to retrieve the image tag for <image-tagged-with-the-major-version>.

@soenkeliebau soenkeliebau requested review from Jimvin and sbernauer May 23, 2024 10:07
@lfrancke
Copy link
Member

Haven't looked at the details but please rename the patch files to contain the target version as well (see e.g. HBase and others).
That makes it easier to identify the file when it is copied around in isolation

@soenkeliebau
Copy link
Member Author

Haven't looked at the details but please rename the patch files to contain the target version as well (see e.g. HBase and others). That makes it easier to identify the file when it is copied around in isolation

Is it okay to have a range of versions in there? The same patch applies across a lot of NiFi versions, that file wasn't touched a lot it seems.

…t the moment.

Since 1.21.x will be removed soon, we will probably never build it from source and the presence of patchfiles here would just confuse everybody.
Added a README to say why it is not being used but present.
Copy link
Member

@sbernauer sbernauer left a comment

Choose a reason for hiding this comment

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

Thanks!

@soenkeliebau soenkeliebau added this pull request to the merge queue Jun 24, 2024
Merged via the queue into main with commit ca10d3e Jun 24, 2024
@soenkeliebau soenkeliebau deleted the feat/remove_nifi_host_header_check branch June 24, 2024 07:05
@lfrancke
Copy link
Member

Do I understand correctly that this is in preparation for adding the necessary support in the operator so there is nothing to document here?

@sbernauer
Copy link
Member

Exactly 👍

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

Successfully merging this pull request may close these issues.

3 participants