bitcoind: remove banlist loader
Gmaxwell's banlist (https://people.xiph.org/~greg/banlist.cli.txt) is no longer maintained and hasn't been updated since 2 years.
This commit is contained in:
parent
7e94b7eddc
commit
8dc4858872
@ -65,7 +65,7 @@ A [configuration preset](modules/presets/secure-node.nix) for setting up a secur
|
|||||||
|
|
||||||
NixOS modules ([src](modules/modules.nix))
|
NixOS modules ([src](modules/modules.nix))
|
||||||
* Application services
|
* Application services
|
||||||
* [bitcoind](https://github.com/bitcoin/bitcoin), with a default banlist against spy nodes
|
* [bitcoind](https://github.com/bitcoin/bitcoin)
|
||||||
* [clightning](https://github.com/ElementsProject/lightning) with support for announcing an onion service\
|
* [clightning](https://github.com/ElementsProject/lightning) with support for announcing an onion service\
|
||||||
Available plugins:
|
Available plugins:
|
||||||
* [clboss](https://github.com/ZmnSCPxj/clboss): automated C-Lightning Node Manager
|
* [clboss](https://github.com/ZmnSCPxj/clboss): automated C-Lightning Node Manager
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -428,31 +428,6 @@ in {
|
|||||||
// optionalAttrs zmqServerEnabled nbLib.allowNetlink;
|
// optionalAttrs zmqServerEnabled nbLib.allowNetlink;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Use this to update the banlist:
|
|
||||||
# wget https://people.xiph.org/~greg/banlist.cli.txt
|
|
||||||
systemd.services.bitcoind-import-banlist = {
|
|
||||||
description = "Bitcoin daemon banlist importer";
|
|
||||||
wantedBy = [ "bitcoind.service" ];
|
|
||||||
bindsTo = [ "bitcoind.service" ];
|
|
||||||
after = [ "bitcoind.service" ];
|
|
||||||
script = ''
|
|
||||||
cd ${cfg.cli}/bin
|
|
||||||
echo "Importing node banlist..."
|
|
||||||
cat ${./banlist.cli.txt} | while read line; do
|
|
||||||
if ! err=$(eval "$line" 2>&1) && [[ $err != *already\ banned* ]]; then
|
|
||||||
# unexpected error
|
|
||||||
echo "$err"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
'';
|
|
||||||
serviceConfig = nbLib.defaultHardening // {
|
|
||||||
User = cfg.user;
|
|
||||||
Group = cfg.group;
|
|
||||||
ReadWritePaths = [ cfg.dataDir ];
|
|
||||||
} // nbLib.allowLocalIPAddresses;
|
|
||||||
};
|
|
||||||
|
|
||||||
users.users.${cfg.user} = {
|
users.users.${cfg.user} = {
|
||||||
isSystemUser = true;
|
isSystemUser = true;
|
||||||
group = cfg.group;
|
group = cfg.group;
|
||||||
|
@ -303,7 +303,6 @@ in {
|
|||||||
netns.bitcoind.address
|
netns.bitcoind.address
|
||||||
] ++ map (n: netns.${n}.address) netns.bitcoind.availableNetns;
|
] ++ map (n: netns.${n}.address) netns.bitcoind.availableNetns;
|
||||||
};
|
};
|
||||||
systemd.services.bitcoind-import-banlist.serviceConfig.NetworkNamespacePath = "/var/run/netns/nb-bitcoind";
|
|
||||||
|
|
||||||
services.clightning.address = netns.clightning.address;
|
services.clightning.address = netns.clightning.address;
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ let
|
|||||||
../modules/presets/secure-node.nix
|
../modules/presets/secure-node.nix
|
||||||
];
|
];
|
||||||
tests.secure-node = true;
|
tests.secure-node = true;
|
||||||
tests.banlist-and-restart = true;
|
tests.restart-bitcoind = true;
|
||||||
|
|
||||||
# Stop electrs from spamming the test log with 'WARN - wait until IBD is over' messages
|
# Stop electrs from spamming the test log with 'WARN - wait until IBD is over' messages
|
||||||
tests.stop-electrs = true;
|
tests.stop-electrs = true;
|
||||||
|
@ -361,31 +361,18 @@ def _():
|
|||||||
assert_file_exists("secrets/lnd-wallet-password")
|
assert_file_exists("secrets/lnd-wallet-password")
|
||||||
|
|
||||||
# Impure: restarts services
|
# Impure: restarts services
|
||||||
@test("banlist-and-restart")
|
@test("restart-bitcoind")
|
||||||
def _():
|
def _():
|
||||||
machine.wait_until_succeeds(log_has_string("bitcoind-import-banlist", "Importing node banlist"))
|
|
||||||
assert_no_failure("bitcoind-import-banlist")
|
|
||||||
|
|
||||||
# Current time in µs
|
|
||||||
pre_restart = succeed("date +%s.%6N").rstrip()
|
|
||||||
|
|
||||||
# Sanity-check system by restarting bitcoind.
|
# Sanity-check system by restarting bitcoind.
|
||||||
# This also restarts all services depending on bitcoind.
|
# This also restarts all services depending on bitcoind.
|
||||||
succeed("systemctl restart bitcoind")
|
succeed("systemctl restart bitcoind")
|
||||||
|
|
||||||
# Now that the bitcoind restart triggered a banlist import restart, check that
|
|
||||||
# re-importing already banned addresses works
|
|
||||||
machine.wait_until_succeeds(
|
|
||||||
log_has_string(f"bitcoind-import-banlist --since=@{pre_restart}", "Importing node banlist")
|
|
||||||
)
|
|
||||||
assert_no_failure("bitcoind-import-banlist")
|
|
||||||
|
|
||||||
@test("regtest")
|
@test("regtest")
|
||||||
def _():
|
def _():
|
||||||
def enabled(unit):
|
def enabled(unit):
|
||||||
if unit in enabled_tests:
|
if unit in enabled_tests:
|
||||||
# Wait because the unit might have been restarted in the preceding
|
# Wait because the unit might have been restarted in the preceding
|
||||||
# 'banlist-and-restart' test
|
# 'restart-bitcoind' test
|
||||||
machine.wait_for_unit(unit)
|
machine.wait_for_unit(unit)
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user