feat(hosts/pi4): Added wireguard config

This commit is contained in:
GaspardCulis 2024-11-05 23:42:08 +01:00
parent d8304b993d
commit 805e5ee2ae

View file

@ -1,4 +1,8 @@
{pkgs, ...}: {
{
config,
pkgs,
...
}: {
imports = [
./hardware-configuration.nix
];
@ -35,4 +39,32 @@
};
};
};
# SOPS
sops.defaultSopsFile = ../../secrets/pi4/default.yaml;
sops.secrets."wireguard/private_key".owner = "root";
# Wireguard
networking.firewall = {
allowedUDPPorts = [51820];
};
networking.wireguard.interfaces = {
wg0 = {
ips = ["10.8.0.31/24"];
listenPort = 51820; # Should match firewall allowedUDPPorts
privateKeyFile = config.sops.secrets."wireguard/private_key".path;
peers = [
{
publicKey = "KLULII6VEUWMhyIba6oxxHdZsVP3TMVlNY1Vz49q7jg=";
allowedIPs = ["0.0.0.0/0"];
endpoint = "vpn.gasdev.fr:993";
persistentKeepalive = 25;
}
];
};
};
}