Commit Graph
100 Commits
Author SHA1 Message Date
Erik Arvstedt 2a9b918f72 generate-secrets: always run with Bash, stop on errors 2020-10-23 10:54:15 +02:00
Erik Arvstedt b574cb097f examples: add deploy-container-minimal.sh 2020-10-20 12:35:23 +02:00
Erik Arvstedt 67e49fe415 services: auto-enable dependencies 2020-10-19 14:55:59 +02:00
Erik Arvstedt d2dbad256f shell.nix: fix failing generate-secrets
generate-secrets failed due to the `PYTHONPATH` env var that was set
through the nixops19_09 buildInput.

Fixes:
- Don't pull in the build environments of binaries that should be
  available in PATH. Only extend PATH instead.
- Run generate-secrets in an empty environment
2020-10-19 11:35:32 +02:00
Erik Arvstedt e61d7b1d46 test: improve lightning-loop regtest 2020-10-19 08:59:26 +00:00
Erik Arvstedt e6340426c1 deploy-container.sh: fix sudo
The 'echo sudo' approach used previously failed when PATH or
NIX_PATH contains spaces. Exec the script with sudo instead.
2020-10-18 13:42:58 +02:00
Erik Arvstedt c19f7ebb01 examples: add option --interactive|-i 2020-10-18 13:42:58 +02:00
Erik Arvstedt 33ff8d82be examples: fix running outside of examples dir 2020-10-18 13:42:54 +02:00
Erik Arvstedt 9951f10e74 test: add scenario 'regtest' 2020-10-16 23:55:13 +02:00
Erik Arvstedt d3ece59919 add module 'versioning' 2020-10-16 23:23:00 +02:00
Erik Arvstedt 1f96ca67c5 electrs test: make service shutdown optional
Needed for regtest scenario.
2020-10-16 18:01:52 +02:00
Erik Arvstedt eb42fc8e06 test: extract test 'joinmarket-yieldgenerator'
Needed for regtest scenario.
2020-10-16 18:01:52 +02:00
Erik Arvstedt 06b2ec5b02 joinmarket: add regtest support 2020-10-16 18:01:52 +02:00
Erik Arvstedt 975b30c90e joinmarket: don't hardcode bitcoind rpc port 2020-10-16 18:01:52 +02:00
Erik Arvstedt 031df4231f joinmarket: move comment out of config file 2020-10-16 18:01:52 +02:00
Erik Arvstedt 848c4c6eda joinmarket: add variable 'bitcoind' 2020-10-16 18:01:52 +02:00
Erik Arvstedt 96b08f5d60 btcpayserver: add regtest support 2020-10-16 18:01:52 +02:00
Erik Arvstedt bd2145dc77 btcpayserver: add 'port' option 2020-10-16 18:01:51 +02:00
Erik Arvstedt 001f8fe8d3 btcpayserver: use option bitcoind.rpc.port 2020-10-16 18:01:51 +02:00
Erik Arvstedt 6f4715ac2a electrs: add regtest support 2020-10-16 18:01:51 +02:00
Erik Arvstedt 46efd141a1 lightning-loop: add regtest support 2020-10-16 18:01:51 +02:00
Erik Arvstedt 75ec85bea2 lnd: add regtest support 2020-10-16 18:01:51 +02:00
Erik Arvstedt 1935c252ec lnd: remove redundant option 'bitcoind-host'
Also set bitcoind rpc port.
2020-10-16 18:01:51 +02:00
Erik Arvstedt b1a8629223 lnd: add variable 'bitcoind' 2020-10-16 18:01:51 +02:00
Erik Arvstedt 937aee0062 spark-wallet: add regtest support 2020-10-16 18:01:50 +02:00
Erik Arvstedt 47d611b5ef spark-wallet: use tor rate provider only when enforceTor 2020-10-16 18:01:50 +02:00
Erik Arvstedt 127b186c3c spark-wallet: simplify start script
Also:
- quote paths
- use long form args
2020-10-16 18:01:50 +02:00
Erik Arvstedt 0f32f3c99e clightning: add regtest support 2020-10-16 18:01:50 +02:00
Erik Arvstedt c24ac5d363 clightning: remove redundant option 'bitcoin-rpcconnect' 2020-10-16 18:01:50 +02:00
Erik Arvstedt abd32cde30 clightning: enable config file read access for group
Enables lightning-cli group access when nonstandard config options are set.
2020-10-16 18:01:50 +02:00
Erik Arvstedt ddadaed3da clightning: always use bind-addr in config
bind-addr can't be null.
2020-10-16 18:01:50 +02:00
Erik Arvstedt 9e928e2097 bitcoind: add regtest support
Remove unsupported option 'testnet'.
2020-10-16 18:01:49 +02:00
Erik Arvstedt bfed10b2fa run-tests: add command 'all'
'all' includes test 'full', which now succeeds.
2020-10-16 16:46:56 +02:00
Erik Arvstedt 0a6b9beda5 run-tests: simplify setting default scenario 2020-10-16 16:46:56 +02:00
Erik Arvstedt 1a32292e07 test: speed up clightning startup when offline 2020-10-16 16:46:56 +02:00
Erik Arvstedt 7d1797cec7 clightning: add option 'extraConfig' 2020-10-16 16:46:56 +02:00
Erik Arvstedt e0117d56d1 spark-wallet: fix always-on onion-chef setting
Previously, the service failed when onion-service was disabled.
2020-10-16 16:46:55 +02:00
Erik Arvstedt 480d0d3959 liquid: fix bitcoin rpc settings
- Remove redundant option mainchainrpchost.
  This option is already provided by bitcoind.
- Set a working default for rpcport and rpcuser.
  Enables use without secure-node.
2020-10-16 16:46:55 +02:00
Erik Arvstedt c07e767889 test: add python test requirements
This allows running the Python tests without importing secure-node.
2020-10-16 16:46:55 +02:00
Erik Arvstedt 9aa19c3fdd extract operator module 2020-10-16 16:46:55 +02:00
Erik Arvstedt 2dd1a741f7 modules: group imports 2020-10-16 16:46:55 +02:00
Erik Arvstedt 1cc432a136 examples/deploy-container: use new extra-container features 2020-10-16 15:53:34 +02:00
Erik Arvstedt 16b2783ae7 examples: enable running outside of working dir 2020-10-16 15:53:34 +02:00
Erik Arvstedt 04075b108c test: use QEMU from stable nixpkgs 2020-10-16 15:53:34 +02:00
Erik Arvstedt 03f8dbba47 test: add non-secure-node eval test
This tests that the modules work without the secure-node template.

The test currently fails at runtime, but evaluating already helps
catching module-related errors.
2020-10-16 15:53:34 +02:00
Erik Arvstedt bb763d6a26 run-tests: add 'eval' command 2020-10-16 15:53:34 +02:00
Erik Arvstedt 36358066e4 spark-wallet: don't disable tor when onion-service is disabled
This fixes modules-only usage.

We can leave enabling tor and tor.client to secure-node.nix, on which
spark-wallet has a strict dependency.
2020-10-16 15:53:33 +02:00
Erik Arvstedt c9251e72a1 README: add run-tests.sh to examples 2020-10-16 15:53:33 +02:00
Erik Arvstedt 5a565dff66 netns test: use netns ips from config 2020-10-16 15:53:33 +02:00
Erik Arvstedt ac95fe7c82 netns test: don't test recurring-donations
This service is not enabled and its netns doesn't exist.
2020-10-16 15:53:33 +02:00
Erik Arvstedt 84744f38d7 netns test: disable backup test 2020-10-16 15:53:33 +02:00
Erik Arvstedt fcc67da9f4 test: add container support 2020-10-16 15:53:33 +02:00
Erik Arvstedt e99b7edb8e run-tests: pass script args verbatim to command without word splitting
Needed for the upcoming 'container' command
2020-10-16 15:53:33 +02:00
Erik Arvstedt e7c397a485 run-tests: rename scriptDir -> testDir
Needed for container support.
2020-10-16 15:53:32 +02:00
Erik Arvstedt b552d17d55 run-tests: fix arg error messages
$1 was not substituted due to single quotes.
2020-10-16 15:53:32 +02:00
Erik Arvstedt 572967d3ad extra-container: pre-release -> 0.5-pre 2020-10-16 15:53:32 +02:00
Erik Arvstedt ac6cee5c12 pkgs: add extra-container 2020-10-11 19:40:26 +02:00
Erik Arvstedt be2127ae5b test: fix noConnections configs
- bitcoind: remove mkForce because otherwise the whole extraConfig is replaced
  by the value of mkForce.

