Add Linode host configuration and WireGuard setup
- Introduced new configuration files for Linode host, including hardware configuration, toggles, and WireGuard settings. - Updated flake.nix to include the new images.nix file for Linode image generation. - Adjusted SSH key paths and secrets management for WireGuard to ensure proper integration with the new host setup. - Enhanced firewall rules and NAT configuration for WireGuard to improve security and connectivity.
This commit is contained in:
@@ -63,6 +63,7 @@ in
|
||||
server = "enp0s31f6";
|
||||
miniserver = "enp2s0";
|
||||
workstation = "enp5s0";
|
||||
linode = "eth0";
|
||||
};
|
||||
description = "Set of network interface names for all my computers.";
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@ in
|
||||
{
|
||||
options.my.services.wireguard.enable = lib.mkEnableOption "WireGuard VPN configuration";
|
||||
config = lib.mkIf (config.my.services.wireguard.enable && config.my.secureHost) {
|
||||
sops.secrets."wireguard/private".sopsFile = ../../secrets/wireguard.yaml;
|
||||
sops.secrets."wireguard/server/private".sopsFile = ../../secrets/wireguard.yaml;
|
||||
networking = {
|
||||
firewall.allowedUDPPorts = [ port ];
|
||||
nat = {
|
||||
@@ -22,13 +22,9 @@ in
|
||||
wireguard.interfaces.wg0 = {
|
||||
ips = [ "10.100.0.1/24" ];
|
||||
listenPort = port;
|
||||
postSetup = ''
|
||||
${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s 10.100.0.0/24 -o ${interface} -j MASQUERADE
|
||||
'';
|
||||
postShutdown = ''
|
||||
${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.100.0.0/24 -o ${interface} -j MASQUERADE
|
||||
'';
|
||||
privateKeyFile = config.sops.secrets."wireguard/private".path;
|
||||
postSetup = "${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s 10.100.0.0/24 -o ${interface} -j MASQUERADE";
|
||||
postShutdown = "${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.100.0.0/24 -o ${interface} -j MASQUERADE";
|
||||
privateKeyFile = config.sops.secrets."wireguard/server/private".path;
|
||||
peers = [
|
||||
{
|
||||
publicKey = "ciupBjCcIpd3K5vlzNMJC8iiyNqB9xXwkSC6UXPKP3g=";
|
||||
|
||||
Reference in New Issue
Block a user