bitcoind: add rpcwhitelist feature
Default behavior for rpc whitelisting is set to 0, which means that rpcwhitelisting is only enforced for rpc users for whom an `rpcwhitelist` exists.
This commit is contained in:
parent
5a978a2836
commit
1bf45a9547
2 changed files with 73 additions and 1 deletions
|
|
@ -28,8 +28,12 @@ let
|
|||
|
||||
# RPC server options
|
||||
rpcport=${toString cfg.rpc.port}
|
||||
rpcwhitelistdefault=0
|
||||
${concatMapStringsSep "\n"
|
||||
(rpcUser: "rpcauth=${rpcUser.name}:${rpcUser.passwordHMAC}")
|
||||
(rpcUser: ''
|
||||
rpcauth=${rpcUser.name}:${rpcUser.passwordHMAC}
|
||||
${optionalString (rpcUser.rpcwhitelist != []) "rpcwhitelist=${rpcUser.name}:${lib.strings.concatStringsSep "," rpcUser.rpcwhitelist}"}
|
||||
'')
|
||||
(attrValues cfg.rpc.users)
|
||||
}
|
||||
${lib.concatMapStrings (rpcbind: "rpcbind=${rpcbind}\n") cfg.rpcbind}
|
||||
|
|
@ -118,6 +122,14 @@ in {
|
|||
format <SALT-HEX>$<HMAC-HEX>.
|
||||
'';
|
||||
};
|
||||
rpcwhitelist = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
description = ''
|
||||
List of allowed rpc calls for each user.
|
||||
If empty list, rpcwhitelist is disabled for that user.
|
||||
'';
|
||||
};
|
||||
};
|
||||
config = {
|
||||
name = mkDefault name;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue