Support Questions

Find answers, ask questions, and share your expertise

Want to Use SSL i.e., Organization Provided Certs for New NiFi Cluster Users

avatar
Contributor

Hello, I have a 3 node NiFi Cluster up and running.  The Initial Admin User is able now to successfully log into the NiFi cluster.  

 

I would now like to add new users to the NiFi cluster and SSL i.e., signed PKI certs for each user as the basis for these users to gain access to NiFi.

 

I do not want to use LDAP, I am in an environment that will require use of PKI certs for access to NiFi.

 

Can someone provide a prescriptive set of steps I can follow to successfully use PKI certs/SSL as a means of providing access to new NiFi cluster users and specifically, how do I add new users?

 

I would think the process of creating new users and using SSL would be explained explicitly.  

 

Can someone help me with this?

 

VR,

 

Dave

3 ACCEPTED SOLUTIONS

avatar
Master Mentor

@davehkd 

Your corporate PKI certs are just certs signed by your corporate signing authority.  So really nothing needs to change in the configuration of your NiFi.  However, you will need to add your corporate signing authorities public certificate to the truststore.jks used by your NiFi.

When you access the NiFi UI a mutual TLS exchange occurs.  You client (browser) initiates the connection with a client Hello to which the server will respond with a server Hello.  In that server hello a list of certificate authorities (comes from CAs in the NiFi truststore) will be provided to back to the client.   This tells the client that it will only accept a client certificate signed by one of those authorities.  If the client (your browser) has a pki certificate loaded that was signed by one of those trusted authorities, that client certificate can be used to complete the mutual TLS exchange.  Much more happens in the Mutual TLS client server handshake, but i'll just stick to the certificate specifics here.

NiFi does nothing out of spec when it comes to certificates and NiFi has nothing to do with creating users.  You can create your own self signed certificates created via command line tools, use a public signing authority to create signed certificates, or in your case use your corporate signing authority to create certificates.  A java keystore is nothing more than a container that can hold 1 too many certificates.

Only requirement NiFi has with regards to the keystore it that it contains only 1 PrivateKeyEntry (private cert).  The truststore (just another keystore) can contain 1 too many trustedCertEntries (public certs) and often contains many public intermediate and root CAs.

If you found that the provided solution(s) assisted you with your query, please take a moment to login and click Accept as Solution below each response that helped.

Thank you,

Matt

View solution in original post

avatar
Master Mentor

@davehkd  It is difficult for me t say where your configuration has gone wrong with what has been shared
I would need to see your authorizers.xml.  

I see in your output mention of the SingleUserAuthorizer.  This authorizer does not support defining additional user for assigning policies.

What do you have configured in your nifi.properties for these configuration lines:

nifi.security.user.authorizer
nifi.security.user.login.identity.provider

If either of these is using the "single-user-provider/authorizer", it is expected that you will not see users in the UI.

You'll need to use an authorizer that supports multi user setup like the https://nifi.apache.org/docs/nifi-docs/html/administration-guide.html#standardmanagedauthorizer.


since you are using user certificates for handling your user authentication. the nifi.security.user.login.identity.provider configuration property should be blank.

If you found that the provided solution(s) assisted you with your query, please take a moment to login and click Accept as Solution below each response that helped.

Thank you,

Matt

View solution in original post

avatar
Master Mentor

@davehkd 

1. You can't have multiple providers in the authorizers.xml.  You'll ned to comment out the "singleUserAuthorizer".
2. Your "managed authorizer is not correct, you are missing the class:

 

<authorizer>
        <identifier>managed-authorizer</identifier>
        <class>org.apache.nifi.authorization.StandardManagedAuthorizer</class>
        <property name="Access Policy Provider">file-access-policy-provider</property>
    </authorizer>

 

3. Your file-access-policy-providers configuration looks good here.
4. Your file-user-group-provider configuration is not correct, you are missing the line that defines where the users.xml file is to be created:

 

