HomePhabricator

rpcauth: Improve by using argparse and getpass modules

Description

rpcauth: Improve by using argparse and getpass modules

Summary:

This PR improves argument handling in rpcauth.py script by using
argparse module. Specifying - as password makes it prompt securely with
getpass module which prevents leaking passwords to bash history.

Backport of core PR14756
https://github.com/bitcoin/bitcoin/pull/14756/files

Depends on D3781.

Also updated the copyright so the file is in sync with core.

Test Plan:

make check

./share/rpcauth/rpcauth.py foo --help

Check help is displayed correctly.

./share/rpcauth/rpcauth.py foo -

Check the script asks for password.

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D3782

Details

Provenance
João Barbosa <joao.paulo.barbosa@gmail.com>Authored on Nov 19 2018, 15:10
FabienCommitted on Aug 5 2019, 07:14
FabienPushed on Aug 5 2019, 07:14
Reviewer
Restricted Project
Differential Revision
D3782: rpcauth: Improve by using argparse and getpass modules
Parents
rABCa8b8600adee7: Properly generate salt in rpcauth.py, update tests
Branches
Unknown
Tags
Unknown