Commit Graph
100 Commits
Author SHA1 Message Date
nixbitcoin d6d3e8ff62 joinmarket: add tests 2020-09-22 13:50:45 +00:00
nixbitcoin cce27da2ec backups: add joinmarket datadir to includelist 2020-09-22 13:50:43 +00:00
nixbitcoin 173891fa5b joinmarket: add module 2020-09-22 13:50:37 +00:00
nixbitcoin 263525d724 nix-bitcoin-services: add nb-services.privileged helper 2020-09-22 13:43:15 +00:00
nixbitcoin f00d1d24c5 joinmarket: add pkg and local dependencies 2020-09-22 13:43:08 +00:00
nixbitcoin c9c844de80 btcpayserver: add tests 2020-09-15 12:09:35 +00:00
nixbitcoin f93c3c8405 backups: add nbxplorer and btcpayserver datadir to includelist 2020-09-15 12:09:33 +00:00
nixbitcoin 605b37c16e nodeinfo: add btcpayserver onion 2020-09-15 12:09:31 +00:00
nixbitcoin 15b574faa7 nbxplorer/btcpayserver: add module 2020-09-15 12:09:12 +00:00
nixbitcoin 46d681a17e lnd: generate custom macaroons
Create new `macaroon` option that allows any module to place its own
custom macaroon in the lnd RuntimeDirectory `/run/lnd`.
2020-09-15 12:09:02 +00:00
nixbitcoin b97584f5cb netns: allow return traffic to outgoing connections 2020-09-15 12:08:58 +00:00
nixbitcoin fc15d507ff loop: adjust test to new message 2020-08-30 08:07:02 +00:00
nixbitcoin e56d5365cb loop: update 0.7.0 -> 0.8.1 2020-08-30 07:59:01 +00:00
nixbitcoin 22c3fd52e1 backups: add feature test 2020-08-04 15:25:39 +00:00
nixbitcoin e4fb7a52de backups: add module 2020-08-04 15:25:37 +00:00
nixbitcoin e650df30d5 bitcoind: bump rpcthread count 2020-08-04 14:46:57 +00:00
nixbitcoin 46e15ee9cc tests: make lnd & clightning tests run concurrently 2020-08-04 14:07:12 +00:00
nixbitcoin ac96fd59db assertions: make lnd.enable depend on !clightning.enable or port != 9735 2020-08-04 14:07:10 +00:00
nixbitcoin 3ed564ea06 lnd: make listen IP address only 2020-08-04 14:07:08 +00:00
nixbitcoin 716e98789c lnd: add listenPort option 2020-08-04 14:07:06 +00:00
nixbitcoin 43da15557d clightning: refactor bind-addr to be IP address only
With typecheck
2020-08-04 14:07:02 +00:00
nixbitcoin d99ccc8445 clightning: add bindport option 2020-08-04 12:42:57 +00:00
nixbitcoin e9204946d4 lightning-loop: add tests 2020-07-28 15:55:54 +00:00
nixbitcoin 491d83a658 lightning-loop: add module 2020-07-28 15:55:52 +00:00
nixbitcoin 8f3588b13f lnd: higher attempt limit for less-powerful machines
Opening main database sometimes takes longer than 50 ExecStartPost
restPort connection attempts.
2020-07-28 15:55:50 +00:00
nixbitcoin 1bb801ad7b lightning-loop: add pkg 2020-07-28 15:55:48 +00:00
nixbitcoin 5086fc3234 bitcoin: drive-by prune fix 2020-07-28 14:32:54 +00:00
nixbitcoin 21c0fb440d rpcwhitelist: add feature test 2020-07-28 14:32:52 +00:00
nixbitcoin 1bf45a9547 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.
2020-07-28 14:32:50 +00:00
nixbitcoin 5a978a2836 bitcoind: switch from rpcpassword to rpcauth
Includes bitcoind's `share/rpcauth` to convert apg generated passwords
into salted HMAC-SHA-256 hashed passwords.
2020-07-28 14:32:47 +00:00
nixbitcoin 6a8e29e016 tests: add dbus-hardening and hideProcessInformation 2020-07-28 11:37:16 +00:00
nixbitcoin 0248e6493f systemd: lock down systemctl status
Mitigates a security issue that allows unprivileged users to read other
unprivileged user's processes' credentials from CGroup using `systemctl
status`.
2020-07-28 11:28:09 +00:00
nixbitcoin 6365412312 test-script: remove nginx tls proxy test 2020-07-21 13:58:32 +00:00
nixbitcoin 4dbc348921 electrs: remove TLSProxy
https://github.com/spesmilo/electrum/issues/5278 was resolved
2020-07-21 13:41:03 +00:00
nixbitcoin 02853067a1 bitcoind: postStart wait until bitcoind can receive rpc calls 2020-07-21 13:23:07 +00:00
nixbitcoin 681728294b tests: run scenarios as multiple Travis jobs 2020-07-21 09:39:01 +00:00
nixbitcoin 43ce847e2b tests: allow running integration tests with different configurations 2020-07-21 09:38:59 +00:00
nixbitcoin 8783f38fba tests: add netns to testing framework 2020-07-21 09:38:57 +00:00
nixbitcoin 25adce29e5 secure-node: only mkHiddenServices if services are enabled 2020-07-21 09:38:55 +00:00
nixbitcoin c542b92e55 nginx: add netns
- Adds nginx to netns-isolation.services
- Adds host option (defaults to localhost) as target of hidden service
2020-07-21 09:38:53 +00:00
nixbitcoin ef89607704 recurring-donations: add netns
- Adds recurring-donations to netns-isolation.services
- Adds cfg.enforceTor to bring recurring-donations in line with other
  services
