2024-06-03 20:49:32 +02:00
|
|
|
{ pkgs, config, factsGenerator, ... }:
|
2023-12-09 17:15:50 +01:00
|
|
|
{
|
|
|
|
networking.firewall.allowedUDPPorts = [ 51820 ];
|
2024-06-03 10:36:52 +02:00
|
|
|
clanCore.facts.services.wireguard = factsGenerator.wireguard { name = "wg0"; };
|
2023-12-09 17:15:50 +01:00
|
|
|
boot.kernel.sysctl."net.ipv4.ip_forward" = true;
|
|
|
|
|
|
|
|
# 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.1/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-12-09 17:15:50 +01:00
|
|
|
mtu = 1280;
|
|
|
|
|
|
|
|
postUp = ''
|
|
|
|
${pkgs.iptables}/bin/iptables -A FORWARD -i wg0 -j ACCEPT
|
|
|
|
'';
|
|
|
|
postDown = ''
|
|
|
|
${pkgs.iptables}/bin/iptables -D FORWARD -i wg0 -j ACCEPT
|
|
|
|
'';
|
|
|
|
|
|
|
|
# clients
|
|
|
|
peers = [
|
|
|
|
{
|
|
|
|
# chungus
|
|
|
|
publicKey = "wb54y/fG8ocSH9QrDmfajez/fUcJBZK369xLu37XBHk=";
|
|
|
|
allowedIPs = [ "10.100.0.2/32" ];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
# sterni
|
|
|
|
publicKey = "SdMRgC5IM7dywzZxLAHm45cpj9J3IENTMClZm1BxbV4=";
|
|
|
|
allowedIPs = [ "10.100.0.3/32" ];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
# iphone
|
|
|
|
publicKey = "XPVzH+wBLsqukTHHjngkGJhYN0nRdQ7esadiimMJQnI=";
|
|
|
|
allowedIPs = [ "10.100.0.4/32" ];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
# tina
|
|
|
|
publicKey = "RZsuQfWfAQLMm45ZiuNLBwcpL+GEbPYTRTrASFzMCFQ=";
|
|
|
|
allowedIPs = [ "10.100.0.5/32" ];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
# cream
|
|
|
|
publicKey = "R1Vk1DDG/LsVU0HHRDmOJshXOVnNzPVbuv5hP7ZSGEQ=";
|
|
|
|
allowedIPs = [ "10.100.0.6/32" ];
|
|
|
|
}
|
2024-04-12 19:55:08 +02:00
|
|
|
{
|
|
|
|
# cherry
|
|
|
|
publicKey = "ZNnlmPdxAGYtaUvOU2V47tcEhcB06LBCXkSxIvWZL2k=";
|
|
|
|
allowedIPs = [ "10.100.0.7/32" ];
|
|
|
|
}
|
2024-05-11 15:46:59 +02:00
|
|
|
{
|
|
|
|
# ipad
|
|
|
|
publicKey = "E8TJTPQT0jK9vzDrwqX4fIGQtM640gc6qALVTZgmfRo=";
|
|
|
|
allowedIPs = [ "10.100.0.8/32" ];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
# ipad tina
|
|
|
|
publicKey = "aOlfGT2c/4v7U7faLXyCyiCHe8iSAOedblKgbJONxnM=";
|
|
|
|
allowedIPs = [ "10.100.0.9/32" ];
|
|
|
|
}
|
2023-12-09 17:15:50 +01:00
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|