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

View File

@ -46,14 +46,12 @@ def run_tests(extra_tests):
assert_running("bitcoind") assert_running("bitcoind")
machine.wait_until_succeeds("bitcoin-cli getnetworkinfo") machine.wait_until_succeeds("bitcoin-cli getnetworkinfo")
assert_matches("su operator -c 'bitcoin-cli getnetworkinfo' | jq", '"version"') assert_matches("su operator -c 'bitcoin-cli getnetworkinfo' | jq", '"version"')
# Test RPC Whitelist # RPC access for user 'public' should be restricted
machine.wait_until_succeeds("su operator -c 'bitcoin-cli help'")
# Restating rpcuser & rpcpassword overrides privileged credentials
machine.fail( 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( 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") assert_running("electrs")