- Removes torsocks dependency in favor of `curl --socks-hostname`
2020-07-21 09:38:51 +00:00
nixbitcoin 582cb86d74 nanopos: add netns
- Adds nanopos to netns-isolation.services
- Adds cfg.enforceTor and extraArgs to bring nanopos in line with other
  services
- Adds charged-url option to allow using nanopos with network
  namespaces.
- Modularizes nginx so webindex can be used without nanopos.
- Adds host option (defaults to localhost) as target of hidden service
- Removes unnecessary after
2020-07-21 09:38:49 +00:00
nixbitcoin 7369f0a7ec lightning-charge: add netns
- Adds lightning-charge to netns-isolation.services
- Adds cfg.enforceTor to bring lightning-charge in line with other
  services
- Adds extraArgs option to allow using lightning-charge with network
  namespaces
- Adds host option (defaults to localhost) as target of hidden service
2020-07-21 09:38:47 +00:00
nixbitcoin c4ab73d51f spark-wallet: add netns
- Adds spark-wallet to netns-isolation.services
- Adds extraArgs option to allow using spark-wallet with network
  namespaces
- Adds host option (defaults to localhost) as target of hidden service
- Adds enforceTor option to bring in line with other services
2020-07-21 09:38:45 +00:00
nixbitcoin d6296acaba electrs: add netns
- Adds electrs to netns-isolation.services
- Adds daemonrpc option and specifies address option to allow using
  electrs with network namespaces
- Adds host option (defaults to localhost) as target of hidden service
2020-07-21 09:38:43 +00:00
nixbitcoin c0b02ac93a liquid: add netns cli script 2020-07-21 09:38:41 +00:00
nixbitcoin 672a416ede liquidd: add netns
- Adds liquidd to netns-isolation.services
- Adds rpcbind, rpcallowip, and mainchainrpchost options to allow using
  liquidd with network namespaces
- Adds bind option (defaults to localhost) as target of hidden service
2020-07-21 09:38:39 +00:00
nixbitcoin 4b8ca52647 lnd: add netns cli script 2020-07-21 09:38:37 +00:00
nixbitcoin c55296433d lnd: add netns
- Adds lnd to netns-isolation.services
- Specifies listen option (defaults to localhost) as target of
  hiddenService.
- Amends hardcoded lnd ip to lnd-cert

WARNING: Breaking changes for lnd cert. lnd-key and lnd-cert will have
to be deleted and redeployed.
2020-07-21 09:38:35 +00:00
nixbitcoin f3d2aaa5d4 lnd: prepare for netns and bring in line with clightning
- Adds bitcoind-host, and tor-socks options to allow using with
  network namespaces.
- Adds listen, rpclisten, and restlisten option to specify host on which
  to listen on for peer, rpc and rest connections respectively
- Adds announce-tor option and generates Tor Hidden Service with nix
  instead of lnd to bring in line with clightning.

WARNING: Breaking changes for Tor Hidden Service. Manual migration
necessary.
2020-07-21 09:38:32 +00:00
nixbitcoin 3c0c446547 clightning: add netns
- Adds clightning to netns-isolation.services
- Adds bitcoin-rpcconnect option to allow using clightning with network
  namespaces
- Uses bind-addr option (defaults to localhost) as target of hidden service
- Adds different bind-addr options depending on if netns-isolation is
  enabled or not.
2020-07-21 09:38:30 +00:00
nixbitcoin ae1230e13b clightning: remove bitcoin-rpcuser option
Simplifies the clightning module.
2020-07-21 09:38:28 +00:00
nixbitcoin 65b5dab3d4 clightning: add announce-tor
From the clightning manpage:

autolisten=BOOL By default, we bind (and maybe announce) on IPv4 and
IPv6 interfaces if no addr, bind-addr or  announce-addr options  are
specified. Setting this to false disables that.

We already set bind-addr by default, so autolisten had no effect.
Therefore, this commit replaces autolisten with the more granular
announce-addr option.

For now we are Tor-only, so we only need to announce our hidden service
to accept incoming connections. In the future, we can add clearnet
connectivity with `addr` and route connections into our netns with NAT.
2020-07-21 09:38:26 +00:00
nixbitcoin 515aae2825 bitcoind: add netns and nonetns cli scripts
nonetns script needed for bitcoind-import-banlist
2020-07-21 09:38:24 +00:00
nixbitcoin 75ca6f186c bitcoind: add netns
- Adds bitcoind to netns-isolation.services
- Adds rpcbind and rpcallowip options to allow using bitcoind with
  network namespaces
- Adds bind option (defaults to localhost), used as target of hidden service
- Makes bitcoind-import-banlist run in netns
2020-07-21 09:38:22 +00:00
nixbitcoin e5e07b91f7 netns-isolation: netns architecture
- Adds network namespace instantiation and routing architecture.
- netns-isolation disabled by default. Can be enabled with
  configuration.nix FIXME.
- Uses mkMerge to toggle certain options for non netns and netns
  systems.
- Adds security wrapper for netns-exec which allows operator to exec
  with cap_sys_admin
- User can select the 169.254.N.0/24 addressblock netns's are created in.
- nix-bitcoin-services IpAddressAllow is amended with link-local
  addresses
