This adds a feature to disable to ability to stop Bitcoin Core over the JSON RPC interface except if the sender is localhost. Based on a suggestion from hebasto in #16543.
All in all it adds a new parameter called rpcallowstop which is by default set to 1. If the parameter is set to 0 it will block all RPC requests with stop Bitcoin Core except if the sender is localhost.
I tested it with the following config file:
regtest=1
[regtest]
server=1
rpcallowstop=0
rpcport=8332
rpcuser=foo
rpcpassword=bar
rpcallowip=192.168.178.71
rpcallowip=127.0.0.1
rpcbind=192.168.178.71
rpcbind=127.0.0.1
A curl request using the internal ip would result in an error. However using 127.0.0.1 would work.