netns: add address binding test

Proposed by Jonas Nick.
This commit is contained in:
Erik Arvstedt 2020-10-29 21:20:38 +01:00
parent 8da01fe8a6
commit 4ff88efc50
No known key found for this signature in database
GPG Key ID: 33312B944DD97846

View File

@ -259,6 +259,12 @@ def _():
assert_unreachable("bitcoind", ["btcpayserver", "spark-wallet", "lightning-loop"]) assert_unreachable("bitcoind", ["btcpayserver", "spark-wallet", "lightning-loop"])
assert_unreachable("btcpayserver", ["bitcoind", "lightning-loop", "liquidd"]) assert_unreachable("btcpayserver", ["bitcoind", "lightning-loop", "liquidd"])
# netns addresses can not be bound to in the main netns.
# This prevents processes in the main netns from impersonating nix-bitcoin services.
assert_matches(
f"nc -l {ip('bitcoind')} 1080 2>&1 || true", "nc: Cannot assign requested address"
)
if "joinmarket" in enabled_tests: if "joinmarket" in enabled_tests:
# netns-exec should drop capabilities # netns-exec should drop capabilities
assert_full_match( assert_full_match(