You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
3.0 KiB
Nix

Squashed commit of the following: commit 014fa13262f264d61de6ae5cd49b67bc02c25bd0 Author: Tilmann Meyer <me@atiltedtree.dev> Date: Sun Mar 24 23:09:00 2024 +0100 Fixed persistent keepalive for networkd configurer commit 37453982ab4c65848c9849aec54806b829072e91 Author: Matthew Salerno <m@salernosection.com> Date: Sun Mar 24 21:08:06 2024 -0400 update flake commit 68a0496bc7fa0770427d22bd25c6910b9144e9ab Author: Matthew Salerno <m@salernosection.com> Date: Sun Mar 24 21:07:59 2024 -0400 Update tests to use `subnets` in all connections commit 8c7f741b7f0549387abd96482010bc06b731a55c Author: Matthew Salerno <m@salernosection.com> Date: Sun Mar 24 21:07:31 2024 -0400 Add error message to parser for incorrectly configured subnets in connections commit 3e3a37fc0f5b232da4c4744d81981d68ccd93ffc Author: Matthew Salerno <m@salernosection.com> Date: Sun Mar 24 21:05:27 2024 -0400 Update disjoint test commit 1236e4e8f27c22e3e9d936dbbdcb1913b26b8c9c Author: Adam Stephens <adam@valkor.net> Date: Sun Mar 24 20:59:26 2024 -0400 Add disjointed meshes tests commit dadd5bf7205eddb0a17330426bcabdccd6923615 Author: Matthew Salerno <m@salernosection.com> Date: Wed Dec 13 22:01:16 2023 -0500 add tags to agenix-rekey provider commit 1d3184639a5a83f0633f2908cd3b66293a24d1d8 Author: Matthew Salerno <m@salernosection.com> Date: Mon Dec 11 22:09:45 2023 -0500 sneaky systemd issues with dev only commit c8fb5affe5802c133abe10a51b228bfd76e03147 Author: Matthew Salerno <m@salernosection.com> Date: Tue Dec 5 20:51:30 2023 -0500 wnlib is back commit 1e697eb859788c592a5e3606086180b72fd1e9f1 Author: Matthew Salerno <m@salernosection.com> Date: Sat Nov 11 22:09:26 2023 -0500 allow multiple devs for same subnet commit 45b70c90636eee57d49ebac348e345912be226da Author: Matthew Salerno <m@salernosection.com> Date: Mon Sep 18 16:04:49 2023 -0400 added manual ip tests and resulting fixes commit 3d49ebff29894fe58de97a07a02035bd6d9a2752 Author: Matthew Salerno <m@salernosection.com> Date: Mon Sep 18 11:49:58 2023 -0400 Added manual IP assignment tests commit bd52d85d2dc56b0933d958aa3ef4faa3113e356c Author: Matthew Salerno <m@salernosection.com> Date: Thu Sep 14 16:08:00 2023 -0400 Generalized ip assignment to take cidr or IP commit fd2b9ce77cf1492463413e8bc0a9797226f9ddd0 Author: Matthew Salerno <m@salernosection.com> Date: Thu Sep 14 13:50:11 2023 -0400 Generalized ip assignment to take cidr or IP commit 57f8e0e97463dec3e0da7f4b995ee89b92d36687 Author: Matthew Salerno <m@salernosection.com> Date: Wed Sep 13 18:38:42 2023 -0400 Fixed manual ipv4 assignment issue commit a24fffa753745d1d6285ae588ff29b374ea1f8d2 Author: Matthew Salerno <m@salernosection.com> Date: Mon Sep 11 13:44:11 2023 -0400 Update README.md with link to self commit dd9de47a84060004ec9c76ceb7e7ee4086438f73 Author: Matthew Salerno <m@salernosection.com> Date: Sat Sep 2 19:55:17 2023 -0400 fixed missing link commit e761330e9189d194018ec2e3bd314d015b3f5f38 Merge: bb8636d b658653 Author: Matthew Salerno <m@salernosection.com> Date: Sat Sep 2 19:54:29 2023 -0400 fixed missing link commit bb8636dd8d5841747cdb7e8da171aeb44534e4a6 Author: Matthew Salerno <m@salernosection.com> Date: Thu Aug 31 20:45:14 2023 -0400 Readme moved to wiki commit 86e300428b905843129d2785d01fdf4313334b93 Author: Matthew Salerno <m@salernosection.com> Date: Tue Aug 22 21:07:34 2023 -0400 Fixed a bug in allGroupEndpoints logic commit 9a5c773355c571b6dc005dd70b083775b00f106d Author: Matthew Salerno <m@salernosection.com> Date: Mon Aug 21 22:03:19 2023 -0400 oops, delete net.nix commit b97760e456dc471e33bab3844ab9d3dbd5cc5a73 Author: Matthew Salerno <m@salernosection.com> Date: Mon Aug 21 21:59:30 2023 -0400 fixup additional_ settings commit 753c0726630304113e5a6af75d97b4fcf0b45a90 Author: Matthew Salerno <m@salernosection.com> Date: Mon Aug 21 21:30:40 2023 -0400 change null test to test enable = false commit 690e13e902ef6515946baf882a470f00b54adefa Author: Matthew Salerno <m@salernosection.com> Date: Mon Aug 21 21:28:29 2023 -0400 add mailing list to readme
7 months ago
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
(import ./lib.nix) ({wnlib}:
{
name = "double dev ring connection";
nodes = {
# `self` here is set by using specialArgs in `lib.nix`
node1 = { self, pkgs, ... }: {
virtualisation.vlans = [ 1 ];
imports = [ self.nixosModules.default ];
systemd.network.enable = true;
networking.useDHCP = false;
wirenix = {
configurer = "networkd";
devNameMethod = "hash";
enable = true;
aclConfig = import ./acls/double-dev-ring.nix;
peerNames = ["peer1" "peer3"];
};
environment.etc."wg-key1" = {
text = "MIELhEc0I7BseAanhk/+LlY/+Yf7GK232vKWITExnEI=";
};
environment.etc."wg-key3" = {
text = "yPcTvQOK9eVXQjLNapOsv2iAkbOeSzCCxlrWPMe1o0g=";
};
environment.systemPackages = [pkgs.wireguard-tools];
networking.firewall.enable = false;
};
node2 = { self, pkgs, ... }: {
virtualisation.vlans = [ 1 ];
imports = [ self.nixosModules.default ];
systemd.network.enable = true;
networking.useDHCP = false;
wirenix = {
configurer = "networkd";
devNameMethod = "hash";
enable = true;
keyProviders = ["acl"];
aclConfig = import ./acls/double-dev-ring.nix;
peerNames = ["peer2" "peer4"];
};
environment.etc."wg-key2" = {
text = "yG4mJiduoAvzhUJMslRbZwOp1gowSfC+wgY8B/Mul1M=";
};
environment.etc."wg-key4" = {
text = "CLREBQ+oGXsGxhlQc3ufSoBd7MNFoM6KmMnNyuQ9S0E=";
};
environment.systemPackages = [pkgs.wireguard-tools];
networking.firewall.enable = false;
};
};
# This is the test code that will check if our service is running correctly:
testScript = ''
start_all()
nodes = {
"peer1": node1,
"peer2": node2,
"peer3": node1,
"peer4": node2
}
ifaces = {
"peer1": "${wnlib.getDevName "hash" "peer1" "ring"}",
"peer2": "${wnlib.getDevName "hash" "peer2" "ring"}",
"peer3": "${wnlib.getDevName "hash" "peer3" "ring"}",
"peer4": "${wnlib.getDevName "hash" "peer4" "ring"}"
}
connections = {
"peer1": ["peer2", "peer4"],
"peer2": ["peer3", "peer1"],
"peer3": ["peer4", "peer2"],
"peer4": ["peer1", "peer3"]
}
node1.wait_for_unit("systemd-networkd-wait-online")
node2.wait_for_unit("systemd-networkd-wait-online")
node1.succeed("ping -c 3 node2 >&2")
node2.succeed("ping -c 3 node1 >&2")
for local_name, local_node in nodes.items():
for remote_name in set(nodes.keys()) - set([local_name]):
if remote_name in connections[local_name]:
local_node.succeed(f"ping -c 3 -I {ifaces[local_name]} {remote_name}.ring >&2")
else:
local_node.fail(f"ping -c 3 -W 1 -I {ifaces[local_name]} {remote_name}.ring")
'';
})