configuration.nix/hosts/rico2/wireguard.nix

43 lines
1.1 KiB
Nix
Raw Normal View History

2024-06-30 17:54:04 +05:30
{ config, ... }: {
2024-07-02 23:20:11 +05:30
sops.secrets = {
"wireguard/rico2/pk" = {
mode = "400";
owner = config.users.users.root.name;
group = config.users.users.root.group;
};
"wireguard/rico2/psk" = {
mode = "400";
owner = config.users.users.root.name;
group = config.users.users.root.group;
};
2024-06-30 18:45:27 +05:30
};
2024-07-02 23:20:11 +05:30
2024-06-30 17:54:04 +05:30
networking.firewall.trustedInterfaces = [ "wg0" ];
networking.wireguard = {
enable = true;
interfaces = {
wg0 = {
ips = [
"10.10.10.12/24"
"fd7c:585c:c4ae::12/64"
];
2024-07-02 23:20:11 +05:30
listenPort = 51832;
privateKeyFile = config.sops.secrets."wireguard/rico2/pk".path;
2024-06-30 17:54:04 +05:30
peers = [
{
name = "Proxy";
endpoint = "165.232.180.97:51821";
publicKey = "NNw/iDMCTq8mpHncrecEh4UlvtINX/UUDtCJf2ToFR4=";
2024-07-02 23:20:11 +05:30
presharedKeyFile = config.sops.secrets."wireguard/rico2/psk".path;
2024-06-30 17:54:04 +05:30
persistentKeepalive = 20;
allowedIPs = [
"10.10.10.0/24"
"fd7c:585c:c4ae::0/64"
];
}
];
};
};
};
}