bitcoind: clarify RPC whitelist test

- Remove redundant comment
- Test with obviously unsafe RPC call 'stop'
- No need to test privileged user who has no whitelist
This commit is contained in:
Erik Arvstedt 2020-08-27 12:17:39 +02:00
parent 9d610991be
commit 4d6127bb76
No known key found for this signature in database
GPG Key ID: 33312B944DD97846
1 changed files with 3 additions and 5 deletions

View File

@ -46,14 +46,12 @@ def run_tests(extra_tests):
assert_running("bitcoind")
machine.wait_until_succeeds("bitcoin-cli getnetworkinfo")
assert_matches("su operator -c 'bitcoin-cli getnetworkinfo' | jq", '"version"')
# Test RPC Whitelist
machine.wait_until_succeeds("su operator -c 'bitcoin-cli help'")
# Restating rpcuser & rpcpassword overrides privileged credentials
# RPC access for user 'public' should be restricted
machine.fail(
"bitcoin-cli -rpcuser=public -rpcpassword=$(cat /secrets/bitcoin-rpcpassword-public) help"
"bitcoin-cli -rpcuser=public -rpcpassword=$(cat /secrets/bitcoin-rpcpassword-public) stop"
)
machine.wait_until_succeeds(
log_has_string("bitcoind", "RPC User public not allowed to call method help")
log_has_string("bitcoind", "RPC User public not allowed to call method stop")
)
assert_running("electrs")