Open ChrisSamo632 opened 1 month ago
Thanks for this detailed write up @ChrisSamo632 I think this highlights a missing set of tests in NiPy, as the current 'secure' test is really TLS/LDAP (a common requirement), but I think we should also be testing mTLS. I will make a note to implement a docker test setup for mTLS and try to cover this case.
Description
Connections to TLS-secured (with custom certificates) NiFi fails after setting
nipyapi.security.set_service_ssl_context
- trying to get the service status times out (withbool_response=True
) or fairly quickly with aurllib3
error ifbool_response=False
:From a quick look online, it seems there have been changes to the
urllib3
/ssl
library setup through recent versions of Python, which is possibly causing the problem:This worked for me when creating an
ssl_context
manually withPurpose.SERVER_AUTH
instead of thePurpose.CLIENT_AUTH
that NiPyApi uses when acert
/key
are specified in thenipyapi.security.set_service_ssl_context
call.What I Did
nipyapi.security.set_service_ssl_context
To fix/workaround, I am instead:
I assume it would be the same for NiFi Registry, although I haven't tested because I've been able to do everything I needed with NiFi Toolkit instead of NiPyApi.
Additional Note
If running NiFi with the "Single User" setup, and not having cert/key files available (they could probably be extracted from the auto-generated Keystore & Truststore, but I haven't), I've instead setup an unverified SSL Context:
Urgency
Not urgent as I figured out a workaround.
A suggested approach might be to allow users to specify the
Purpose
for the SSL Context through the NiPyApi function - this would allow users to be more explicit for their version of Python (if such a background change is in fact what's caught me out here)