Skip to content

feat(nifi): Add NiFi OPA Authorizer #1058

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 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ All notable changes to this project will be documented in this file.
`check-permissions-ownership.sh` provided in stackable-base image ([#1025]).
- zookeeper: check for correct permissions and ownerships in /stackable folder via
`check-permissions-ownership.sh` provided in stackable-base image ([#1043]).
- nifi: Add OPA authorizer plugin with workaround ([#1058]).

### Changed

Expand Down Expand Up @@ -75,6 +76,7 @@ All notable changes to this project will be documented in this file.
[#1054]: https://github.com/stackabletech/docker-images/pull/1054
[#1055]: https://github.com/stackabletech/docker-images/pull/1055
[#1056]: https://github.com/stackabletech/docker-images/pull/1056
[#1058]: https://github.com/stackabletech/docker-images/pull/1058

## [25.3.0] - 2025-03-21

Expand Down
26 changes: 25 additions & 1 deletion nifi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,28 @@ rm -rf /stackable/nifi-${PRODUCT}/docs
chmod -R g=u /stackable
EOF

FROM stackable/image/java-devel AS opa-authorizer-builder

ARG STACKABLE_USER_UID
ARG PRODUCT
Copy link
Member

Choose a reason for hiding this comment

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

PRODUCT is not used in this builder.

Suggested change
ARG PRODUCT


USER ${STACKABLE_USER_UID}
WORKDIR /stackable

COPY --chown=${STACKABLE_USER_UID}:0 nifi/stackable/opa-authorizer/nifi-framework-api-version.patch /stackable/nifi-framework-api-version.patch

# TODO: Set to tag after new release of nifi-opa-plugin
RUN git clone --depth 1 https://github.com/DavidGitter/nifi-opa-plugin.git && \
cd nifi-opa-plugin && \
git reset --hard cdf8c36 && \
git apply /stackable/nifi-framework-api-version.patch && \
Comment on lines +93 to +97
Copy link
Member

Choose a reason for hiding this comment

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

We probably want profiles upstream for that.

cd authorizer && \
mvn \
--batch-mode \
--no-transfer-progress \
install \
-DskipTests

FROM stackable/image/java-base AS final

ARG PRODUCT
Expand All @@ -97,6 +119,8 @@ LABEL name="Apache NiFi" \
COPY --chown=${STACKABLE_USER_UID}:0 --from=nifi-builder /stackable/nifi-${PRODUCT} /stackable/nifi-${PRODUCT}/
COPY --chown=${STACKABLE_USER_UID}:0 --from=nifi-builder /stackable/stackable-bcrypt.jar /stackable/stackable-bcrypt.jar

COPY --chown=${STACKABLE_USER_UID}:0 --from=opa-authorizer-builder /stackable/nifi-opa-plugin/authorizer/target/opa-authorizer.nar /stackable/nifi-${PRODUCT}/extensions/opa-authorizer.nar

COPY --chown=${STACKABLE_USER_UID}:0 nifi/stackable/bin /stackable/bin
COPY --chown=${STACKABLE_USER_UID}:0 nifi/licenses /licenses
COPY --chown=${STACKABLE_USER_UID}:0 nifi/python /stackable/python
Expand Down Expand Up @@ -127,7 +151,7 @@ ln -s /stackable/nifi-${PRODUCT} /stackable/nifi
chown --no-dereference ${STACKABLE_USER_UID}:0 /stackable/nifi
chmod --recursive g=u /stackable/python
chmod --recursive g=u /stackable/bin
chmod g=u /stackable/nifi-${PRODUCT}
chmod --recursive g=u /stackable/nifi-${PRODUCT}
Copy link
Member

Choose a reason for hiding this comment

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

This recursive chmod will bloat the image. If you only want the extensions/opa-authorizer.nar chmodded please do that in the builder step.

REPOSITORY                        TAG                              IMAGE ID       CREATED         SIZE
oci.stackable.tech/sdp/nifi       1.28.1-stackable0.0.0-dev-opa    4647bd8fb197   7 seconds ago   5.65GB
oci.stackable.tech/sdp/nifi       1.28.1-stackable0.0.0-dev        2d7de1b048a7   38 hours ago    3.12GB

EOF

# ----------------------------------------
Expand Down
13 changes: 13 additions & 0 deletions nifi/stackable/opa-authorizer/nifi-framework-api-version.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/authorizer/pom.xml b/authorizer/pom.xml
index da074d7..55e76c3 100644
--- a/authorizer/pom.xml
+++ b/authorizer/pom.xml
@@ -19,7 +19,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
- <nifi.version>2.3.0</nifi.version>
+ <nifi.version>1.28.1</nifi.version>
</properties>

<dependencies>