Blizzard / node-rdkafka

Node.js bindings for librdkafka
MIT License
2.11k stars 392 forks source link

Unable to connect MKS via ssl with node 18 #1031

Open AnirudhaGohokar opened 1 year ago

AnirudhaGohokar commented 1 year ago

Environment Information

Looks like there's a openssl comptability issue with librdkafka when using node 18.9. It works fine with node 12. Giving below error with node 18:

{"message":"Failed to parse ssl.keystore.location PKCS#12 file: /usr/../kafka.client.keystore.jks: error:0308010C:digital envelope routines::unsupported: Global default library context, Algorithm (RC2-40-CBC : 0), Properties ()","code":-172,"errno":-172,"origin":"kafka","stack":"Error: Failed to parse ssl.keystore.location PKCS#12 file: /usr/src../kafka.client.keystore.jks: error:0308010C:digital envelope routines::unsupported: Global default library context, Algorithm (RC2-40-CBC : 0), Properties ()\n    at Function.createLibrdkafkaError [as create] (/usr/src/app/node_modules/node-rdkafka/lib/error.js:456:10)\n    at /usr/src/app/node_modules/node-rdkafka/lib/client.js:196:28"}

AnirudhaGohokar commented 1 year ago

Okay seems like the issue is with my keystore key which is not compatible with node 18.

openssl pkcs12 -in kafka.client.keystore.jks //gives error

With legacy attr it works perfectly

openssl pkcs12 -in kafka.client.keystore.jks --legacy //works

I will try to overrite openssl to enable legacy support. Will get back if this fixes or not.

coocos commented 1 year ago

Yeah, the problem is that the keystore uses a legacy algorithm. A workaround is to enable the legacy provider in Node 18 through the NODE_OPTIONS environment variable, e.g. export NODE_OPTIONS=--openssl-legacy-provider.

mreouven commented 11 months ago

i get Segmentation fault (core dumped)