-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
assign user with given password or check existing one #91
Comments
After I've taken a look at kafkactl code, it appears it needs a ns4kafka evolution before reporting it in kafkactl.
|
Hey @piif, To sum up, you'd like to:
Point 1 can be interesting. As you mentioned the whole business logic is held by the Ns4Kafka API. But:
For point 2, what would be the point of checking a password matches a Kafka user ?
|
Hi @loicgreffier , By the way, when you say KafkaUser resource would be a breaking change, I don't fully agree since it does not exists today. I agree with the idea of a |
A
Could you provide more information regarding your CI use case for password reset to challenge if a User resource would be valuable ? Anyway, with the current implementation:
➡ Agree with that ?
|
Hello @loicgreffier , sorry for the delay, I had to work on another task.
|
Right now I'm reconsidering that a
Which approach would suit you the best ? Would you want to contribute to the |
KafkaUser resource is clearly my first choice, but I don't know micronaut and didn't code in java for several years :-) |
Hi, Usage :
It seems to work in my basic usage, but I don't have environments with several cluster to check if it's all fine, nor I didn't checked what happened in case of connection failure to target cluster |
I began to look at "apply" solution, but I've several questions :
Do you think we have to store Last question : do you think "apply" API must require password field ? if this field is omitted, should it mean to keep current password, or to reset and return a new one ? |
@piif I would be in favor of having a single endpoint for that. What I suggest is:
This would minimize changes from Kafkactl. |
A Suggesting this point in the review. |
Password check has a much cleaner solution. I strongly recommend using this instead. Step 1: Pull out the SCRAM server fields from Kafka using # kafka-configs --describe --entity-type users
# Configs for user-principal 'post_install_test_producer' are producer_byte_rate=102400,SCRAM-SHA-512=salt=MTZlcmNvbmtoZWpxOWR3OGdzNWFqYm81YnI=,stored_key=JXOkH3OQyWB2mmsYTHkCeTPf9ozDslgzLvinG2z9AJEizOpZDgxCdxkOfmtWyfxXe3vouBAcgtXoV8NU4aC/5Q==,server_key=9oAYdMDGr7g1rH5TertR0vFj6lf0O4U68WMoAV1O2uP7e3hLuP1P0vwzS+skCwzc+Q6GCXQQSYNpIojXkXkPJA==,iterations=4096,consumer_byte_rate=102400
# Configs for user-principal 'perf_test' are producer_byte_rate=104857600,SCRAM-SHA-512=salt=cTFlM3AybWlrOGlrcndpeXJwcWcyNHFtNg==,stored_key=kAVpmVasCKPRrnrxvHgqXxHyxFR2kYlRj5lkCNsjU6YTjbKfb6L41PCWNFUSAv1ge7ENu1s1AucyUzUvTo4U3g==,server_key=USLipj1qt9XjdjZl+VQLJwBBEtIQUEHFwSUNK1v3DmTdrDxl9CqxoH5pZCCsABR3o7BYXOnjQUYrSurBKrmk0A==,iterations=4096,consumer_byte_rate=104857600 Step 2: Compare with clear password from passlib.hash import scram
import hmac
import hashlib
import base64
class Scram_Check:
@staticmethod
def SamePassword(clear_password, broker_password_config, algorithm='sha-512'):
if not broker_password_config:
return False
_algorithms = {"sha-512": hashlib.sha512, "sha-256": hashlib.sha256}
salt = base64.b64decode(broker_password_config["salt"])
iterations = int(broker_password_config["iterations"])
expected_server_key = broker_password_config["server_key"]
salted_hash = scram.derive_digest(clear_password, salt, iterations, algorithm)
calc_server_key = hmac.new(salted_hash,
'Server Key'.encode('utf-8'),
_algorithms[algorithm]
).digest()
result = base64.b64encode(calc_server_key).decode('utf-8')
return result == expected_server_key |
Problem
reset-password
subcommand generates a password, but in a CI context is should be interesting to check if an existing user matches a given password, to decide if it must be updated, and force it to a given value if neededSuggestion
--password
onreset-password
subcommandcheck-password
subcommand returning a statusAlternatives Considered
source to input required password may be stdin or a prompt
The text was updated successfully, but these errors were encountered: