Chaffelson/nipyapi

[In Progress] NIFI Secure Connection failed with certificate

maykiwo opened this issue · 6 comments

  • Nipyapi version: nipyapi-0.19.1
  • NiFi version: 1.16.0
  • NiFi-Registry version:
  • Python version: 3.8
  • Operating System: Centos

Description

I have a nifi standalone 1.16.0 running securely. I generated self signed certificate using nifi-toolkit and provided the cert/key files in below code but secure connection is failing

What I Did

import nipyapi
import urllib3

if __name__ == '__main__':
    
   
    urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

    nipyapi.config.nifi_config.host = 'https://localhost:9091/nifi-api'
    nipyapi.config.nifi_config.key_file = '../cert/cert.key'
    nipyapi.config.nifi_config.cert_file = '/../cert/cert.cer'
    nipyapi.config.nifi_config.ssl_ca_cert = '../cert/cacerts.cer'
    nipyapi.config.nifi_config.verify_ssl = False
    nipyapi.config.registry_config.host = 'https://localhost:19091/nifi-registry-api'

    nipyapi.canvas.get_root_pg_id()

And get error :

/usr/lib/python3/dist-packages/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (2.0.4) or chardet (3.0.4) doesn't match a supported version! warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "

Urgency

Testing nipyapi

This is not a nipyapi error, it has to do with your python installation.
The error is saying that the requests package cannot satisfy it's version dependency for either urllib or chardet.
You probably need to look with pip at what you have installed for all of those things and maybe force the install of the required version.
If you are not working in a virtual env, you may want to, that way you can just install the versions you need for this app and not mess anything else up.

Thanks a lot for quick reply

One thing why I got the issue for nifi registry, normally it is used the same client certificate, and with curl it is working.

Do i need add something more ?

WARNING:urllib3.connectionpool:Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fbfe0f6c130>: Failed to establish a new connection: [Errno 111] Connection refused')': /nifi-registry-api/buckets

I'm not sure about that. @Chaffelson ?

This is usually the response when the authenticated user does not have permissions - an authorization error, rather than an authentication one. Have you given the user the appropriate permissions in Registry to match those in NiFi?

Thanks @Chaffelson

Yes, before use NiPyApi, I have already done the curl command to "nifi-registry-api/buckets" and it works. I got the result so it is not a permission issue