Skip to content

Commit

Permalink
Add documentation for hashing passwords
Browse files Browse the repository at this point in the history
Fixes #7432

Adds HTTP API documentation as well as `rabbitmqctl hash_password` docs.

Add `rabbitmqctl` docs

(cherry picked from commit f420487)
(cherry picked from commit 7efd584)
(cherry picked from commit 1e49ff3)
  • Loading branch information
lukebakken authored and mergify[bot] committed Feb 27, 2023
1 parent 7e2d4a9 commit b52e747
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
9 changes: 9 additions & 0 deletions deps/rabbit/docs/rabbitmqctl.8
Original file line number Diff line number Diff line change
Expand Up @@ -2222,6 +2222,15 @@ The name of the queue to purge.
.Pp
Purges a queue (removes all messages in it).
.El
.\" ------------------------------------------------------------------
.It Cm hash_password Ar plaintext
.Bl -tag -width Ds
.It Ar plaintext
The plaintext password to hash
.El
.Pp
Hashes a plaintext password according to the currently configured password hashing algorithm
.El
.\" ------------------------------------------------------------------------------------------------
.Sh PLUGIN COMMANDS
.\" ------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ defmodule RabbitMQ.CLI.Ctl.Commands.HashPasswordCommand do

@behaviour RabbitMQ.CLI.CommandBehaviour
use RabbitMQ.CLI.Core.MergesNoDefaults
use RabbitMQ.CLI.DefaultOutput

def run([cleartextpassword], _opts) do
hash_password(cleartextpassword)
Expand Down Expand Up @@ -46,11 +45,16 @@ defmodule RabbitMQ.CLI.Ctl.Commands.HashPasswordCommand do
:ok
end

## Use default output for all non-special case outputs
use RabbitMQ.CLI.DefaultOutput

def usage, do: "hash_password <cleartext_password>"

def banner([arg], _options),
do: "Will hash password #{arg}"

def banner([], _options),
do: "Will hash provided password"

def description(), do: "Hashes a plaintext password"
end
10 changes: 10 additions & 0 deletions deps/rabbitmq_management/priv/www/api/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1157,6 +1157,16 @@ <h2>Reference</h2>
A list of authentication attempts by remote address and username.
</td>
</tr>
<tr>
<td>X</td>
<td></td>
<td></td>
<td></td>
<td class="path">/api/auth/hash_password/<i>plaintext-password</i></td>
<td>
Hashes <code>plaintext-password</code> according to the currently configured password hashing algorithm.
</td>
</tr>
</table>


Expand Down

0 comments on commit b52e747

Please sign in to comment.