fixed vps config

This commit is contained in:
Alexander Szczepanski
2021-09-23 13:14:59 +02:00
parent 405c38ef26
commit 0ace2043f0
3 changed files with 18 additions and 18 deletions

View File

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }:
let
secrets = import ./secrets.nix;
secrets = import ../configs/secrets.nix;
in
{
imports =
@ -24,21 +24,22 @@ in
useDHCP = false;
interfaces.ens3.useDHCP = true;
wireguard.interfaces = {
wg0 = {
ips = [ "10.100.0.1/24" ];
listenPort = 51820;
postSetup = ''
${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s 10.100.0.0/24 -o ens3 -j MASQUERADE
'';
postShutdown = ''
${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.100.0.0/24 -o ens3 -j MASQUERADE
'';
privateKey = secrets.wireguard-vps-private;
peers = [{
publicKey = secrets.wireguard-desktop-public;
presharedKey = secrets.wireguard-preshared;
allowedIPs = [ "10.100.0.2/32" ];
}];
wg0 = {
ips = [ "10.100.0.1/24" ];
listenPort = 51820;
postSetup = ''
${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s 10.100.0.0/24 -o ens3 -j MASQUERADE
'';
postShutdown = ''
${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.100.0.0/24 -o ens3 -j MASQUERADE
'';
privateKey = secrets.wireguard-vps-private;
peers = [{
publicKey = secrets.wireguard-desktop-public;
presharedKey = secrets.wireguard-preshared;
allowedIPs = [ "10.100.0.2/32" ];
}];
};
};
nat = {
@ -127,4 +128,3 @@ in
system.stateVersion = "21.05";
}