Skip to content

Commit 0ff5e25

Browse files
authored
Add 1.26.0 and 2.0.0-M4 (experimental) (#744)
* add new versions and patches * adapted changelog * fixes * fixes for 2.0.0 * improve mvn version check for 2.0.0 * fix comment
1 parent e2417f3 commit 0ff5e25

7 files changed

+124
-30
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ All notable changes to this project will be documented in this file.
2626
- opa: Add log processing script to opa for decision logging ([#695], [#704]).
2727
- stackable-base: Add [config-utils](https://github.com/stackabletech/config-utils) ([#706]).
2828
- omid: Include Apache Omid Examples to simplify testing ([#721]).
29+
- nifi: Add support for 1.26.0 and 2.0.0-M4 ([#744]).
2930
- kafka: Add versions `3.6.2` and `3.7.1` ([#745]).
3031
- trino & trino-cli: Add version 451 ([#XXX]).
3132

@@ -70,6 +71,7 @@ All notable changes to this project will be documented in this file.
7071
- zookeeper: Remove unsupported version 3.8.3 and 3.9.1 ([#628], [#736]).
7172
- java-base: Remove openjdk-devel rpm package again to reduce the vulnerability surface ([#665])
7273
- trino: Remove unsupported version 428 ([#687]).
74+
- nifi: Remove unsupported version 1.23.2 ([#744]).
7375
- kafka: Remove unsupported version `3.5.2` ([#745]).
7476

7577
[#583]: https://github.com/stackabletech/docker-images/pull/583
@@ -113,6 +115,7 @@ All notable changes to this project will be documented in this file.
113115
[#736]: https://github.com/stackabletech/docker-images/pull/736
114116
[#737]: https://github.com/stackabletech/docker-images/pull/737
115117
[#743]: https://github.com/stackabletech/docker-images/pull/743
118+
[#744]: https://github.com/stackabletech/docker-images/pull/744
116119
[#745]: https://github.com/stackabletech/docker-images/pull/745
117120

118121
## [24.3.0] - 2024-03-20

nifi/Dockerfile

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,27 @@
66

77
# Not tagging base image because it is built as part of the same process
88
# hadolint ignore=DL3006
9-
FROM stackable/image/java-devel AS builder
9+
FROM stackable/image/java-devel AS nifi-builder
1010

1111
ARG PRODUCT
12+
ARG MAVEN_VERSION="3.9.8"
1213

1314
RUN microdnf update && \
1415
microdnf clean all && \
1516
rm -rf /var/cache/yum
1617

18+
# NOTE: From NiFi 2.0.0 upwards Apache Maven 3.9.6+ is required. As of 2024-07-04 the java-devel image
19+
# ships 3.6.3. This will update maven accordingly depending on the version. The error is due to the maven-enforer-plugin.
20+
#
21+
# [ERROR] Rule 2: org.apache.maven.enforcer.rules.version.RequireMavenVersion failed with message:
22+
# [ERROR] Detected Maven Version: 3.6.3 is not in the allowed range [3.9.6,).
23+
#
24+
WORKDIR /tmp
25+
RUN if [[ "${PRODUCT}" == 2.* ]] ; then \
26+
curl --fail -L "https://repo.stackable.tech/repository/packages/maven/apache-maven-${MAVEN_VERSION}-bin.tar.gz" | tar -xzC . && \
27+
ln -sf /tmp/apache-maven-${MAVEN_VERSION}/bin/mvn /usr/bin/mvn ; \
28+
fi
29+
1730
USER stackable
1831
WORKDIR /stackable
1932

@@ -37,7 +50,14 @@ RUN if [[ "${PRODUCT}" == "1.21.0" ]] ; then \
3750
unzip /stackable/nifi-${PRODUCT}-bin.zip && \
3851
rm /stackable/nifi-${PRODUCT}-bin.zip && \
3952
# Remove generated docs in binary
40-
rm -rf /stackable/nifi-${PRODUCT}/docs ; \
53+
rm -rf /stackable/nifi-${PRODUCT}/docs && \
54+
# Add Iceberg extensions as they are not included by default and are important enough
55+
# They need to be build from source, as https://mvnrepository.com/artifact/org.apache.nifi/nifi-iceberg-processors-nar does not ship the org.apache.hadoop.fs.s3a.S3AFileSystem (see https://github.com/apache/nifi/pull/6368#issuecomment-1502175258)
56+
# See https://repo.stackable.tech/repository/packages/nifi/iceberg-nars/README.md for details on how to build them
57+
cd /stackable/nifi-${PRODUCT}/lib/ && \
58+
curl --fail -O "https://repo.stackable.tech/repository/packages/nifi/iceberg-nars/nifi-iceberg-processors-nar-${PRODUCT}-with-aws.nar" && \
59+
curl --fail -O "https://repo.stackable.tech/repository/packages/nifi/iceberg-nars/nifi-iceberg-services-nar-${PRODUCT}-with-aws.nar" && \
60+
curl --fail -O "https://repo.stackable.tech/repository/packages/nifi/iceberg-nars/nifi-iceberg-services-api-nar-${PRODUCT}-with-aws.nar" ; \
4161
else \
4262
curl --fail -L 'https://repo.stackable.tech/repository/m2/tech/stackable/nifi/stackable-bcrypt/1.0-SNAPSHOT/stackable-bcrypt-1.0-20240508.153334-1-jar-with-dependencies.jar' \
4363
# This used to be located in /bin/stackable-bcrypt.jar. We create a softlink for /bin/stackable-bcrypt.jar in the main container for backwards compatibility.
@@ -56,7 +76,7 @@ RUN if [[ "${PRODUCT}" == "1.21.0" ]] ; then \
5676
patches/apply_patches.sh ${PRODUCT} && \
5777
# Build NiFi
5878
cd /stackable/nifi-${PRODUCT}-src/ && \
59-
mvn clean install -Dmaven.javadoc.skip=true -DskipTests && \
79+
mvn clean install -Dmaven.javadoc.skip=true -DskipTests --activate-profiles include-iceberg,include-hadoop-aws && \
6080
# Copy the binaries to the /stackable folder
6181
mv /stackable/nifi-${PRODUCT}-src/nifi-assembly/target/nifi-${PRODUCT}-bin/nifi-${PRODUCT} /stackable/nifi-${PRODUCT} && \
6282
# Remove the unzipped sources
@@ -65,14 +85,6 @@ RUN if [[ "${PRODUCT}" == "1.21.0" ]] ; then \
6585
rm -rf /stackable/nifi-${PRODUCT}/docs ; \
6686
fi
6787

68-
# Add Iceberg extensions as they are not included by default and are important enough
69-
# They need to be build from source, as https://mvnrepository.com/artifact/org.apache.nifi/nifi-iceberg-processors-nar does not ship the org.apache.hadoop.fs.s3a.S3AFileSystem (see https://github.com/apache/nifi/pull/6368#issuecomment-1502175258)
70-
# See https://repo.stackable.tech/repository/packages/nifi/iceberg-nars/README.md for details on how to build them
71-
RUN cd /stackable/nifi-${PRODUCT}/lib/ && \
72-
curl --fail -O "https://repo.stackable.tech/repository/packages/nifi/iceberg-nars/nifi-iceberg-processors-nar-${PRODUCT}-with-aws.nar" && \
73-
curl --fail -O "https://repo.stackable.tech/repository/packages/nifi/iceberg-nars/nifi-iceberg-services-nar-${PRODUCT}-with-aws.nar" && \
74-
curl --fail -O "https://repo.stackable.tech/repository/packages/nifi/iceberg-nars/nifi-iceberg-services-api-nar-${PRODUCT}-with-aws.nar"
75-
7688
# ===
7789
# For earlier versions this script removes the .class file that contains the
7890
# vulnerable code.
@@ -120,10 +132,10 @@ RUN microdnf update && \
120132

121133
USER stackable
122134

123-
COPY --chown=stackable:stackable --from=builder /stackable/nifi-${PRODUCT} /stackable/nifi-${PRODUCT}/
124-
COPY --chown=stackable:stackable --from=builder /stackable/stackable-bcrypt.jar /stackable/stackable-bcrypt.jar
135+
COPY --chown=stackable:stackable --from=nifi-builder /stackable/nifi-${PRODUCT} /stackable/nifi-${PRODUCT}/
136+
COPY --chown=stackable:stackable --from=nifi-builder /stackable/stackable-bcrypt.jar /stackable/stackable-bcrypt.jar
125137

126-
COPY --chown=stackable:stackable nifi/stackable /stackable
138+
COPY --chown=stackable:stackable nifi/stackable/bin /stackable/bin
127139
COPY --chown=stackable:stackable nifi/licenses /licenses
128140
COPY --chown=stackable:stackable nifi/python /stackable/python
129141

nifi/stackable/patches/1.23.2/001-NIFI-no-zip-assembly-1.23.2.patch renamed to nifi/stackable/patches/1.26.0/001-NIFI-no-zip-assembly-1.26.0.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/nifi-assembly/pom.xml b/nifi-assembly/pom.xml
2-
index b520c113ce..5cf04f421d 100644
2+
index 8778f3dc53..045c0daa64 100644
33
--- a/nifi-assembly/pom.xml
44
+++ b/nifi-assembly/pom.xml
55
@@ -66,7 +66,6 @@ language governing permissions and limitations under the License. -->

nifi/stackable/patches/1.23.2/002-NIFI-no-host-header-check-1.23.2.patch renamed to nifi/stackable/patches/1.26.0/002-NIFI-no-host-header-check-1.26.0.patch

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,35 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
2626
<+>UTF-8
2727
===================================================================
2828
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/HostHeaderHandler.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/HostHeaderHandler.java
29-
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/HostHeaderHandler.java (revision 6ecc398d3f92425447e43242af4992757e25b3c5)
30-
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/HostHeaderHandler.java (date 1716453739677)
31-
@@ -47,6 +47,7 @@
29+
index 051e2f19d6..6baac7fda7 100644
30+
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/HostHeaderHandler.java
31+
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/HostHeaderHandler.java
32+
@@ -47,6 +47,7 @@ public class HostHeaderHandler extends ScopedHandler {
3233
private final String serverName;
3334
private final int serverPort;
3435
private final List<String> validHosts;
3536
+ private boolean allowAllHosts = false;
36-
37+
3738
/**
3839
* Instantiates a handler with a given server name and port 0.
39-
@@ -107,6 +108,10 @@
40+
@@ -107,6 +108,11 @@ public class HostHeaderHandler extends ScopedHandler {
4041
// The value(s) from nifi.web.proxy.host
4142
hosts.addAll(parseCustomHostnames(niFiProperties));
42-
43+
4344
+ // Check if the setting for allowed hosts has only the wildcard entry and
4445
+ // if so store this in allowAllHost for later use
4546
+ List<String> configuredHostNames = niFiProperties.getAllowedHostsAsList();
4647
+ this.allowAllHosts = configuredHostNames.size() == 1 && configuredHostNames.contains("*");
48+
+
4749
// empty is ok here
4850
hosts.add("");
49-
50-
@@ -205,7 +210,7 @@
51+
52+
@@ -205,7 +211,7 @@ public class HostHeaderHandler extends ScopedHandler {
5153
}
52-
54+
5355
boolean hostHeaderIsValid(String hostHeader) {
5456
- return validHosts.contains(hostHeader.toLowerCase().trim());
5557
+ return this.allowAllHosts || validHosts.contains(hostHeader.toLowerCase().trim());
5658
}
57-
59+
5860
@Override
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff --git a/nifi-assembly/pom.xml b/nifi-assembly/pom.xml
2+
index 83eb8214f9..0764b3716d 100644
3+
--- a/nifi-assembly/pom.xml
4+
+++ b/nifi-assembly/pom.xml
5+
@@ -66,7 +66,6 @@ language governing permissions and limitations under the License. -->
6+
<tarLongFileMode>posix</tarLongFileMode>
7+
<formats>
8+
<format>dir</format>
9+
- <format>zip</format>
10+
</formats>
11+
</configuration>
12+
</execution>
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
Subject: [PATCH] Allow bypassing check for host header.
2+
NiFi has the configuration option 'nifi.web.proxy.host' which controls allowed
3+
values for the host header field in any incoming request for the web ui.
4+
5+
This frequently causes issues when trying to expose the NiFi UI via for example
6+
an ingress, loadbalancer or any similar type of mechanism.
7+
8+
NiFi does not allow to disable this behavior, so at the moment the nifi operator
9+
simply hardcodes all even remotely possible values into this field.
10+
But in order to allow putting for example in ingress in front of NiFi this means
11+
using config overrides to change the value of this option, copy all the values
12+
the operator put in there and add the extra value you need.
13+
14+
This is less than ideal, the proper solution would probably be
15+
https://github.com/stackabletech/nifi-operator/issues/604
16+
17+
But until that is merged this is a simple workaround that allows overriding the list of allowed
18+
hostnames by just setting it to "*" and this will effectively bypass the hostname check entirely if set.
19+
20+
This allows us to keep the default behavior in place for those users where it works and not remove
21+
security features, but also enables users to disable this check if they know what they are doing.
22+
---
23+
Index: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/HostHeaderHandler.java
24+
IDEA additional info:
25+
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
26+
<+>UTF-8
27+
===================================================================
28+
diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/HostHeaderHandler.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/HostHeaderHandler.java
29+
index 97337d63e2..0f7a272de7 100644
30+
--- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/HostHeaderHandler.java
31+
+++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/HostHeaderHandler.java
32+
@@ -47,6 +47,7 @@ public class HostHeaderHandler extends Handler.Abstract {
33+
private final String serverName;
34+
private final int serverPort;
35+
private final List<String> validHosts;
36+
+ private boolean allowAllHosts = false;
37+
38+
/**
39+
* Instantiates a handler which accepts incoming requests with a host header that is empty or contains one of the
40+
@@ -68,6 +69,11 @@ public class HostHeaderHandler extends Handler.Abstract {
41+
// The value(s) from nifi.web.proxy.host
42+
hosts.addAll(parseCustomHostnames(niFiProperties));
43+
44+
+ // Check if the setting for allowed hosts has only the wildcard entry and
45+
+ // if so store this in allowAllHost for later use
46+
+ List<String> configuredHostNames = niFiProperties.getAllowedHostsAsList();
47+
+ this.allowAllHosts = configuredHostNames.size() == 1 && configuredHostNames.contains("*");
48+
+
49+
// empty is ok here
50+
hosts.add("");
51+
52+
@@ -160,7 +166,7 @@ public class HostHeaderHandler extends Handler.Abstract {
53+
* @return Valid status
54+
*/
55+
boolean hostHeaderIsValid(final String hostHeader) {
56+
- return hostHeader != null && validHosts.contains(hostHeader.toLowerCase().trim());
57+
+ return this.allowAllHosts || (hostHeader != null && validHosts.contains(hostHeader.toLowerCase().trim()));
58+
}
59+
60+
@Override

nifi/versions.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,19 @@
44
"java-base": "11",
55
"java-devel": "11",
66
},
7-
{
8-
"product": "1.23.2",
9-
"java-base": "11",
10-
"java-devel": "11",
11-
},
127
{
138
"product": "1.25.0",
149
"java-base": "21",
1510
"java-devel": "11", # There is an error when trying to use java-devel 21 (for nifi 1.25.0):
1611
},
12+
{
13+
"product": "1.26.0",
14+
"java-base": "11",
15+
"java-devel": "11", # There is an error when trying to use java-devel 21 (for nifi 1.26.0):
16+
},
17+
{
18+
"product": "2.0.0-M4",
19+
"java-base": "21",
20+
"java-devel": "21",
21+
}
1722
]

0 commit comments

Comments
 (0)