nixos-config/config/wireguard.nix

47 lines
1.3 KiB
Nix
Raw Normal View History

2022-01-18 12:54:53 +00:00
{ config, ... }:
2022-01-14 14:38:01 +00:00
{
networking.wireguard = {
enable = true;
interfaces."wg0" = {
listenPort = 51820;
privateKeyFile = "/run/secrets/network/wireguard/privkey";
2022-01-14 14:47:37 +00:00
peers = [
2022-01-18 12:54:53 +00:00
{
publicKey = "zQY9cAzbRO/FgV92pda7yk0NJFSXzHfi6+tgRq3g/SY=";
2022-01-18 12:57:22 +00:00
allowedIPs = [
2022-01-18 12:54:53 +00:00
"fd0d:a262:1fa6:e621:b4e1:08ff:e658:6f49/64"
];
endpoint = "138.201.155.128:51820";
persistentKeepalive = 25;
2022-01-18 12:54:53 +00:00
}
{
publicKey = "YYQmSJwipRkZJUsPV5DxhfyRBMdj/O1XzN+cGYtUi1s=";
2022-01-18 12:57:22 +00:00
allowedIPs = [
2022-01-18 12:54:53 +00:00
"fd0d:a262:1fa6:e621:47e6:24d4:2acb:9437/128"
];
}
2022-01-14 14:47:37 +00:00
# Old infra: ubuntu-4gb-fsn1-1
{
publicKey = "ZtU2iWwVYeGyXC1ak+wFdTuisQNq7gMthYQZaw6InDU=";
endpoint = "23.88.44.119:51820";
allowedIPs = [
2022-01-15 16:56:20 +00:00
"fd00:e621:e621::/64"
2022-01-15 17:53:01 +00:00
"fd00:e621:e621:1::/64"
2022-01-16 20:20:34 +00:00
"fd00:e621:e621:2::3/128"
2022-01-15 16:56:20 +00:00
];
persistentKeepalive = 25;
2022-01-15 16:56:20 +00:00
}
# Old infra: nas
{
2022-01-15 16:57:34 +00:00
publicKey = "X6IOz4q4zfPy34bRhAjsureLc6lLFOSwvyGDfxgp8n4=";
2022-01-15 16:56:20 +00:00
allowedIPs = [
2022-01-16 20:22:28 +00:00
"fd00:e621:e621:2::2/128"
2022-01-14 14:47:37 +00:00
];
}
];
2022-01-14 14:38:01 +00:00
};
};
2022-01-14 15:52:07 +00:00
networking.firewall.allowedUDPPorts = [ 51820 ];
sops.secrets."network/wireguard/privkey" = { };
2022-01-14 14:38:01 +00:00
}