summary refs log tree commit diff
path: root/synapse/_scripts/hash_password.py
diff options
context:
space:
mode:
authoreyJhb <eyjhb@eyjhb.dk>2024-08-27 19:51:43 +0200
committerGitHub <noreply@github.com>2024-08-27 18:51:43 +0100
commit8da16e55fed6c880a61140e7375eac2e31494f81 (patch)
treebee980ef993a2184a61f95f6213173876fbcf4b4 /synapse/_scripts/hash_password.py
parentBump pyyaml from 6.0.1 to 6.0.2 (#17611) (diff)
downloadsynapse-8da16e55fed6c880a61140e7375eac2e31494f81.tar.xz
hash_password accepts stdin now (#17608)
`hash_password` now actually accepts password from stdin. The `getpass`
reads from TTY, and does NOT accept stdin in any way.

The manpage has been updated to reflect that.
Diffstat (limited to '')
-rwxr-xr-xsynapse/_scripts/hash_password.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/synapse/_scripts/hash_password.py b/synapse/_scripts/hash_password.py

index 3bed367be2..2b7d3585cb 100755 --- a/synapse/_scripts/hash_password.py +++ b/synapse/_scripts/hash_password.py
@@ -56,7 +56,9 @@ def main() -> None: password_pepper = password_config.get("pepper", password_pepper) password = args.password - if not password: + if not password and not sys.stdin.isatty(): + password = sys.stdin.readline().strip() + elif not password: password = prompt_for_pass() # On Python 2, make sure we decode it to Unicode before we normalise it