2023-12-01 13:25:48 +01:00
|
|
|
{ pkgs, config, lib, ... }: {
|
|
|
|
|
2023-12-11 13:07:16 +01:00
|
|
|
# Allow these hosts to directly communicate with their hostnames
|
2023-12-11 13:07:47 +01:00
|
|
|
networking.extraHosts = ''
|
2023-12-11 13:07:16 +01:00
|
|
|
10.100.0.1 osaka-linode-01
|
|
|
|
10.100.0.2 framework-server
|
2024-01-29 08:30:25 +01:00
|
|
|
10.100.0.3 backups-rpi4
|
2023-12-11 13:07:16 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
networking.firewall.interfaces.wireguard0.allowedTCPPorts = [ 22 ];
|
|
|
|
|
2023-12-01 13:25:48 +01:00
|
|
|
# Set up the secrets file:
|
2024-01-12 09:23:27 +01:00
|
|
|
sops.secrets."wireguard_key" = {
|
2023-12-01 13:25:48 +01:00
|
|
|
owner = "root";
|
2024-01-12 09:23:27 +01:00
|
|
|
sopsFile = ../../../secrets/hosts/framework-server.yaml;
|
2023-12-01 13:25:48 +01:00
|
|
|
};
|
2024-01-12 09:23:27 +01:00
|
|
|
sops.secrets."preshared_key" = {
|
2023-12-01 13:25:48 +01:00
|
|
|
owner = "root";
|
|
|
|
sopsFile = ../../../secrets/wireguard.yaml;
|
|
|
|
};
|
|
|
|
|
|
|
|
# Wireguard Forwarder
|
|
|
|
networking.firewall.allowPing = true;
|
|
|
|
networking.wireguard = {
|
|
|
|
enable = true;
|
|
|
|
interfaces = {
|
|
|
|
"wireguard0" = {
|
|
|
|
ips = [ "10.100.0.2/24" ];
|
|
|
|
listenPort = 51820;
|
2024-01-12 09:23:27 +01:00
|
|
|
privateKeyFile = "/run/secrets/wireguard_key";
|
2023-12-01 13:25:48 +01:00
|
|
|
# Testing
|
|
|
|
peers = [
|
2023-12-05 14:01:33 +01:00
|
|
|
{ # osaka-linode-01
|
2023-12-01 13:25:48 +01:00
|
|
|
publicKey = "yPZ3EmmIqCkReXf1DRTxzVaKQ2k+ifGmYJHji5nnMmE=";
|
2024-01-12 09:23:27 +01:00
|
|
|
presharedKeyFile = "/run/secrets/preshared_key";
|
2023-12-01 13:25:48 +01:00
|
|
|
persistentKeepalive = 5;
|
|
|
|
allowedIPs = [ "10.100.0.1/32" ];
|
2023-12-05 14:38:06 +01:00
|
|
|
endpoint = "172.234.84.222:51820"; # osaka-linode-01
|
2023-12-01 13:25:48 +01:00
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|