Added manual IP tests and resulting fixes
parent
f78dc06eb1
commit
0dea96cf37
@ -0,0 +1,65 @@
|
||||
{
|
||||
version = "v1";
|
||||
subnets = [
|
||||
{
|
||||
name = "manual";
|
||||
endpoints = [
|
||||
{
|
||||
# No match mean match any
|
||||
port = 51820;
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
groups = [
|
||||
# groups field is expected, but can be empty
|
||||
];
|
||||
peers = [
|
||||
{
|
||||
name = "node1";
|
||||
subnets = {
|
||||
manual = {
|
||||
ipAddresses = [
|
||||
"10.0.0.1"
|
||||
];
|
||||
listenPort = 51820;
|
||||
};
|
||||
};
|
||||
publicKey = "kdyzqV8cBQtDYeW6R1vUug0Oe+KaytHHDS7JoCp/kTE=";
|
||||
privateKeyFile = "/etc/wg-key";
|
||||
#privateKey = "MIELhEc0I7BseAanhk/+LlY/+Yf7GK232vKWITExnEI="; # path is relative to the machine
|
||||
endpoints = [
|
||||
{
|
||||
# no match can be any
|
||||
ip = "node1";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
name = "node2";
|
||||
subnets = {
|
||||
manual = {
|
||||
ipAddresses = [
|
||||
"10.0.0.2"
|
||||
];
|
||||
listenPort = 51820;
|
||||
};
|
||||
};
|
||||
publicKey = "ztdAXTspQEZUNpxUbUdAhhRWbiL3YYWKSK0ZGdcsMHE=";
|
||||
privateKeyFile = "/etc/wg-key";
|
||||
#privateKey = "yG4mJiduoAvzhUJMslRbZwOp1gowSfC+wgY8B/Mul1M=";
|
||||
endpoints = [
|
||||
{
|
||||
# no match can be any
|
||||
ip = "node2";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
connections = [
|
||||
{
|
||||
a = [{type= "subnet"; rule = "is"; value = "manual";}];
|
||||
b = [{type= "subnet"; rule = "is"; value = "manual";}];
|
||||
}
|
||||
];
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
{
|
||||
version = "v1";
|
||||
subnets = [
|
||||
{
|
||||
name = "manual";
|
||||
endpoints = [
|
||||
{
|
||||
# No match mean match any
|
||||
port = 51820;
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
groups = [
|
||||
# groups field is expected, but can be empty
|
||||
];
|
||||
peers = [
|
||||
{
|
||||
name = "node1";
|
||||
subnets = {
|
||||
manual = {
|
||||
ipAddresses = [
|
||||
"auto" # "auto" explicitly generates an ipv6 address, opposed to implicitly via not having an `ipAddresses` property
|
||||
];
|
||||
listenPort = 51820;
|
||||
};
|
||||
};
|
||||
publicKey = "kdyzqV8cBQtDYeW6R1vUug0Oe+KaytHHDS7JoCp/kTE=";
|
||||
privateKeyFile = "/etc/wg-key";
|
||||
endpoints = [
|
||||
{
|
||||
# no match can be any
|
||||
ip = "node1";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
name = "node2";
|
||||
subnets = {
|
||||
manual = {
|
||||
ipAddresses = [
|
||||
"auto"
|
||||
];
|
||||
listenPort = 51820;
|
||||
};
|
||||
};
|
||||
publicKey = "ztdAXTspQEZUNpxUbUdAhhRWbiL3YYWKSK0ZGdcsMHE=";
|
||||
privateKeyFile = "/etc/wg-key";
|
||||
endpoints = [
|
||||
{
|
||||
# no match can be any
|
||||
ip = "node2";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
connections = [
|
||||
{
|
||||
a = [{type= "subnet"; rule = "is"; value = "manual";}];
|
||||
b = [{type= "subnet"; rule = "is"; value = "manual";}];
|
||||
}
|
||||
];
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
{
|
||||
version = "v1";
|
||||
subnets = [
|
||||
{
|
||||
name = "manual";
|
||||
endpoints = [
|
||||
{
|
||||
# No match mean match any
|
||||
port = 51820;
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
groups = [
|
||||
# groups field is expected, but can be empty
|
||||
];
|
||||
peers = [
|
||||
{
|
||||
name = "node1";
|
||||
subnets = {
|
||||
manual = {
|
||||
ipAddresses = [
|
||||
"fc00::1"
|
||||
];
|
||||
listenPort = 51820;
|
||||
};
|
||||
};
|
||||
publicKey = "kdyzqV8cBQtDYeW6R1vUug0Oe+KaytHHDS7JoCp/kTE=";
|
||||
privateKeyFile = "/etc/wg-key";
|
||||
endpoints = [
|
||||
{
|
||||
# no match can be any
|
||||
ip = "node1";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
name = "node2";
|
||||
subnets = {
|
||||
manual = {
|
||||
ipAddresses = [
|
||||
"fc00::2"
|
||||
];
|
||||
listenPort = 51820;
|
||||
};
|
||||
};
|
||||
publicKey = "ztdAXTspQEZUNpxUbUdAhhRWbiL3YYWKSK0ZGdcsMHE=";
|
||||
privateKeyFile = "/etc/wg-key";
|
||||
endpoints = [
|
||||
{
|
||||
# no match can be any
|
||||
ip = "node2";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
connections = [
|
||||
{
|
||||
a = [{type= "subnet"; rule = "is"; value = "manual";}];
|
||||
b = [{type= "subnet"; rule = "is"; value = "manual";}];
|
||||
}
|
||||
];
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
name = "manual ipv4 connection";
|
||||
nodes = {
|
||||
# `self` here is set by using specialArgs in `lib.nix`
|
||||
node1 = { self, pkgs, ... }: {
|
||||
virtualisation.vlans = [ 1 ];
|
||||
imports = [ self.nixosModules.default ];
|
||||
wirenix = {
|
||||
enable = true;
|
||||
keyProviders = ["acl"];
|
||||
peerName = "node1";
|
||||
aclConfig = import ./acls/manual-ipv4.nix;
|
||||
};
|
||||
environment.etc."wg-key" = {
|
||||
text = "MIELhEc0I7BseAanhk/+LlY/+Yf7GK232vKWITExnEI=";
|
||||
};
|
||||
networking.firewall.enable = false;
|
||||
};
|
||||
|
||||
node2 = { self, pkgs, ... }: {
|
||||
virtualisation.vlans = [ 1 ];
|
||||
imports = [ self.nixosModules.default ];
|
||||
wirenix = {
|
||||
enable = true;
|
||||
keyProviders = ["acl"];
|
||||
peerName = "node2";
|
||||
aclConfig = import ./acls/manual-ipv4.nix;
|
||||
};
|
||||
environment.etc."wg-key" = {
|
||||
text = "yG4mJiduoAvzhUJMslRbZwOp1gowSfC+wgY8B/Mul1M=";
|
||||
};
|
||||
networking.firewall.enable = false;
|
||||
};
|
||||
};
|
||||
# This is the test code that will check if our service is running correctly:
|
||||
testScript = ''
|
||||
start_all()
|
||||
node1.wait_for_unit("wireguard-manual-peer-node2")
|
||||
node2.wait_for_unit("wireguard-manual-peer-node1")
|
||||
node1.succeed("ping -c 1 node2 >&2")
|
||||
node1.succeed("wg show >&2")
|
||||
node2.succeed("ping -c 1 node1 >&2")
|
||||
node2.succeed("wg show >&2")
|
||||
node1.succeed("ping -c 1 node2.manual")
|
||||
node2.succeed("ping -c 1 node1.manual")
|
||||
'';
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
name = "explicit auto ipv6 connection";
|
||||
nodes = {
|
||||
# `self` here is set by using specialArgs in `lib.nix`
|
||||
node1 = { self, pkgs, ... }: {
|
||||
virtualisation.vlans = [ 1 ];
|
||||
imports = [ self.nixosModules.default ];
|
||||
wirenix = {
|
||||
enable = true;
|
||||
keyProviders = ["acl"];
|
||||
peerName = "node1";
|
||||
aclConfig = import ./acls/manual-ipv6-auto.nix;
|
||||
};
|
||||
environment.etc."wg-key" = {
|
||||
text = "MIELhEc0I7BseAanhk/+LlY/+Yf7GK232vKWITExnEI=";
|
||||
};
|
||||
networking.firewall.enable = false;
|
||||
};
|
||||
|
||||
node2 = { self, pkgs, ... }: {
|
||||
virtualisation.vlans = [ 1 ];
|
||||
imports = [ self.nixosModules.default ];
|
||||
wirenix = {
|
||||
enable = true;
|
||||
keyProviders = ["acl"];
|
||||
peerName = "node2";
|
||||
aclConfig = import ./acls/manual-ipv6-auto.nix;
|
||||
};
|
||||
environment.etc."wg-key" = {
|
||||
text = "yG4mJiduoAvzhUJMslRbZwOp1gowSfC+wgY8B/Mul1M=";
|
||||
};
|
||||
networking.firewall.enable = false;
|
||||
};
|
||||
};
|
||||
# This is the test code that will check if our service is running correctly:
|
||||
testScript = ''
|
||||
start_all()
|
||||
node1.wait_for_unit("wireguard-manual-peer-node2")
|
||||
node2.wait_for_unit("wireguard-manual-peer-node1")
|
||||
node1.succeed("ping -c 1 node2 >&2")
|
||||
node1.succeed("wg show >&2")
|
||||
node2.succeed("ping -c 1 node1 >&2")
|
||||
node2.succeed("wg show >&2")
|
||||
node1.succeed("ping -c 1 node2.manual")
|
||||
node2.succeed("ping -c 1 node1.manual")
|
||||
'';
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
name = "manual ipv6 connection";
|
||||
nodes = {
|
||||
# `self` here is set by using specialArgs in `lib.nix`
|
||||
node1 = { self, pkgs, ... }: {
|
||||
virtualisation.vlans = [ 1 ];
|
||||
imports = [ self.nixosModules.default ];
|
||||
wirenix = {
|
||||
enable = true;
|
||||
keyProviders = ["acl"];
|
||||
peerName = "node1";
|
||||
aclConfig = import ./acls/manual-ipv6.nix;
|
||||
};
|
||||
environment.etc."wg-key" = {
|
||||
text = "MIELhEc0I7BseAanhk/+LlY/+Yf7GK232vKWITExnEI=";
|
||||
};
|
||||
networking.firewall.enable = false;
|
||||
};
|
||||
|
||||
node2 = { self, pkgs, ... }: {
|
||||
virtualisation.vlans = [ 1 ];
|
||||
imports = [ self.nixosModules.default ];
|
||||
wirenix = {
|
||||
enable = true;
|
||||
keyProviders = ["acl"];
|
||||
peerName = "node2";
|
||||
aclConfig = import ./acls/manual-ipv6.nix;
|
||||
};
|
||||
environment.etc."wg-key" = {
|
||||
text = "yG4mJiduoAvzhUJMslRbZwOp1gowSfC+wgY8B/Mul1M=";
|
||||
};
|
||||
networking.firewall.enable = false;
|
||||
};
|
||||
};
|
||||
# This is the test code that will check if our service is running correctly:
|
||||
testScript = ''
|
||||
start_all()
|
||||
node1.wait_for_unit("wireguard-manual-peer-node2")
|
||||
node2.wait_for_unit("wireguard-manual-peer-node1")
|
||||
node1.succeed("ping -c 1 node2 >&2")
|
||||
node1.succeed("wg show >&2")
|
||||
node2.succeed("ping -c 1 node1 >&2")
|
||||
node2.succeed("wg show >&2")
|
||||
node1.succeed("ping -c 1 node2.manual")
|
||||
node2.succeed("ping -c 1 node1.manual")
|
||||
'';
|
||||
}
|
Loading…
Reference in New Issue