2020-07-21 09:38:20 +00:00
nixbitcoin ae364a68ad hwi: 1.0.3 -> 1.1.2
hidapi needed to be added as a custom dependency to be able to build
from unstable.
2020-07-19 13:52:46 +00:00
nixbitcoin fe6e118bb3 elementsd: 0.18.1.3 -> 0.18.1.8
Also includes `get-sha256.sh` to easily determine verified sha256's
2020-07-19 12:15:39 +00:00
nixbitcoin 5ca58a2a26 nixpkgs: update stable and unstable
Includes bitcoin 0.20.0 and lnd 0.10.3
2020-07-19 12:15:33 +00:00
nixbitcoin a20807b8a3 travis: fix
Simplify installing nix package manager. Issue 2733 is fixed in nix
2.3.3 and travis installs 2.3.6.
2020-07-08 09:26:33 +00:00
nixbitcoin e81ccb6596 electrs: 0.8.3 -> 0.8.5 2020-07-07 10:54:40 +00:00
nixbitcoin f280d54bb8 add module assertions 2020-06-17 09:23:17 +00:00
nixbitcoin 23cd323ad1 assertions: add lnd, clightning exclusivity 2020-06-15 13:02:58 +00:00
nixbitcoin 0ad524ca2d example config: clarify nix-bitcoin will auto-detect invalid settings 2020-06-15 10:56:01 +00:00
nixbitcoin c16924b850 example config: change hwi excluding dependency to high-memory
HWI can be enabled if electrs is enabled as long as electrs.high-memory
is disabled.
2020-06-15 10:55:59 +00:00
nixbitcoin 0fd99c4cc0 bitcoind: simplify pruning
Remove the possible null value for bitcoind.prune and set prune = 0 in
bitcoind as a default. Remove prune = 0 in secure-node.nix and the
mkForce in configuration.nix (bitcoind.prune = lib.mkForce ).
2020-06-15 10:55:57 +00:00
nixbitcoin b9a7a71873 example config: document enabling pruning 2020-06-15 10:55:55 +00:00
nixbitcoin 12adabe407 banlist: update to newest version
Received by E-Mail from gmaxwell
2020-06-11 09:23:26 +00:00
nixbitcoin ccc3a70344 service hardening: add more restrictions
Add RestrictSUIDSGID
Add RemoveIPC
Add RestrictRealtime
Add ProtectHostname
2020-05-24 11:14:45 +00:00
nixbitcoin 3fbfa98635 service hardening: replace obtuse SystemCallFilter with @system-service
@system-service whitelist and additional
https://docs-stage.docker.com/engine/security/seccomp/#significant-syscalls-blocked-by-the-default-profile
blacklist.
2020-05-24 11:14:37 +00:00
nixbitcoin e34d1c884e service hardening: Add PrivateUsers
Exceptions in webindex & onion-chef
2020-05-22 16:16:19 +00:00
nixbitcoin 1c75543f2f clightning: add user and group options 2020-05-22 16:16:17 +00:00
nixbitcoin a040e52854 All modules: ProtectSystem = strict
Add ReadWritePaths in all modules, except lnd which has ProtectSystem =
full.
2020-05-22 15:47:01 +00:00
nixbitcoin adc71b892e Remove PermissionStartOnly where possible and replace with bitcoinrpc
Remove PermissionsStartOnly for bitcoind and spark-wallet (it was never
needed there)

Give reason for PermissionsStartOnly in lightning-charge

Replace PermissionsStartOnly in clightning, electrs and liquid
2020-05-22 15:04:49 +00:00
nixbitcoin 91b6b2c370 All modules with preStart: Use systemd.tmpfiles.rules
This is NixOS' recommended way to setup service dirs
https://github.com/NixOS/nixpkgs/pull/56265. This commit hands off the
initial data directory creation to systemd.tmpfiles.rules. All other
preStart scripts are left intact to limit this changes' scope.
2020-05-22 14:54:39 +00:00
nixbitcoin 423ebf862b lnd: only enable bitcoind zmqpub if lnd.enable
In conjuction with secure-node.nix, this sets sane
RestrictAddressFamilies unless lnd is enabled. Before, we were
constantly exposing unnecessary Address Families, not just when lnd is
enabled.

However, zmqpub* must always be enabled for lnd, even when used
outside of secure-node.nix, so we make this change in the lnd module.
2020-05-22 14:53:33 +00:00
nixbitcoin 81a1c3f908 service hardening: Add CapabilityBoundingSets
Whitelist with exceptions in webindex and onion-chef
2020-05-22 11:29:54 +00:00
nixbitcoin 3cd61506e0 webindex & onion-chef: Run non-network-facing services in PrivateNetwork 2020-05-22 11:29:07 +00:00
nixbitcoin 7c70dd43ac All modules: Give service config precedence over defaultHardening
With '//' the latter takes precedence over the former in case of
equally named attributes.
2020-05-22 08:08:27 +00:00
nixbitcoin b8e10afe18 recurring-donations: Run under recurring-donations user 2020-05-19 11:13:26 +00:00
nixbitcoin 5d01ea7101 nodeinfo: Convert to module and allow alternative operator username
currently, nodeinfo has presets/secure-node.nix as a strict
dependency as it requires onion-chef and the 'operatorName' option.
and nix-bitcoin-webindex.nix has nodeinfo as a dependecy.

