Skip to content
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

How to create a user with a salt/hash? #222

Open
ashtonian opened this issue Mar 9, 2021 · 7 comments
Open

How to create a user with a salt/hash? #222

ashtonian opened this issue Mar 9, 2021 · 7 comments

Comments

@ashtonian
Copy link

How do I create/add a user with a salt/hash using this plugin?

@nnilsson123
Copy link

Did you ever figure this out?

@ashtonian
Copy link
Author

nope

@ashtonian
Copy link
Author

ashtonian commented Jul 20, 2021

@HJianBo, @huangdan sorry to directly tag, any input? #223 #176 are the same issue.

@nnilsson123
Copy link

nnilsson123 commented Jul 20, 2021

Checking the source code, things look pretty sensible. I'm no Erlang pro, but seems that with e.g. salt,sha256, one should be able to simply run sha256 on your string like <salt><password> and everything should work. But it just doesn't.

I believe my issues could be connected to the hexstring methods yielding a lower-case hexstring, and the PassHash and resulting hexstring comparison is case-sensitive.

@nnilsson123
Copy link

Can confirm that turning my hash to lower-case solved my issues, and everything now works great!

@ashtonian
Copy link
Author

do you have example code ? Im using go but can I can port it

@nnilsson123
Copy link

nnilsson123 commented Jul 22, 2021

Psuedocode: lowercase(sha256(concatenate(salt,password)))
This works with the salt,sha256 configuration (which can be configured using the EMQX_AUTH__PGSQL__PASSWORD_HASH environment variable, or equivalently in the corresponding config file).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants