omarsmak / kafka-consumer-lag-monitoring

Client tool that exports the consumer lag of Kafka consumer groups to Prometheus or your terminal
MIT License
50 stars 13 forks source link

SSL support #8

Closed jorgheymans closed 4 years ago

jorgheymans commented 5 years ago

For supporting clusters only exposing SSL listeners you'ld need make these properties configurable on the consumer:

    props.put(SECURITY_PROTOCOL_CONFIG, "SSL");
    props.put(SSL_TRUSTSTORE_LOCATION_CONFIG, "/the/location/of/truststore.jks");
    props.put(SSL_TRUSTSTORE_PASSWORD_CONFIG, "123");
    props.put(SSL_KEYSTORE_LOCATION_CONFIG, "/the/location/of/keystore.jks");
    props.put(SSL_KEYSTORE_PASSWORD_CONFIG, "123");
    props.put(SSL_KEY_PASSWORD_CONFIG, "abc");

If this weren't Kotlin i could have sent a PR :-)

omarsmak commented 5 years ago

Thanks for reporting this. I will try to look at this when I have free time, however it would be great if you can send a PR fix for this. I understand that you are not familiar enough with Kotlin but it could be nice chance for you to get to know about it ;)

jorgheymans commented 5 years ago

allright i'll have a go at this, see what the kotlin fuss is all about :-)

omarsmak commented 5 years ago

Thanks a lot for your help on this, is highly appreciated :). I guess the easiest way to make these settings configurable is to add an additional command parameter to parse a properties file with additional configurations, what do you think?

jorgheymans commented 5 years ago

Yes that makes sense, in fact if the tool would accept the complete kafka client configuration properties file with any possible options as a command line option that would probably be the best going forward. That way you are no longer bothered by adding any new commandline options in the future. If this sounds reasonable to you i will work in that direction. But first i'm still getting my kotlin skills up to speed :-)

omarsmak commented 5 years ago

From the top of my head, the following steps would be taken to add this feature to the client:

  1. Add for a new command line argument for the kafka properties file options here.
  2. Extend the configuration by adding one more field for the additional parsed kafka properties here
  3. Append the new properties here, I think it will be nested, maybe you will need to flatten out perhaps, not 100%?

Then awesome, looking forward to your PR and thank you again for adding this useful feature :-)

apellegr06 commented 4 years ago

Hello,

Is there a roadmap to deliver this possiblity to add standard kafka properties ? I am also interested for the SASL_PLAINTEXT protocol.

omarsmak commented 4 years ago

Will add an option in the coming weeks to make the configurations extendable by the user in order to add the information related to the SSL and other options

apellegr06 commented 4 years ago

Great ! I'm impatient to try it !

omarsmak commented 4 years ago

Hello @jorgheymans @apellegr06 ,

I have added a new option called -f to add a kafka properties file, please note if you supply this file, the bootstrap servers will be taken from the file not from the command line. Will release it today. Please give it a try and report any issues

apellegr06 commented 4 years ago

Hello,

I only need SASL_PLAINTEXT (not SSL) but it works fine, great ! I just add -Djava.security.auth.login.config=my_jaas.conf to the java command line, and add the line security.protocol=SASL_PLAINTEXT in the properties file

Thanks a lot

omarsmak commented 4 years ago

Glad to hear that @apellegr06 !