NiFi policies
centralized in Ranger.
Three scenarios: how NiFi connects to Ranger, the order for enabling the integration, and what to do after reinstalling NiFi. Each one covers: the chart default, what changes in the cluster, and where the configuration lives.
NiFi can use Apache Ranger as the source of its access policies. The integration has two sides: in the tdp-nifi chart, mode 3 of Security - NiFi replaces the local authorizer with the Ranger plugin. In the tdp-ranger chart, the rangerIntegrations values register the NiFi service, generate the Ranger client certificate, and create the minimum technical policies. This page shows how the two sides fit together and in what order to apply them. The Ranger values are in Integrations - Ranger.
Your environment
If you fill in your environment details here, the examples and commands on the page use what you provided.
Scenarios
- 1 · How it connects
- 2 · Enable the integration
- 3 · After reinstalling NiFi
Who queries whom, and with which certificate.
NiFi connects to Ranger through two pieces: the Ranger plugin, which ships in the NiFi image and downloads the policies from Ranger Admin, and the Ranger client certificate, with which Ranger Admin queries the NiFi resources. By default, none of this is on: NiFi uses the local authorizer, and the integration is off in the Ranger chart. The following tabs cover only Ranger: the order for enabling the integration and what to do after reinstalling NiFi.
Before enabling it, it is worth understanding the path. In mode 3, the Ranger plugin on the NiFi nodes downloads the policies from Ranger Admin. In the opposite direction, Ranger Admin queries NiFi's /nifi-api/resources endpoint to list the resources in the policy editor. That query uses SSL authentication, with a client certificate that cert-manager generates through the NiFi issuer and that NiFi identifies as CN=ranger-nifi-client. The NiFi address in the Ranger service uses a hostname present in the SANs of the NiFi certificate: the headless Service, not the external Service. After each Ranger installation or upgrade, a Job creates the technical users and the minimum technical policies.
Local authorizer (nifiCluster.security.authorization.mode: file). Mode 3 is in Security - NiFi.
Integration disabled (rangerIntegrations.nifi.enabled), as are the integration Job (rangerIntegrations.configJob.enabled) and the client certificate generation (rangerIntegrations.nifi.tlsClientCertificate.autoGenerate.enabled).
The integration does not create any /flow policy for people. Create it afterwards, with the real users and groups synchronized in your environment's Ranger.
NiFi, Ranger and the client certificate
- NiFi nodes in mode 3. The Ranger plugin, already included in the default image, downloads the policies from Ranger Admin and sends the audit. The NiFi side is in Security - NiFi, scenario Policies in Ranger. Chart default:
authorization.mode: file. (nifiCluster.security.authorization.mode) - Ranger Admin. Holds the NiFi service and the policies. To build the policy editor, it queries NiFi's /nifi-api/resources over SSL, with the client certificate. Chart default:
integration disabled. (rangerIntegrations.nifi.enabled) - Integration Job. Hook after the installation and after each Ranger upgrade: it creates the technical users and the minimum technical policies. If any of them cannot be created, the hook fails explicitly. Chart default:
disabled. (rangerIntegrations.configJob.enabled) - Ranger client certificate. Generated by cert-manager with the NiFi issuer (nifi-issuer), with a JKS keystore and truststore. NiFi identifies this client as CN=ranger-nifi-client. Chart default:
generation disabled. (rangerIntegrations.nifi.tlsClientCertificate.autoGenerate.enabled) - JKS password. Created by you before the installation, not by the chart. The same password generates the JKS files and lets Ranger open them later: keep it stable across upgrades and reinstalls. (
rangerIntegrations.nifi.tlsClientCertificate.autoGenerate.passwordSecretName) - NiFi issuer. The same cert-manager issuer that issues the NiFi certificates. (
rangerIntegrations.nifi.tlsClientCertificate.autoGenerate.issuerRef)
The order: first the registration in Ranger, then mode 3 in NiFi.
You will put NiFi in mode 3 and need Ranger to already know the NiFi service, have the client certificate to query it, and have created the technical policies that a clustered NiFi requires. Each side lives in its own chart's values file, and both charts are in the same namespace: first Ranger, then NiFi.
The JKS password Secret and Ranger with the NiFi integration come first. NiFi in mode 3 comes afterwards, in the same namespace.
The rangerIntegrations values go in the tdp-ranger chart's values file. Those of mode 3 (nifiCluster.security.authorization), in the tdp-nifi chart's.
Register NiFi in Ranger
Before NiFi: the JKS password Secret, the client certificate, the technical users, and the technical policies.
The Secret, the Ranger values file, and the command are in Integrations - Ranger.
Put NiFi in mode 3
The NiFi side: plugin, mounted files, and adminIdentity.
The values and the command are in Security - NiFi.
It worked when
Running and the interface shows the login screen.Create the /flow policies for people
With your environment's real users and groups.
The integration does not create any human policy. Create them in Ranger Admin, with the users and groups synchronized in Ranger.
Reissue the Ranger client certificate.
You reinstalled NiFi and, in the Ranger policy editor, the NiFi resource lookup fails with PKIX path building failed. On reinstall, NiFiKop creates a new CA, and the client certificate that Ranger already had no longer matches it. Deleting the certificate Secret makes cert-manager reissue it from the current CA. Then restart Ranger Admin.
The Ranger certificate issued by the previous CA
- NiFi nodes in mode 3. The Ranger plugin, already included in the default image, downloads the policies from Ranger Admin and sends the audit. The NiFi side is in Security - NiFi, scenario Policies in Ranger. Chart default:
authorization.mode: file. (nifiCluster.security.authorization.mode) - Ranger Admin. Holds the NiFi service and the policies. To build the policy editor, it queries NiFi's /nifi-api/resources over SSL, with the client certificate. Chart default:
integration disabled. (rangerIntegrations.nifi.enabled) - Integration Job. Hook after the installation and after each Ranger upgrade: it creates the technical users and the minimum technical policies. If any of them cannot be created, the hook fails explicitly. Chart default:
disabled. (rangerIntegrations.configJob.enabled) - Ranger client certificate. Issued by the NiFi CA. After reinstalling NiFi, the CA is a different one and this certificate no longer matches: delete the Secret so it is reissued. Chart default:
generation disabled. (rangerIntegrations.nifi.tlsClientCertificate.autoGenerate.enabled) - JKS password. Created by you before the installation, not by the chart. The same password generates the JKS files and lets Ranger open them later: keep it stable across upgrades and reinstalls. (
rangerIntegrations.nifi.tlsClientCertificate.autoGenerate.passwordSecretName) - NiFi issuer. The same cert-manager issuer that issues the NiFi certificates. (
rangerIntegrations.nifi.tlsClientCertificate.autoGenerate.issuerRef)
The commands act on the Ranger Secret and Deployment, and are in Integrations - Ranger.
When something goes wrong
Troubleshooting
Paste the error message or choose the symptom. The answer comes with the cause, what to do, and the command.
- Policy editor: PKIX path building failed. Cause: NiFi was reinstalled: NiFiKop created a new CA and the Ranger client certificate no longer matches it. What to do: Delete the certificate Secret so that cert-manager reissues it from the current CA, and restart Ranger Admin (scenario 3).
- The Ranger installation fails in the integration hook. Cause: The integration Job could not create a technical user or a policy, and failed explicitly. What to do: List the Jobs and read the integration Job log.
- Another problem. Cause: Start with the state of the pods and the namespace events. What to do: In mode 3, the real source of the policies is Ranger: check the configuration and the policies of the NiFi service in Ranger. On the NiFi side, the events and the node log show what prevents the cluster from starting. See also Security - NiFi.
Next steps
The Ranger side
Integrations - Ranger
The JKS password Secret, the values file, and the certificate reissue.