nixfiles/hosts/vault/profiles/wireguard.nix

37 lines
1.1 KiB
Nix
Raw Normal View History

{config, ...}: let
secrets = config.services.secrets.secrets;
2023-08-09 20:53:22 +01:00
data = import ../../../data/chaos_wireguard_internal.nix {};
2022-11-11 20:53:17 +00:00
in {
networking.wg-quick.interfaces = {
wg0 = {
2023-08-09 20:53:22 +01:00
address = ["10.69.42.2/32"];
2022-11-11 20:53:17 +00:00
listenPort = 51820;
privateKeyFile = "${secrets.wg_priv.path}";
2022-11-11 20:53:17 +00:00
peers = [
# hetzner-vm
{
2023-08-09 20:53:22 +01:00
publicKey = "${data.hosts.hetzner-vm.public}";
presharedKeyFile = "${secrets.wg_preshared_hetzner-vm.path}";
2023-08-09 20:53:22 +01:00
allowedIPs = ["${data.hosts.hetzner-vm.ip}/32"];
endpoint = "${data.hosts.hetzner-vm.endpoint}";
2022-11-11 20:53:17 +00:00
persistentKeepalive = 25;
}
# iphone8
{
2023-08-09 20:53:22 +01:00
publicKey = "${data.hosts.iphone8.public}";
presharedKeyFile = "${secrets.wg_preshared_iphone8.path}";
2023-08-09 20:53:22 +01:00
allowedIPs = ["${data.hosts.iphone8.ip}/32"];
}
# lappy-t495
{
publicKey = "${data.hosts.lappy-t495.public}";
presharedKeyFile = "${secrets.wg_preshared_lappy-t495.path}";
allowedIPs = ["${data.hosts.lappy-t495.ip}/32"];
}
2022-11-11 20:53:17 +00:00
];
};
};
networking.firewall.allowedUDPPorts = [51820];
2022-11-11 20:53:17 +00:00
}