2024-12-27 00:47:55 -06:00
|
|
|
{ config, machines, pkgs, ... }:
|
2024-10-27 22:59:13 -05:00
|
|
|
|
|
|
|
{
|
|
|
|
networking = {
|
|
|
|
nat = {
|
|
|
|
enable = true;
|
|
|
|
externalInterface = "eth0";
|
|
|
|
internalInterfaces = [ "wg0" ];
|
|
|
|
};
|
2024-11-09 21:35:11 -06:00
|
|
|
firewall.allowedUDPPorts = [ 50000 ];
|
2024-10-27 22:59:13 -05:00
|
|
|
|
|
|
|
wireguard.interfaces = {
|
|
|
|
wg0 = {
|
|
|
|
ips = [ "10.100.0.1/24" ];
|
|
|
|
|
2024-11-09 21:35:11 -06:00
|
|
|
listenPort = 50000;
|
2024-10-27 22:59:13 -05:00
|
|
|
|
|
|
|
postSetup = ''
|
|
|
|
${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s 10.100.0.0/24 -o eth0 -j MASQUERADE
|
|
|
|
'';
|
|
|
|
postShutdown = ''
|
|
|
|
${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.100.0.0/24 -o eth0 -j MASQUERADE
|
|
|
|
'';
|
|
|
|
|
2024-12-27 00:47:55 -06:00
|
|
|
privateKeyFile = config.age.secrets.netbox-wg-priv.path;
|
2024-10-27 22:59:13 -05:00
|
|
|
|
|
|
|
peers = [
|
|
|
|
{ # copernicus
|
2024-12-27 00:47:55 -06:00
|
|
|
publicKey = machines.copernicus.wg-pubkey;
|
2024-10-27 22:59:13 -05:00
|
|
|
allowedIPs = [ "10.100.0.2/32" ];
|
|
|
|
}
|
2024-10-28 23:01:11 -05:00
|
|
|
{ # aristotle
|
2024-12-27 00:47:55 -06:00
|
|
|
publicKey = machines.aristotle.wg-pubkey;
|
2024-10-28 23:01:11 -05:00
|
|
|
allowedIPs = [ "10.100.0.3/32" ];
|
|
|
|
}
|
2024-10-27 22:59:13 -05:00
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|