2023-10-19 18:55:56 +00:00
|
|
|
{
|
|
|
|
flake,
|
|
|
|
config,
|
|
|
|
pkgs,
|
2023-11-06 20:43:48 +00:00
|
|
|
lib,
|
2023-10-19 18:55:56 +00:00
|
|
|
...
|
2024-08-18 22:22:59 +00:00
|
|
|
}:
|
|
|
|
with lib; {
|
2023-10-24 15:56:14 +00:00
|
|
|
boot.kernel.sysctl = {
|
|
|
|
"net.ipv4.ip_forward" = 1;
|
2024-02-12 15:46:46 +00:00
|
|
|
"net.ipv6.conf.wg-private.forwarding" = 1;
|
|
|
|
"net.ipv6.conf.wg-private.accept_ra" = 1;
|
|
|
|
"net.ipv6.conf.wg-private.accept_ra_pinfo" = 1;
|
2023-10-24 15:56:14 +00:00
|
|
|
};
|
2023-10-19 18:55:56 +00:00
|
|
|
|
|
|
|
networking.nat = {
|
|
|
|
enable = true;
|
|
|
|
enableIPv6 = true;
|
2024-02-04 00:05:28 +00:00
|
|
|
externalInterface = "enp1s0";
|
2024-08-18 22:22:59 +00:00
|
|
|
internalInterfaces = ["wg-private"];
|
2023-10-19 18:55:56 +00:00
|
|
|
};
|
2023-10-24 15:56:14 +00:00
|
|
|
|
2024-08-18 22:22:59 +00:00
|
|
|
networking.firewall.allowedUDPPorts = [51899];
|
2024-02-12 23:27:30 +00:00
|
|
|
|
2023-10-24 15:56:14 +00:00
|
|
|
networking.firewall.extraForwardRules = [
|
2024-02-12 15:46:46 +00:00
|
|
|
"iifname { != wg-private } reject"
|
|
|
|
"iifname wg-private accept"
|
2023-10-24 15:56:14 +00:00
|
|
|
];
|
2023-10-19 18:55:56 +00:00
|
|
|
|
2024-02-12 15:46:46 +00:00
|
|
|
systemd.services.wireguard-wg-private = {
|
2024-08-14 08:35:03 +00:00
|
|
|
wantedBy = [
|
2023-11-06 20:43:48 +00:00
|
|
|
"network.target"
|
|
|
|
"network-online.target"
|
|
|
|
"nss-lookup.target"
|
|
|
|
];
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
Type = mkForce "simple";
|
|
|
|
Restart = "on-failure";
|
|
|
|
RestartSec = "30";
|
|
|
|
};
|
|
|
|
|
|
|
|
environment = {
|
|
|
|
WG_ENDPOINT_RESOLUTION_RETRIES = "infinity";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-08-14 08:35:03 +00:00
|
|
|
age.secrets.wg-private-key.file = "${flake.self}/secrets/wg-private-frikandel.age";
|
2024-02-12 15:46:46 +00:00
|
|
|
|
2023-10-19 18:55:56 +00:00
|
|
|
# Enable WireGuard
|
2024-02-04 00:05:28 +00:00
|
|
|
networking.wireguard.interfaces = {
|
2024-02-12 15:46:46 +00:00
|
|
|
wg-private = {
|
2023-10-24 15:56:14 +00:00
|
|
|
listenPort = 51899;
|
2024-02-04 00:05:28 +00:00
|
|
|
mtu = 1300;
|
|
|
|
ips = [
|
2024-02-08 18:23:22 +00:00
|
|
|
"10.13.12.7/32"
|
2023-11-06 20:43:48 +00:00
|
|
|
"fd00:b12f:acab:1312:acab:7::/96"
|
2023-10-25 11:23:13 +00:00
|
|
|
];
|
2024-02-12 15:46:46 +00:00
|
|
|
privateKeyFile = config.age.secrets.wg-private-key.path;
|
2023-10-19 18:55:56 +00:00
|
|
|
peers = [
|
2024-08-18 22:22:59 +00:00
|
|
|
{
|
|
|
|
# pie
|
2023-10-24 16:10:54 +00:00
|
|
|
publicKey = "hPTXEqQ2GYEywdPNdZBacwB9KKcoFZ/heClxnqmizyw=";
|
2023-10-25 11:23:13 +00:00
|
|
|
allowedIPs = [
|
2024-02-08 18:23:22 +00:00
|
|
|
"10.13.12.2/32"
|
2023-11-01 15:27:29 +00:00
|
|
|
"fd00:b12f:acab:1312:acab:2::/96"
|
2023-10-25 11:23:13 +00:00
|
|
|
];
|
2024-02-12 23:27:30 +00:00
|
|
|
persistentKeepalive = 30;
|
|
|
|
dynamicEndpointRefreshSeconds = 30;
|
2023-10-24 15:56:14 +00:00
|
|
|
}
|
2024-08-18 22:22:59 +00:00
|
|
|
{
|
|
|
|
# droppie
|
2023-10-19 18:55:56 +00:00
|
|
|
publicKey = "qsnBMoj9Z16D8PJ5ummRtIfT5AiMpoF3SoOCo4sbyiw=";
|
2023-10-25 11:23:13 +00:00
|
|
|
allowedIPs = [
|
2024-02-08 18:23:22 +00:00
|
|
|
"10.13.12.3/32"
|
2023-11-01 15:27:29 +00:00
|
|
|
"fd00:b12f:acab:1312:acab:3::/96"
|
2023-10-25 11:23:13 +00:00
|
|
|
];
|
2024-02-12 23:27:30 +00:00
|
|
|
persistentKeepalive = 30;
|
|
|
|
dynamicEndpointRefreshSeconds = 30;
|
2023-10-19 18:55:56 +00:00
|
|
|
}
|
2024-08-18 22:22:59 +00:00
|
|
|
{
|
|
|
|
# chocolatebar
|
2023-10-19 18:55:56 +00:00
|
|
|
publicKey = "nk8EtGE/QsnSEm1lhLS3/w83nOBD2OGYhODIf92G91A=";
|
2023-10-25 11:23:13 +00:00
|
|
|
allowedIPs = [
|
2024-02-08 18:23:22 +00:00
|
|
|
"10.13.12.5/32"
|
2023-11-01 15:27:29 +00:00
|
|
|
"fd00:b12f:acab:1312:acab:5::/96"
|
2023-10-25 11:23:13 +00:00
|
|
|
];
|
2024-02-12 23:27:30 +00:00
|
|
|
persistentKeepalive = 30;
|
|
|
|
dynamicEndpointRefreshSeconds = 30;
|
2023-10-19 18:55:56 +00:00
|
|
|
}
|
2024-08-18 22:22:59 +00:00
|
|
|
{
|
|
|
|
# biolimo
|
2023-10-19 18:55:56 +00:00
|
|
|
publicKey = "4ymN7wwBuhF+h+5fFN0TqXmVyOe1AsWiTqRL0jJ3CDc=";
|
2023-10-25 11:23:13 +00:00
|
|
|
allowedIPs = [
|
2024-02-08 18:23:22 +00:00
|
|
|
"10.13.12.6/32"
|
2023-11-01 15:27:29 +00:00
|
|
|
"fd00:b12f:acab:1312:acab:6::/96"
|
2023-10-25 11:23:13 +00:00
|
|
|
];
|
2024-02-12 23:27:30 +00:00
|
|
|
persistentKeepalive = 30;
|
|
|
|
dynamicEndpointRefreshSeconds = 30;
|
2024-01-27 22:53:36 +00:00
|
|
|
}
|
2024-08-18 22:22:59 +00:00
|
|
|
{
|
|
|
|
# stroopwafel
|
2024-01-27 22:53:36 +00:00
|
|
|
publicKey = "5iNRg13utOJ30pX2Z8SjwPNUFwfH2zonlbeYW2mKFkU=";
|
|
|
|
allowedIPs = [
|
2024-02-08 18:23:22 +00:00
|
|
|
"10.13.12.8/32"
|
2024-01-27 22:53:36 +00:00
|
|
|
"fd00:b12f:acab:1312:acab:8::/96"
|
|
|
|
];
|
2024-02-12 23:27:30 +00:00
|
|
|
persistentKeepalive = 30;
|
|
|
|
dynamicEndpointRefreshSeconds = 30;
|
2023-10-19 18:55:56 +00:00
|
|
|
}
|
2024-08-18 22:22:59 +00:00
|
|
|
{
|
|
|
|
# fp3
|
2024-03-19 17:39:14 +00:00
|
|
|
publicKey = "wQJXFibxhWkyUbRPrPt5y/YfDnH3gDQ5a/PWoyxDfDI=";
|
|
|
|
allowedIPs = [
|
|
|
|
"10.13.12.9/32"
|
|
|
|
# "fd00:b12f:acab:1312:acab:9::/96"
|
|
|
|
];
|
|
|
|
persistentKeepalive = 30;
|
|
|
|
dynamicEndpointRefreshSeconds = 30;
|
|
|
|
}
|
2023-10-19 18:55:56 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|