wireguard: init wireguard service

This commit is contained in:
Moritz Böhme 2023-02-24 12:08:29 +01:00
parent 8920ce2ec5
commit ed5623256c
Signed by: moritz
GPG key ID: 970C6E89EB0547A9
6 changed files with 76 additions and 0 deletions

View file

@ -96,6 +96,7 @@ with lib; {
openvpn.enable = true; openvpn.enable = true;
printing.enable = true; printing.enable = true;
redshift.enable = true; redshift.enable = true;
wireguard.enable = true;
}; };
}; };

View file

@ -12,5 +12,6 @@
./picom.nix ./picom.nix
./printing.nix ./printing.nix
./redshift.nix ./redshift.nix
./wireguard.nix
]; ];
} }

View file

@ -0,0 +1,41 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.services.wireguard;
in
{
options.my.services.wireguard.enable = mkEnableOption "wireguard";
config = lib.mkIf cfg.enable {
age.secrets = {
wireguard-private-key.file = ../../secrets/wireguard-private-key.age;
wireguard-preshared-key.file = ../../secrets/wireguard-preshared-key.age;
};
networking.firewall = {
allowedUDPPorts = [ 51820 ];
};
networking.wg-quick.interfaces = {
wg0 = {
autostart = false;
address = [ "10.8.0.3/24" ];
listenPort = 51820;
privateKeyFile = "/run/agenix/wireguard-private-key";
peers = [
{
publicKey = "bT/U8ko3i//vH8LNn2R56JkGMg+0GLFrZSF81BBax08=";
presharedKeyFile = "/run/agenix/wireguard-preshared-key";
# Forward all the traffic via VPN.
allowedIPs = [ "0.0.0.0/0" ];
endpoint = "wg.moritzboeh.me:51820";
persistentKeepalive = 25;
}
];
};
};
};
}

View file

@ -18,4 +18,6 @@ in
"spotifyd.age".publicKeys = all; "spotifyd.age".publicKeys = all;
"ssh-home.age".publicKeys = all; "ssh-home.age".publicKeys = all;
"uni-vpn.age".publicKeys = all; "uni-vpn.age".publicKeys = all;
"wireguard-preshared-key.age".publicKeys = all;
"wireguard-private-key.age".publicKeys = all;
} }

View file

@ -0,0 +1,16 @@
age-encryption.org/v1
-> ssh-ed25519 CjuqfA HUg3FETh6ezG8DcEaFW/VYrzKoqpGKpWQKk2R+e4zz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DDR26gpRCdJMWtzoGvUTErI6GMSdF99kTNKtc
-> ssh-ed25519 ZYd7Zg vz3LZxq0+KTx6E4J0X6duivLP0TFtA8WaOQaiSmMcF4
5g+3H/6J9FjsWifcfmEq8dz0hk4mpZhhJaEndPE3Mpw
-> ssh-ed25519 as9VYQ VIQ18yC/qEiP66hfCwWAbAbNCBypB47gbWkFg/TJmWE
MXK5RnuwAlKt676CPO0N/3BeM9gsgMPZNEG1DXq8uXA
-> 8kx-grease s%obC ~GOw1 C
--- V8z981BPe2yVOaMCj2np9Vvvy/6zP8xHCFKRFwsceXs
¢»„•¤ÇÜà+<2B>Xobë_)È<zݯmDPoçßê±Kð½ùÛÞZåé=ØÂ¥ºt-·b+}vûçµpgÝÊU' þø#/89„