Skip to content

Add rabbitmqctl / HTTP API docs for hashing password #1613

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

Merged
merged 1 commit into from
Feb 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions site/passwords.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,29 @@ To do so:

## <a id="computing-password-hash" class="anchor" href="#computing-password-hash">Computing Password Hashes</a>

Sometimes it is necessary to compute a user's password hash, to updated via the [HTTP API](management.html)
or generate a [definitions file](definitions.html) to import.
Sometimes it is necessary to compute a user's password hash for updating via the [HTTP API](management.html)
or to generate a [definitions file](definitions.html) to import.

This is the algorithm:
### Hash via `rabbitmqctl`

<pre class="lang-bash">
rabbitmqctl hash_password foobarbaz

# Output:
# Will hash password foobarbaz
# 27cx5+wEi8R8uwTeTr3hk5azuV3yYxxAtwPPhCyrbdsxVhqq
</pre>

### Hash via HTTP API

<pre class="lang-bash">
curl -4su guest:guest -X GET localhost:15672/api/auth/hash_password/foobarbaz

# Output:
# {"ok":"TBybOvomyVw6BqBU/fHCEpVhDO7fLdQ4kxZDUpt6hagCxV8I"}
</pre>

### This is the algorithm:

* Generate a random 32 bit salt. In this example, we will use `908D C60A`. When RabbitMQ creates or updates a user, a random salt is generated.
* Concatenate the generated salt with the UTF-8 representation of the desired password.
Expand Down