Commit Graph

25 Commits

Author SHA1 Message Date
Erik Arvstedt c9cfcf695f treewide: use bool literals for systemd
Run this from the repo root to check that there are no more remaining
bool strings:
grep -P '"true"|"false"' -r --exclude-dir=.git
2023-06-01 02:56:22 -07:00
Erik Arvstedt 32db35d1bf tests: move `mkIfTest` to `nix-bitcoin.lib` 2023-06-01 02:56:22 -07:00
Erik Arvstedt effc1ce0a7 defaultHardening: allow syscall `set_mempolicy`
This syscall is safe to allow.
It's required by the dotnet runtime (btcpayserver, nbxplorer) update
introduced in the following commit.
2023-06-01 02:56:22 -07:00
Erik Arvstedt 9ac3d93b27
improve comments, descriptions 2022-07-15 01:50:11 +02:00
Erik Arvstedt edfbe700e7
lnd: add certificate options `extraIPs` and `extraDomains`
This is useful for non-local access to the lnd REST server.
2022-07-07 16:09:26 +02:00
Erik Arvstedt 3755b3ebea
rtl: add option `extraConfig` for nodes
Also define rtl config as a Nix attrset that is converted to JSON
2022-05-15 21:25:32 +02:00
Erik Arvstedt e6bb281a88
services: set systemd list options as list values
This makes our list definitions mergeable with custom list values
set by users.
Previously, a module error ("value is a string while a list
was expected") was thrown instead.

This commit was partly auto-generated with this script:

#!/usr/bin/env ruby
Dir["**/*.nix"].each do |file|
  src = File.read(file)
  fixed = src.gsub(/ReadWritePaths *= *(.*?);/) do
    "ReadWritePaths = [ #{$1} ];"
  end
  File.write(file, fixed) if fixed != src
end
2022-05-07 20:37:02 +02:00
Erik Arvstedt 29d2ffc111
defaultHardening: allow `clone3` system call
clone3 is the latest version of the clone system call, which is already
allowed.
clone3 is required by nbxplorer 2.3.20.
2022-05-06 13:35:23 +00:00
Erik Arvstedt 53a9f136b9
lib: allow syscall `get_mempolicy` in default seccomp filter
This syscall is required by an upcoming version of btcpayserver.
Because it is generally safe, we can allow it for all services.
2022-01-01 20:13:42 +00:00
Erik Arvstedt 9bda7305fd
services: add `tor.*` options
Split `enforceTor` into `tor.proxy` and `tor.enforce`.
By enabling `tor.proxy` without `tor.enforce`, a service can accept
incoming clearnet connections.
E.g., this allows setting up a Tor-proxied bitcoind node that accepts
RPC connections from LAN.
2021-11-29 13:22:43 +01:00
Erik Arvstedt f61e928139
services: support 0.0.0.0/:: in `address` options
Previously, client services didn't decode these special INADDR_ANY
addresses and failed to connect.
2021-10-04 00:33:26 +02:00
Erik Arvstedt fdc278a0b8
lib: fix comment 2021-08-15 11:29:36 +02:00
Erik Arvstedt c758d68ea4
lib: rename privileged -> rootScript
The naming is now analogous the related function `script`.
2021-08-15 11:29:34 +02:00
Erik Arvstedt 35fe939cf8
security: update /proc restriction mechanism
NixOS option `security.hideProcessInformation` for globally restricting
access to /proc has been removed.
Use per-service restrictions via 'ProtectProc' instead.

Rename
`nix-bitcoin.security.hideProcessInformation` to
`nix-bitcoin.security.dbusHideProcessInformation`
because this option now only implements the dbus restriction.
2021-08-14 10:46:41 +02:00
Erik Arvstedt 178a0dcf8f
services: use new 'tor' options 2021-08-14 10:46:41 +02:00
nixbitcoin d56a363d3d
services: improve default hardening 2021-04-02 10:59:17 +00:00
Erik Arvstedt 08fe9ba84a
services: add finer-grained address family restrictions
Due to a possible NixOS bug, this commit has no effect on NixOS 20.09
where `RestrictAddressFamilies` is a no-op.
It's only relevant for NixOS unstable with cgroups v2.

bitcoind+zmq: instead of allowing all address families, only add the required
AF_NETLINK family.

lnd: lnd only runs a zmq client, not a server, therefore it requires
no additional address families.

lightning-pool, clightning-plugin-zmq: add AF_NETLINK.
2021-03-22 14:35:29 +01:00
Erik Arvstedt 020433cec6
services: add helper fn setAllowedIPAddresses
Also use 'allowLocalIPAddresses' instead of 'allowTor' in bitcoind-import-banlist
which doesn't use Tor.
2021-03-22 13:20:45 +01:00
Erik Arvstedt 6a32812412
services: add names for systemd helper scripts
The systemd journal now shows a specific script name instead of
the generic name "script" before script output.
2021-02-07 22:45:36 +01:00
Erik Arvstedt e774c045de
treewide: fix formatting 2021-02-07 22:40:10 +01:00
Erik Arvstedt a587a2b02a
defaultHardening: explain where @system-service is defined 2021-02-07 22:39:06 +01:00
Erik Arvstedt a344ae95c9
move mkHiddenService to lib 2021-02-04 12:39:54 +00:00
Erik Arvstedt a26ed03d77
rename nix-bitcoin-services.nix -> lib.nix 2021-02-04 12:39:48 +00:00
Erik Arvstedt 55073eee70
remove nix-bitcoin.pkgs.lib
Type ipv4Address is not needed anymore because all services have
separate 'port' and 'address' options.
2021-01-14 13:25:05 +01:00
Jonas Nick 322ba5bfff
Add nix-bitcoin.lib for utility functions and types 2020-08-20 21:31:24 +00:00