<userGroupProvider>
        <identifier>file-user-group-provider</identifier>
        <class>org.apache.nifi.authorization.FileUserGroupProvider</class>
        <property name="Users File">./conf/users.xml</property>
        <property name="Initial User Identity 1">CN=ec2-user</property>
        <property name="Initial User Identity 2">CN=nifi1, OU=NIFI</property>
        <property name="Initial User Identity 3">CN=nifi2, OU=NIFI</property>
        <property name="Initial User Identity 4">CN=nifi3, OU=NIFI</property>
</userGroupProvider>

 

 

Make sure that in your nifi.properties file, you have configured NiFi to use the managed authorizer:

nifi.security.user.authorizer=managed-authorizer


Make sure that in your nifi.properties, you do NOT have the following property configured to use the single-user-provider:

nifi.security.user.login.identity.provider=

 

If you found that the provided solution(s) assisted you with your query, please take a moment to login and click Accept as Solution below each response that helped.

Thank you,

Matt

 



 

View solution in original post

20 REPLIES 20

avatar
Contributor

Matt...how do i specify the Initial Admin identity as the authorizer?

avatar
Contributor

here is what I added to the authorizers.xml file:

 

<userGroupProvider>

 

<property name="Initial User Identity 1">CN=ec2-user</property>

<property name="Initial User Identity 2">CN=nifi1, OU=NIFI</property>

<property name="Initial User Identity 3">CN=nifi2, OU=NIFI</property>

<property name="Initial User Identity 4">CN=nifi3, OU=NIFI</property>

 

<accessPolicyProvider>

 

<property name="Initial Admin Identity">CN=ec2-user</property>

<property name="Node Identity 1">CN=nifi1, OU=NIFI</property>

<property name="Node Identity 2">CN=nifi2, OU=NIFI</property>

<property name="Node Identity 3">CN=nifi3, OU=NIFI</property>

 

 

avatar
Master Mentor

@davehkd 
That is an incomplete authorizers.xml and thus not valid.

 

Matt

avatar
Contributor

i only posted what I had changed Matt...sorry...

 

i'll add the entire file in a moment....thanks for taking a look

 

avatar
Contributor

Here are the complete contents of the authorizers.xml file Matt.  Thanks for taking a look! And, thanks in advance for any guidance/recommendations!

 

------------------------------------------------------------------------------

 

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"??

 

<authorizers>

 

<userGroupProvider>

  <identifer>file-user-group-provider</identifier>

  <class>org.apache.nifi.authorization.FileUserGroupProvider</class>

  <property name="Initial User Identity 1">CN=ec2-user</property>

  <property name="Initial User Identity 2">CN=nifi1, OU=NIFI</property>

  <property name="Initial User Identity 3">CN=nifi2, OU=NIFI</property>

  <property name="Initial User Identity 4">CN=nifi3, OU=NIFI</property>

</userGroupProvider>

 

<accessPolicyProvider>

  <identifier>file-access-policy-provider</identifier?

  <class>org.apache.nifi.authorization.FileAccessPolicyProvider</class>

  <property name="User Group Provider">file-user-group-provider</property>

  <property name="Authorizations File">./conf/authorizations.xml</property>

  <property name="Initial Admin Identity">CN=ec2-user</property>

  <property name="Legacy Authorized Users File"></property>

  <property name="Node Identity 1">CN=nifi1, OU=NIFI</property>

  <property name="Node Identity 2">CN=nifi2, OU=NIFI</property>

  <property name="Node Identity 3">CN=nifi3, OU=NIFI</property>

</accessPolicyProvider>

 

<authorizer>

  <identifier>managed-authorizer</identifier>

  <property name="Access Policy Provider">file-access-policy-provider</property>

</authorizer>

 

<authorizer>

  <identity>single-user-authorizer</identifier>

  <class>org.apache.nifi.authorization.single.user.SingleUserAuthorizer</class>

</authorizer>

</authorizer>

 

 

 

 

 

avatar
Master Mentor

@davehkd 

1. You can't have multiple providers in the authorizers.xml.  You'll ned to comment out the "singleUserAuthorizer".
2. Your "managed authorizer is not correct, you are missing the class:

 

<authorizer>
        <identifier>managed-authorizer</identifier>
        <class>org.apache.nifi.authorization.StandardManagedAuthorizer</class>
        <property name="Access Policy Provider">file-access-policy-provider</property>
    </authorizer>

 

3. Your file-access-policy-providers configuration looks good here.
4. Your file-user-group-provider configuration is not correct, you are missing the line that defines where the users.xml file is to be created:

 

<userGroupProvider>
        <identifier>file-user-group-provider</identifier>
        <class>org.apache.nifi.authorization.FileUserGroupProvider</class>
        <property name="Users File">./conf/users.xml</property>
        <property name="Initial User Identity 1">CN=ec2-user</property>
        <property name="Initial User Identity 2">CN=nifi1, OU=NIFI</property>
        <property name="Initial User Identity 3">CN=nifi2, OU=NIFI</property>
        <property name="Initial User Identity 4">CN=nifi3, OU=NIFI</property>
</userGroupProvider>

 

 

Make sure that in your nifi.properties file, you have configured NiFi to use the managed authorizer:

nifi.security.user.authorizer=managed-authorizer


Make sure that in your nifi.properties, you do NOT have the following property configured to use the single-user-provider:

nifi.security.user.login.identity.provider=

 

If you found that the provided solution(s) assisted you with your query, please take a moment to login and click Accept as Solution below each response that helped.

Thank you,

Matt

 



 

avatar
Master Mentor

@davehkd 

The "Initial Admin Identity" is defined in the file-access-policy provider in the authorizers.xml.

This provider is executed during startup of the application startup and creates an authorizations.xml file where it we set a pre-defined set of NiFi Resource Identifiers (NiFi policies) needed for NiFi administration by  the Initial Admin Identity and set NiFi Resource Identifiers needed by the NiFI nodes defined in "Node Identity <num>".

The file-access-policy-provider has a dependency on a user-group-provider.  This dependency exists because NiFi Resource Identifiers (NiFi Policies) can't be set for any user/client identity strings that are not provided by one of the user-group-providers NiFi offers.  In your case, it appears you are using the file-user-group-provider, which means the nodes and initial admin must be added as "Initial user identity <num>" in that provider.  The file-user-group-provider is responsible for creating the users.xml.

IMPORTANT: These providers will only generate a users.xml and authorizations.xml file if they do NOT already exist.  Expectation is that once created, additional users and setting of additional policies occurs from within the UI.  So configuration changes to these providers will have no impact on already existing users.xmll and authorizations.xml.  So if mistakes where made in configuration resulting in missing needed content in these files, they need to removed after making your config changes so new can be generated.


If you found that the provided solution(s) assisted you with your query, please take a moment to login and click Accept as Solution below each response that helped.

Thank you,

Matt

 

avatar
Contributor

Correction to contents:

 

<authorizer>

  <class>org.apache.nifi.authorization.StandardManagedAuthorizer</class>

  <identifier>managed-authorizer</identifier>

  <property name="Access Policy Provider">file-access-policy-provider</property>

</authorizer>

 

avatar
Contributor

Matt - 

 

You are a gem and a genius!  

I was finally able to access the Users and Policy menu options.

 

A tremendous and heartfelt THANK YOU!

 

Can I send a note of thanks to anyone at Cloudera for the amazing help you provided me!

 

VR,

 

Dave

 

 

 

avatar
Master Mentor

@davehkd 
Thank you for the awesome feedback.  Glad i could help you.

It would be great if you could go through this back and forth exchange and accept all the responses I provided that helped you.  I noticed you accepted your own response.  🙂

Matt