fgeller / kt

Kafka command line tool that likes JSON
MIT License
950 stars 100 forks source link

feature: support auth sasl-plain #118

Closed ducnt114 closed 3 years ago

ducnt114 commented 3 years ago

support authen by sasl-plain

fgeller commented 3 years ago

@ducnt114 that's awesome - thanks mate! do you think it would be possible to provide a test setup for the docker environment we use to test?

fgeller commented 3 years ago

the system test currently uses test-secrets/auth.json to setup tls, but we'd have to re-configure the dockerized kafka as well. i won't have time for that in the near future, but would gladly pull that in as well if you could find the time to add it.

fgeller commented 3 years ago

meanwhile, i'm assuming you tested it for your setup? (i.e. i can't test it actually works at this point and would pull the changes in optimistically? 😬 )

fgeller commented 3 years ago

also, this partially fixes #113 -- thanks again @ducnt114

ducnt114 commented 3 years ago

meanwhile, i'm assuming you tested it for your setup? (i.e. i can't test it actually works at this point and would pull the changes in optimistically? 😬 )

Yes, I tested on my cluster with sasl_plaintext setup and it worked.

Config file server.properties:

# List of enabled mechanisms, can be more than one
sasl.enabled.mechanisms=PLAIN

# Specify one of of the SASL mechanisms
sasl.mechanism.inter.broker.protocol=PLAIN

security.inter.broker.protocol=SASL_PLAINTEXT

listeners=SASL_PLAINTEXT://localhost:9093
advertised.listeners=SASL_PLAINTEXT://localhost:9093

listener.name.sasl_plaintext.plain.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required \
   username="admin" \
   password="admin-secret" \
   user_admin="admin-secret" \
   user_kafkabroker1="kafkabroker1-secret";

Auth file for kt auth.json:

{
    "mode": "SASL",
    "sasl_plain_user": "admin",
    "sasl_plain_password": "admin-secret"
}
fgeller commented 3 years ago

@ducnt114 sweet - i'll merge as is then, thanks!