feat(heimdall+desktop): setup wireguard tunnel.
This commit is contained in:
parent
be539374c0
commit
5fa7edbc18
10 changed files with 63 additions and 13 deletions
|
@ -175,6 +175,7 @@
|
||||||
./modules/linux/nixos
|
./modules/linux/nixos
|
||||||
# Still no specific modules here
|
# Still no specific modules here
|
||||||
# ./modules/cross-platform/nixos
|
# ./modules/cross-platform/nixos
|
||||||
|
agenix.nixosModules.default
|
||||||
# Setup home manager for my user
|
# Setup home manager for my user
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
./sunshine.nix
|
./sunshine.nix
|
||||||
./nh.nix
|
./nh.nix
|
||||||
./ollama.nix
|
./ollama.nix
|
||||||
|
./secrets.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
crony.bluetooth.enable = lib.mkDefault true;
|
crony.bluetooth.enable = lib.mkDefault true;
|
||||||
|
|
10
modules/linux/nixos/secrets.nix
Normal file
10
modules/linux/nixos/secrets.nix
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
age = {
|
||||||
|
secrets = {
|
||||||
|
wg-desktop = {
|
||||||
|
file = ../../../secrets/wg-desktop.age;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
identityPaths = ["/home/crony/.ssh/main"];
|
||||||
|
};
|
||||||
|
}
|
|
@ -8,19 +8,10 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf config.crony.wireguard.enable {
|
config = lib.mkIf config.crony.wireguard.enable {
|
||||||
# Allow for wireguard traffic
|
# Setup wireguard
|
||||||
networking.firewall = {
|
networking.wg-quick.interfaces.wg0 = {
|
||||||
# if packets are still dropped, they will show up in dmesg
|
autostart = false;
|
||||||
logReversePathDrops = true;
|
configFile = "${config.age.secrets.wg-desktop.path}";
|
||||||
# wireguard trips rpfilter up
|
|
||||||
extraCommands = ''
|
|
||||||
ip46tables -t mangle -I nixos-fw-rpfilter -p udp -m udp --sport 51820 -j RETURN
|
|
||||||
ip46tables -t mangle -I nixos-fw-rpfilter -p udp -m udp --dport 51820 -j RETURN
|
|
||||||
'';
|
|
||||||
extraStopCommands = ''
|
|
||||||
ip46tables -t mangle -D nixos-fw-rpfilter -p udp -m udp --sport 51820 -j RETURN || true
|
|
||||||
ip46tables -t mangle -D nixos-fw-rpfilter -p udp -m udp --dport 51820 -j RETURN || true
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,5 +2,7 @@
|
||||||
imports = [
|
imports = [
|
||||||
./uptime-kuma.nix
|
./uptime-kuma.nix
|
||||||
./ntfy-sh.nix
|
./ntfy-sh.nix
|
||||||
|
./wireguard.nix
|
||||||
|
./secrets.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
9
modules/servers/heimdall/secrets.nix
Normal file
9
modules/servers/heimdall/secrets.nix
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
age = {
|
||||||
|
secrets = {
|
||||||
|
wg-heimdall = {
|
||||||
|
file = ../../../secrets/wg-heimdall.age;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
24
modules/servers/heimdall/wireguard.nix
Normal file
24
modules/servers/heimdall/wireguard.nix
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
{config, ...}: {
|
||||||
|
networking = {
|
||||||
|
nat = {
|
||||||
|
enable = true;
|
||||||
|
enableIPv6 = true;
|
||||||
|
externalInterface = "enp1s0";
|
||||||
|
internalInterfaces = ["wg0"];
|
||||||
|
};
|
||||||
|
firewall = {
|
||||||
|
allowedTCPPorts = [53];
|
||||||
|
allowedUDPPorts = [53 51820];
|
||||||
|
};
|
||||||
|
wg-quick.interfaces.wg0.configFile = "${config.age.secrets.wg-heimdall.path}";
|
||||||
|
};
|
||||||
|
|
||||||
|
services.dnsmasq = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
interface = "wg0";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
boot.kernel.sysctl."net.ipv4.ip_forward" = 1;
|
||||||
|
}
|
|
@ -11,4 +11,6 @@ let
|
||||||
systems = [heimdall];
|
systems = [heimdall];
|
||||||
in {
|
in {
|
||||||
"traefik.age".publicKeys = systems ++ users;
|
"traefik.age".publicKeys = systems ++ users;
|
||||||
|
"wg-heimdall.age".publicKeys = systems ++ users;
|
||||||
|
"wg-desktop.age".publicKeys = systems ++ users;
|
||||||
}
|
}
|
||||||
|
|
10
secrets/wg-desktop.age
Normal file
10
secrets/wg-desktop.age
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
age-encryption.org/v1
|
||||||
|
-> ssh-ed25519 2P4nKw PmQyF+dwOGsxBl9Cb8fPAF2szc58PxBDQYQHQHjj3To
|
||||||
|
4JC0/xuiU+hQRw2JP7F/AbQR7ewNygTIcYDr99kRRsI
|
||||||
|
-> ssh-ed25519 fd/ZLQ xzfSyCwim1CDwS+EipluJsp6PFQap5CAAVqcFjcmq2w
|
||||||
|
1v6DZMND3RUx8bYLNegFCulI6t6YJWc7R140o5YuJNw
|
||||||
|
--- gT2MyDArAIxv/DbiaPNesbtHjBROCp55KtVX1cQfUNQ
|
||||||
|
ʆ²‰¶ü`%~}^÷PœŠdbÃZ´Ésõ
&iŸ¦þ3‡”.ø
QÇ”sêct5?,[ 1PRq€‘»¼0ü,Wgay„HJîºèbÏð…ttÓàÚezTlÁc6ç²Àðê
Ï®ÍÇ´øzÓ(iá°íQ8ð‘ç> 3õ9“ÝP/sK‡Ã>¡í„ÑIί‘h‘Ri³£J½¡|d#O<7ÎNšÓãå!ÀÛß]+gÁ:¢¸»O¡züm8 Õï’ÀˆK¿F‰ì‹ïªLv-Às¿f%-ëgòzàÿ'ÆÖ“7H>c³
|
||||||
|
%®ràК¶õDœK!©ü×Fçy‰ÿ<E280B0>!e{ðô—Zi0T½^f0tqƒWlI.6æ´¤²B;
|
||||||
|
#9^ÿbJˆõDa¿=!úˆ¹æ…+Ânoö!æ˜
|
||||||
|
®1 ”Õ\°Á‡1ëK#+a4}&ièñ=—'QÆñ®pÅŒp²o'¢2ËP.ÉàïÒ\67|f4Ͷ—<C2B6>/€~Ì…$µ?…&Câ?Ký§
|
BIN
secrets/wg-heimdall.age
Normal file
BIN
secrets/wg-heimdall.age
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue