2024-06-03 22:01:55 +02:00
|
|
|
{ pkgs, config, factsGenerator, ... }:
|
2023-05-12 11:17:58 +02:00
|
|
|
{
|
|
|
|
networking.firewall.allowedUDPPorts = [ 51820 ];
|
2024-06-03 10:36:52 +02:00
|
|
|
|
|
|
|
clanCore.facts.services.wireguard = factsGenerator.wireguard { name = "wg0"; };
|
2023-05-12 11:17:58 +02:00
|
|
|
|
|
|
|
# Enable WireGuard
|
|
|
|
networking.wg-quick.interfaces = {
|
|
|
|
# Hub and Spoke Setup
|
|
|
|
# https://www.procustodibus.com/blog/2020/11/wireguard-hub-and-spoke-config/
|
|
|
|
wg0 = {
|
|
|
|
address = [ "10.100.0.2/32" ];
|
|
|
|
listenPort = 51820; # to match firewall allowedUDPPorts (without this wg uses random port numbers)
|
2024-06-03 10:36:52 +02:00
|
|
|
privateKeyFile = config.clanCore.facts.services.wireguard.secret."wireguard.wg0.key".path;
|
2023-05-12 11:17:58 +02:00
|
|
|
mtu = 1280;
|
|
|
|
|
|
|
|
# server
|
|
|
|
peers = [
|
|
|
|
{
|
2024-04-07 17:58:36 +02:00
|
|
|
# orbi
|
2023-05-12 11:17:58 +02:00
|
|
|
publicKey = "uWR93xJe5oEbX3DsAYpOS9CuSg1VmXEQxJzdlJpe3DU=";
|
|
|
|
allowedIPs = [ "10.100.0.1/24" ];
|
2024-05-17 19:50:56 +02:00
|
|
|
#endpoint = "ingolf-wagner.de:51820";
|
|
|
|
endpoint = "95.216.66.212:51820";
|
2023-05-12 11:17:58 +02:00
|
|
|
persistentKeepalive = 25;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|