Member since
09-16-2022
3
Posts
0
Kudos Received
0
Solutions
03-08-2024
02:48 AM
1 Kudo
I just had the same issue. Had to manually modify the `flow.json.gz` like you did. Strange that the UI let me set it to 0 in the first place.
... View more
09-20-2022
11:08 AM
@AyanF I would hope that if you are securing a processor such as HandleHTTPRequest processor to control access to this endpoint, that you have also secured your NiFi instance/cluster as well? SSL/TLS is a very deep subject which is a bit much to discuss end-to-end here, but i will give a 10,000 foot view to help get you started. If so, then somewhere along the line a keystore and truststore were generated to secure your NiFi. Keystore files (keystore or truststore) are not something unique to NiFi nor any NiFi processor that uses them. Keystore and truststores are used to facilitate TLS handshakes and establish a secure and encrypted connection between a client and a server. A keystore used by NiFi would contain a single "PrivateKeyEntry". This privateKeyEntry used by HandleHHTPRequest processor must have an Extended Key Usage (EKU) that support at least serverAuth (for securing NiFi itself it would need both serverAuth and clientAuth EKUs). It must also contain a SubjectAlternativeName (SAN) that contains the hostname of server on which your NiFi is running. Commonly the same keystore used to secure your NiFi instance is also used in the SSLContext service to secure components used in your dataflows but not a requirement. A Truststore contains one too many "TrustedCertEntry"s. The trustedCertEntries are the public keys for self-signed certificates, intermediate, and root Certificate Authorities (CA). TLS works the same accessing a secured NiFi or secured NiFi processor as it does accessing any other https site. The server side of the connection decides if the TLS handshake should be 1-way or mutual. In a 1 way TLS connection, the secured server provides its certificate to the client. The client verify that it trusts that server certificate. The server does not require the client to identify itself via a client certificate. This is how https://www.google.com works.The Server has the option to require/need or want a client certificate. The HandleHTTPRequest processor which would be server side of the TLS connection can be configured for one of those options. In a TLS client and server exchange the certificate DN is always used to identify the server to the client and client to the server. The Client certificate presented must be trusted by the server side as well. An truststore is included with every Java distribution. The file is named "cacerts" and it contains a bunch of trustedCertEntrys for well know CAs. You can view the contents of a keystore like the cacerts file using java's keytool command: keytool -v -list -keystore <path to keystore file>/<keystore filename> Naturally if you create your own certificate it would be self signed and the cacerts file would need to have the public cert/key for your self signed private cert/key added to it. Here is a example process for creating a keystore: https://docs.oracle.com/cd/E19509-01/820-3503/ggfen/index.html There are also services (some free) you can use to generate a signed certificate. Those services will also provide you with the public certs for your truststore. https://www.tinycert.org/ But simply having a keystore and truststore on the NiFi (server) side is not enough to establish a secured connection. The client that is connecting to you NiFi handleHTTPRequest endpoint must also have a truststore. That truststore must contain the public cert/key if using a self signed server side cert or the complete trustchain for CAs that signed your server certificate. What is a trustchain? When you get a server cert signed, it may be signed by an intermediate CA or a root CA. An intermediate CA is a CA that itself has been signed by yet another CA. A root CA is signed by itself (Owner and issuer are same DistinquishedName (DN)). The complete trustschain would involve having every public cert from intermediate CA to the rootCA. Let's say your server cert is signed by intCA1 and intCA1 is signed by rootCA. RootCA is signed by RootCA. So the complete trustschain would require having the public cert/key for both intCA1 and rootCA in the truststore. Now if you choose to have your HandleHttpRequest processor to "need authentication", the client must have a certifcate the truststore configured in your SSLContextService is capable of trusting (meaning it needs to complete trustchain in that truststore for that client cert/key. Keep in mind that any client certificate that is trusted by that truststore will be able to interface with that endpoint. I understand this is a lot, but it only scratches the surface. Hopefully it is enough to get you were you need to be to secure your NiFi and NiFi components. 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 more
09-16-2022
11:56 AM
@noekmc I was not clear that when you accessed the NiFi Web address you were skipping the login window completely. This means that your browser provided and alternative method of client/user authentication. When you access the NiFi web address, NiFi will always negotiate a mutual TLS handshake. This is necessary because this is how NiFi nodes authenticate with one another. If no other methods of client authentication have been configured, the mutual TLS handshake "Requires" a client certificate. When other methods of authentication are configured in NiFi, the mutual TLS handshake will "WANT" a client certificate. If no client certificate is presented, then NiFi will move on to the next configured authentication method which would spnego. Spnego based authentication is enabled when the following properties have been configured in the nifi.properties file: Make sure these two properties are clear to disable spnego auth challenge to your browser. If Spnego auth challenge is not successful, NiFi moves on to next auth method such as a configured login provider like the ldap-provider you have setup. The first step is figuring out which method (TLS client certificate or Spnego) is authenticating your user. Typically a browser will prompt you when either if these methods are invoked the first time. If you ack instead of cancel, the browser will remember that choice going forward. For TLS client auth to work, your browser must have a client certificate loaded in to it that your NiFi's truststore file is capable of trusting. For Spengo to work, Spnego must be configured in your browser. Step one: - Open an incognito browser tab (it will not have any retained cookies that would auto use a certificate or spnego) and provide the NiFi UI address. Does it redirect you immediately to the login UI. If so, you now know one of these other methods are being used. - Clear the two Spnego properties if configured in the nifi.properties file. (if already blank, then we know a TLS certificate is what is being used. - Clear browser cache and cookies. Access NiFi UI address, when prompted via browser for certifcate, cancel and you should get redirected to login window. There is not configuration change that can be made in NiFi to stop a browser from doing this. However, your decision to cancel and continue to URL without providing your certifcate should be cached by your browser so it does not ask you each time afterwards. - Try a different browser. While your certificate maybe loaded in one browser, it may not be loaded in another. Same goes for Spnego, it may not be enabled in all browsers on your client. 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 more