remove the swarm wireguard mesh; tombstone its options
This commit is contained in:
parent
fbfc6f392a
commit
adc61c9043
1 changed files with 330 additions and 1068 deletions
|
|
@ -896,16 +896,6 @@ pkgs.testers.runNixOSTest {
|
|||
"'hive-egress-would-drop IN=eth1 OUT=eth2 .*SRC=fd00:0*98:(0+:)*0*3 DST=fd00:0*99:(0+:)*0*2 .*PROTO=TCP .*DPT=443 '"
|
||||
)
|
||||
|
||||
with checked("a flow to the mesh interface is not logged and one to the uplink is"):
|
||||
proxy.succeed("ip link add wg-hive type dummy && ip link set wg-hive up")
|
||||
proxy.succeed("ip route add 198.51.100.0/24 dev wg-hive")
|
||||
agent.execute("echo x > /dev/udp/198.51.100.7/9; echo x > /dev/udp/203.0.113.77/9")
|
||||
proxy.wait_until_succeeds(
|
||||
"journalctl -k -o cat --no-pager | grep -E "
|
||||
"'hive-egress-would-drop IN=eth1 OUT=eth2 .*DST=203\\.0\\.113\\.77 '"
|
||||
)
|
||||
assert not would_drop(r"DST=198\.51\.100\.7 "), "the mesh interface is not egress"
|
||||
|
||||
with checked("one busy agent address is cut to a burst plus a trickle, the rest still leave a trace, and every flow is logged once at most"):
|
||||
agent.execute("for i in $(seq 1 100); do echo x > /dev/udp/203.0.113.78/$((3000 + i)); done")
|
||||
proxy.wait_until_succeeds(
|
||||
|
|
@ -1176,11 +1166,6 @@ pkgs.testers.runNixOSTest {
|
|||
# ---- Reject mode ----
|
||||
# The node switches to its `reject` specialisation, which reloads the
|
||||
# tables with the refusing forward chain. Nothing is in `direct_mac` yet.
|
||||
def reject_lines(pattern):
|
||||
# The reject chain's log lines in the kernel log that match `pattern`.
|
||||
out = proxy.succeed("journalctl -k -o cat --no-pager | grep hive-egress-reject || true")
|
||||
return [line for line in out.splitlines() if re.search(pattern, line)]
|
||||
|
||||
def wait_reject_line(pattern):
|
||||
proxy.wait_until_succeeds(
|
||||
"journalctl -k -o cat --no-pager | grep -E "
|
||||
|
|
@ -1213,20 +1198,12 @@ pkgs.testers.runNixOSTest {
|
|||
found = re.search(r'oifname != "eth1" counter packets (\d+) bytes \d+$', out, re.M)
|
||||
assert found and int(found.group(1)) > 0, out
|
||||
|
||||
with checked("reject mode: a MAC in direct_mac passes and is refused again once it leaves, and the mesh passes"):
|
||||
with checked("reject mode: a MAC in direct_mac passes and is refused again once it leaves"):
|
||||
proxy.succeed(f"nft add element inet hive_egress direct_mac '{{ {AGENT_MAC} }}'")
|
||||
assert dial_status("203.0.113.2", 8443) == 0, "an exempt MAC (a service container's stand-in) reaches TCP 8443"
|
||||
agent.succeed("ping -c1 -W3 203.0.113.2")
|
||||
assert udp_status("203.0.113.77") == 0, "control: an exempt MAC's datagram is not refused"
|
||||
proxy.succeed(f"nft delete element inet hive_egress direct_mac '{{ {AGENT_MAC} }}'")
|
||||
assert dial_status("203.0.113.2", 8443) == 1, "refused again"
|
||||
# The mesh comes first in the chain. A dummy interface answers nothing,
|
||||
# so the proof is that the chain refuses neither the ping nor the UDP
|
||||
# datagram, while the same flows to the uplink are refused.
|
||||
status, out = agent.execute("ping -c1 -W5 198.51.100.7")
|
||||
assert "filtered" not in out.lower(), f"the mesh interface is not egress: {out}"
|
||||
agent.execute("echo x > /dev/udp/198.51.100.7/9; echo x > /dev/udp/203.0.113.80/9")
|
||||
wait_reject_line(r"DST=203\.0\.113\.80 ")
|
||||
assert not reject_lines(r"DST=198\.51\.100\.7 "), "the mesh interface is not egress"
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue