pepe -> robi is working, robi -> pepe is not

feature/wireguard
Ingolf Wagner 2023-01-19 12:31:04 +01:00
parent 68b0e6dda1
commit 64c5d577e8
Signed by: palo
GPG Key ID: 76BF5F1928B9618B
8 changed files with 106 additions and 4 deletions

View File

@ -936,11 +936,11 @@
"secrets": {
"flake": false,
"locked": {
"lastModified": 1666166753,
"narHash": "sha256-Gev83ZYEkEEXKcz+ChNajNzzuqPodjVbSlgdHLHXtVs=",
"lastModified": 1674110639,
"narHash": "sha256-IpvJcMtRxcUM4gk8Ha0yKsIJs7Dmo+r9XBb8wUM2sDo=",
"ref": "main",
"rev": "c5c4fad9987a0aaab4d2b072fe40ec55f15462d2",
"revCount": 39,
"rev": "ef5f10f16f670e26c950bacf95d3d0ec90f0a371",
"revCount": 40,
"type": "git",
"url": "ssh://gitea@git.ingolf-wagner.de/palo/nixos-secrets.git"
},

View File

@ -21,6 +21,7 @@
./taskwarrior-pushover.nix
#./neo4j.nix
./jellyfin.nix
./wireguard.nix
];

View File

@ -13,6 +13,7 @@
backup.dirs = [ "/var/lib/home-assistant" ];
networking.firewall.allowedTCPPorts = [ 8123 ];
networking.firewall.allowedUDPPorts = [ 8123 ];

View File

@ -0,0 +1,28 @@
{ pkgs, config, ... }:
{
networking.firewall.trustedInterfaces = [ "wg0" ];
networking.firewall.allowedUDPPorts = [ 51820 ];
sops.secrets.wireguard_private = { };
# Enable WireGuard
networking.wg-quick.interfaces = {
# Hub and Spoke Setup
# https://www.procustodibus.com/blog/2020/11/wireguard-hub-and-spoke-config/
wg0 = {
address = [ "10.100.0.2/32" ];
listenPort = 51820; # to match firewall allowedUDPPorts (without this wg uses random port numbers)
privateKeyFile = config.sops.secrets.wireguard_private.path;
# server
peers = [
{
# robi
publicKey = "uWR93xJe5oEbX3DsAYpOS9CuSg1VmXEQxJzdlJpe3DU=";
allowedIPs = [ "10.100.0.1/32" ];
endpoint = "ingolf-wagner.de:51820";
persistentKeepalive = 25;
}
];
};
};
}

View File

@ -27,6 +27,7 @@
./transmission2.nix
./vaultwarden.nix
./nginx.nix
./wireguard.nix
#../../system/server

View File

@ -0,0 +1,46 @@
{ pkgs, config, ... }:
{
networking.firewall.trustedInterfaces = [ "wg0" ];
networking.firewall.allowedUDPPorts = [ 51820 ];
sops.secrets.wireguard_private = { };
boot.kernel.sysctl."net.ipv4.ip_forward" = true;
# Enable WireGuard
networking.wg-quick.interfaces = {
# Hub and Spoke Setup
# https://www.procustodibus.com/blog/2020/11/wireguard-hub-and-spoke-config/
wg0 = {
address = [ "10.100.0.1/32" ];
listenPort = 51820; # to match firewall allowedUDPPorts (without this wg uses random port numbers)
privateKeyFile = config.sops.secrets.wireguard_private.path;
#postUp = ''
# ${pkgs.iptables}/bin/iptables -A FORWARD -i wg0 -j ACCEPT
# ${pkgs.iptables}/bin/iptables -A INPUT -i wg0 -m state --state ESTABLISHED,RELATED -j ACCEPT
#'';
#postDown = ''
# ${pkgs.iptables}/bin/iptables -D FORWARD -i wg0 -j ACCEPT
# ${pkgs.iptables}/bin/iptables -D INPUT -i wg0 -m state --state ESTABLISHED,RELATED -j ACCEPT
#'';
# clients
peers = [
{
# pepe
publicKey = "wb54y/fG8ocSH9QrDmfajez/fUcJBZK369xLu37XBHk=";
allowedIPs = [ "10.100.0.2/32" ];
}
{
# sterni
publicKey = "SdMRgC5IM7dywzZxLAHm45cpj9J3IENTMClZm1BxbV4=";
allowedIPs = [ "10.100.0.3/32" ];
}
{
# iphone
publicKey = "XPVzH+wBLsqukTHHjngkGJhYN0nRdQ7esadiimMJQnI=";
allowedIPs = [ "10.100.0.4/32" ];
}
];
};
};
}

View File

@ -14,6 +14,7 @@
#./wireshark.nix
./scanner.nix
./qemu.nix
./wireguard.nix
];

View File

@ -0,0 +1,24 @@
{ config, ... }:
{
networking.firewall.allowedUDPPorts = [ 51820 ];
sops.secrets.wireguard_private = { };
# Enable WireGuard
networking.wg-quick.interfaces = {
# Hub and Spoke Setup
# https://www.procustodibus.com/blog/2020/11/wireguard-hub-and-spoke-config/
wg0 = {
address = [ "10.100.0.3/32" ];
listenPort = 51820; # to match firewall allowedUDPPorts (without this wg uses random port numbers)
privateKeyFile = config.sops.secrets.wireguard_private.path;
peers = [
{
# robi
publicKey = "uWR93xJe5oEbX3DsAYpOS9CuSg1VmXEQxJzdlJpe3DU=";
allowedIPs = [ "10.100.0.1/32" ];
endpoint = "ingolf-wagner.de:51820";
}
];
};
};
}