bitcoind: enable cookie-based authentication

This commit is contained in:
nixbitcoin 2021-02-17 13:35:31 +00:00
parent bcad047757
commit 19e401b028
No known key found for this signature in database
GPG key ID: DD11F9AD5308B3BA
2 changed files with 8 additions and 2 deletions

View file

@ -327,8 +327,6 @@ in {
cfg=$(
cat ${configFile}
${extraRpcauth}
${/* Enable bitcoin-cli for group 'bitcoin' */ ""}
printf "rpcuser=${cfg.rpc.users.privileged.name}\nrpcpassword="; cat "${secretsDir}/bitcoin-rpcpassword-privileged"
echo
${optionalString (cfg.getPublicAddressCmd != "") ''
echo "externalip=$(${cfg.getPublicAddressCmd})"
@ -339,6 +337,10 @@ in {
install -o '${cfg.user}' -g '${cfg.group}' -m 640 <(echo "$cfg") $confFile
fi
'';
# Enable RPC access for group
postStart = ''
chmod g=r '${cfg.dataDir}/${optionalString cfg.regtest "regtest/"}.cookie'
'';
serviceConfig = nbLib.defaultHardening // {
Type = "notify";
NotifyAccess = "all";