- liquidd: don't disable 'listen' because it is entirely benign in offline
  mode, we also allow it for bitcoind.
2020-10-11 19:40:08 +02:00
Erik Arvstedt 1e18d3ea3b test: improve modularization
This improves debugging and experimenting by making it easy to compose fine-grained
scenarios that have specific tests and features enabled.

The VM test output now includes the subtest name and duration.

Remove the 'raise Exception()' hack for interactive mode.

Run 'banlist-and-restart' test before 'backups'. This speeds up the test
by avoiding an extra shutdown of all bitcoin-related services.
2020-10-11 19:40:08 +02:00
Erik Arvstedt 14d2d97ba6 test: rename scenario withnetns -> netns
This makes the naming consistent with scenarios added in later
commits.
2020-09-30 11:26:41 +02:00
Erik Arvstedt 9bf77ee3e8 backups test: simplify and speed up 2020-09-30 11:26:41 +02:00
Erik Arvstedt fcda69e8b6 netns test: connect from main netns
All services are reachable from the main netns, no need to enter
service network namespaces.

This allows us to remove extra_tests.
2020-09-30 11:26:41 +02:00
Erik Arvstedt 24069aa2c6 electrs: add option 'monitoringPort' 2020-09-30 11:26:41 +02:00
Erik Arvstedt 611cfe5a28 electrs: remove redundant daemonrpc option 2020-09-30 11:26:41 +02:00
Erik Arvstedt a19d3b07c2 electrs: add variable 'bitcoind' 2020-09-30 11:26:41 +02:00
Erik Arvstedt a6dde36b87 electrs: use consistent args formatting
One line per arg.
2020-09-30 11:26:40 +02:00
Erik Arvstedt 45bcbf683d test: rename test.nix -> tests.nix
The plural is consistent with tests.py and run-tests.sh
2020-09-30 11:26:40 +02:00
Erik Arvstedt c92e85f707 test: rename base.py -> tests.py 2020-09-30 11:26:40 +02:00
Erik Arvstedt 774da9d4e0 generate-secrets: fix python version for rpcauth
I accidentally included the minor version number.
Version 3.5 has been removed from nixpkgs unstable.
2020-09-24 16:32:38 +02:00
Erik Arvstedt 6f032e3c40 lnd: fix mnemonic file access vulnerability
Previously, the file was readable by 'other' for a short time after
creation.
2020-09-15 12:09:00 +00:00
Erik Arvstedt 9b6a3ec835 generate-secrets: extract fn 'makeHMAC' 2020-08-27 12:20:06 +02:00
Erik Arvstedt ca18ffb90a generate-secrets: fetch rpcauth.py from github
No need to vendor this.
2020-08-27 12:20:06 +02:00
Erik Arvstedt 4d6127bb76 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
2020-08-27 12:19:49 +02:00
Erik Arvstedt 9d610991be bitcoind: remove custom rpc user names
Simpler.
We've just removed option 'bitcoind.rpcuser', so we can also remove the
old name 'bitcoinrpc'.
2020-08-27 11:39:26 +02:00
Erik Arvstedt 1408403dec bitcoind: clarify how bitcoin-cli RPC access is enabled
It's not immediately clear why rpcuser/rpcpassword are needed in addition to the rpcauth
config entries.
2020-08-26 22:52:47 +02:00
Erik Arvstedt 4790c601a1 bitcoind: move rpc user config to bitcoind
This enables modules-only usage.
The privileged user is needed by bitcoind (cli), the public user is
needed by other services.
2020-08-26 22:52:47 +02:00
Erik Arvstedt 876cfadf1a bitcoind: add rpc user option 'passwordHMACFromFile'
This allows adding additional rpc users without the need for
user-specific code in preStart.
2020-08-26 22:52:47 +02:00
Erik Arvstedt 59434e79f0 bitcoind: simplify default rpc user name config 2020-08-26 21:16:32 +02:00
Erik Arvstedt 205829b91f bitcoind: remove whitespace 2020-08-26 21:16:32 +02:00
Erik Arvstedt e5fb3f6a7f run-tests: document how to pass extra build args 2020-08-25 14:58:04 +02:00
Erik Arvstedt df790f6766 run-tests: allow linking test build results for all scenarios 2020-08-25 14:58:04 +02:00
Erik Arvstedt 91697b1427 test: allow for testing all scenarios
Test all scenarios by default when running 'build' (which happens
when the script is called without arguments).