so don't add nodeinfo and webindex to modules.nix because they will fail on standalone use.
2020-05-19 11:13:24 +00:00
nixbitcoin 95d230d1d6 Remove bitcoinrpc group remnants 2020-05-19 11:13:22 +00:00
nixbitcoin 563b210835 spark-wallet: Run under spark-wallet user 2020-05-19 11:13:20 +00:00
nixbitcoin 205fca3576 bitcoind: only make blocksdir group-readable when dataDirReadableByGroup 2020-05-19 11:13:18 +00:00
nixbitcoin 81a04a4ef1 lightning-charge: add dedicated user 2020-05-19 11:13:16 +00:00
nixbitcoin e67a818297 lightning-charge: 0.4.14 -> 0.4.19 2020-05-19 11:13:13 +00:00
nixbitcoin 0ba55757f8 clightning: allow group access to RPC socket 2020-05-19 11:13:12 +00:00
nixbitcoin 304dd297ba clightning: remove config group read access 2020-05-19 11:13:05 +00:00
nixbitcoin 04c6936ce9 clightning: Remove clightning "bitcoinrpc" membership
Secrets are written to clightning config file during preStart with root
permissions because of PermissionsStartOnly.
2020-05-19 11:09:13 +00:00
nixbitcoin 393ab0fb3c electrs: Remove electrs user from "bitcoinrpc" and "bitcoin" sometimes
Electrs does not need to be a part of "bitcoinrpc" group because preStart
electrs.toml creation is handled by PermissionsStartOnly. "bitcoin"
group membership is only necessary when cfg.high-memory is enabled and
electrs reads blocks directly from the blocks directory.
2020-05-19 11:08:59 +00:00
nixbitcoin 7cfae66db4 electrs: Drop insecure TLS ciphers 2020-05-19 11:08:52 +00:00
nixbitcoin 4c139a6d77 electrs: Make TLSProxy truly optional
If TLSProxy is disabled, bypass nginx by forwarding Tor HS traffic
directly to electrs.
2020-05-19 11:08:48 +00:00
nixbitcoin 8b2ae9c1b7 spark-wallet: update 0.2.13 -> 0.2.14
Download shesek's github spark-npm.tgz, verify signature, unpack
spark-npm.tgz, patch package.json to include qrcode-terminal in
dependencies, run node2nix with tmpdir as local source, replace tmpdir
spark-wallet source with shesek's github spark-npm.tgz in
node-packages.nix.

spark-wallet: erikarvstedt fixups
2020-05-10 17:12:45 +02:00
nixbitcoin 1acb22a872 Get electrs source tarball with gpg verified sha256 and corresponding helper script
move script to pkg dir, add hint to script in pkg def

remove unneeded script deps

add extended bash error checking

rename DIR -> TMPDIR

remove TMPDIR on exit

strip whitespace, simplify comments

gpg2 -> gpg

latesttagelectrs -> latest

tmpdir: don't use XDG_RUNTIME_DIR

XDG_RUNTIME_DIR is often in RAM and shouldn't be used for larger
workloads like repo downlaods

verify fingerprint of the imported key

remove trailing '-' in output

simplify output

Hide --fetch-key output

Output is not relevant to user, looks better without it

More accurately describe ./get-sha256 function

User might think that ./get-sha256 automatically updates sha256 in default.nix

Fetch key from sks keyservers instead of keybase.io

Using --recv-key simplifies getting the right key, and only the
right key, greatly. I try to refrain from using sks keyservers,
but the certificate spamming attack shouldn't be an issue in this
case because we create a temporary keychain just for the
verificaiton.

remove unneeded cargoDepsHook

Make clang nativeBuildInput instead of buildInput
2020-04-26 17:02:14 +02:00
nixbitcoin 707b06aed1 Update pinned nixpkgs 2020-04-26 16:59:41 +02:00
nixbitcoin 159f551b93 Remove bitcoin, clightning, electrs, liquid user home directory 2020-04-26 14:08:08 +02:00
nixbitcoin e95f5981aa Remove KN countrycode 2020-04-24 16:27:48 +02:00
nixbitcoin 742aef1e0f Only set dataDirReadableByGroup if cfg.high-memory is enabled 2020-04-24 16:21:12 +02:00
nixbitcoin 0382d3a6b8 Document low-entropy problem 2020-04-19 15:16:00 +02:00
nixbitcoin 89dc836f94 Update spark-wallet 0.2.12 -> 0.2.13 2020-04-17 14:13:04 +02:00