Default to scenario 'default' in other test commands like 'debug'.
2020-08-25 14:53:13 +02:00
Erik Arvstedt 28236691aa test: rename scenarios/lib.py -> base.py
This file isn't a scenario, it's also not a lib because it contains
the main share of actual tests.
2020-08-25 14:53:13 +02:00
Erik Arvstedt 80da0a41bc test: load complete test environment in debug mode
Stop just before executing actual tests.
This makes all test functions accessible in debug mode.
2020-08-25 14:53:12 +02:00
Erik Arvstedt 9b4cd7bd1c test: simplify scenario handling
We can switch to a more sophisticated scheme later when adding more scenarios
2020-08-25 14:53:12 +02:00
Erik Arvstedt 0f56ea6ad1 test: include scenario in test name 2020-08-25 14:53:12 +02:00
Erik Arvstedt 9237e5dc3d test: use pydoc docstring 2020-08-25 14:53:12 +02:00
Erik Arvstedt ed73627e02 netns-exec: minor style fixes
- Use inline variable declarations
- Improve messages
- Fix naming: available -> allowed
- Simplify intro comment
2020-08-25 14:53:12 +02:00
Erik Arvstedt 91ebc2d517 netns-exec: simplify installation 2020-08-25 14:53:12 +02:00
Erik Arvstedt 809e754851 netns: improve bridge setup
- Explain why we don't use option `networking.bridges`
- Make the bridge setup service part of NixOS' network-setup.service.
  This yields no noticable functional changes for now, but it's
  conceptually cleaner to finish the network setup before network.target
  becomes active.
- Add 'nb-' prefix to service name
2020-08-25 14:53:12 +02:00
Erik Arvstedt b7450877a0 netns: rename bridge peer devices br-nb-veth* -> nb-veth-br*
This ensures a consistent 'nb-' namespace and simplifies the
dhcpcd.denyInterfaces rules.

Also rename vethName -> veth.
2020-08-25 14:53:12 +02:00
Erik Arvstedt 8bfb7bb2f8 netns: rename bridge br0 -> nb-br
br0 has a high risk of name clashes when nix-bitcoin used as part of a
larger config.
Use a more specific name.
2020-08-25 14:53:08 +02:00
Erik Arvstedt 32e70a7516 netns: move webindex config for modules-only usage
webindex is only available in secure-node.
2020-08-25 11:40:27 +02:00
Erik Arvstedt 121301337b netns: add option 'allowedUser' for modules-only usage
The dependency on secure-node.nix prevented using nix-bitcoin by just
importing modules.nix.
2020-08-25 11:40:27 +02:00
Erik Arvstedt 9715134f06 netns: don't repeat cli definitions
1. Saves some code.
2. Guarantees that the netns and no-netns cli defs are always in sync.
2020-08-25 11:40:27 +02:00
Erik Arvstedt e385c73256 netns: separate implementation and service configs
This greatly improves clarity.

Especially the bitcoind-import-banlist.serviceConfig definition was out
of place.
2020-08-25 11:40:27 +02:00
Erik Arvstedt d0b8d77de2 netns: remove conditionals for service settings
Going without the conditionals (like in secure-node.nix) adds
readability and doesn't reduce evaluation performance (in fact, it
even slightly improves performance due to implementation details
of mkIf).

To avoid errors, remove use of disabled services in secure-node.nix and
nix-bitcoin-webindex.nix.
2020-08-25 11:40:27 +02:00
Erik Arvstedt 0f0f6ddbb9 netns: add comment about undesirable algorithmic complexity
We don't want to be Accidentally Quadratic™
2020-08-25 11:40:26 +02:00
Erik Arvstedt a3ae8668e6 netns: use map instead of concatMap 2020-08-25 11:40:26 +02:00
Erik Arvstedt b7fc819be5 netns: consistent var naming
n is used elsewhere in similar contexts.
2020-08-25 11:40:26 +02:00