WG range added
This commit is contained in:
+2
-3
@@ -25,6 +25,7 @@ with lib;
|
||||
|
||||
# WIREGUARD
|
||||
vars.wg_adress = "";
|
||||
vars.wg_range = "";
|
||||
vars.wg_privateKey = "";
|
||||
vars.wg_publicKey = "";
|
||||
vars.wg_presharedKey = "";
|
||||
@@ -41,8 +42,6 @@ with lib;
|
||||
# NFS
|
||||
vars.nfs_server = "";
|
||||
vars.nfs_volume = "";
|
||||
vars.nfs_mount = "";
|
||||
|
||||
|
||||
vars.nfs_mount = "";
|
||||
|
||||
}
|
||||
|
||||
+4
-1
@@ -7,6 +7,9 @@ with lib;
|
||||
wg_adress = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
wg_range = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
wg_privateKey = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
@@ -75,4 +78,4 @@ with lib;
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -11,16 +11,16 @@
|
||||
autostart = true;
|
||||
postUp = ''
|
||||
${pkgs.procps}/bin/sysctl -w net.ipv4.conf.wg0.rp_filter=2
|
||||
${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -o wg0 -d 10.6.0.1 -j SNAT --to-source ${config.vars.local_ip}
|
||||
${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -o wg0 -d ${config.vars.wg_range} -j SNAT --to-source ${config.vars.local_ip}
|
||||
'';
|
||||
postDown = ''
|
||||
${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -o wg0 -d 10.6.0.1 -j SNAT --to-source ${config.vars.local_ip}
|
||||
${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -o wg0 -d ${config.vars.wg_range} -j SNAT --to-source ${config.vars.local_ip}
|
||||
'';
|
||||
privateKey = config.vars.wg_privateKey;
|
||||
peers = [{
|
||||
publicKey = config.vars.wg_publicKey;
|
||||
presharedKey = config.vars.wg_presharedKey;
|
||||
allowedIPs = [ "10.6.0.0/24" ];
|
||||
allowedIPs = [ config.vars.wg_range ];
|
||||
endpoint = config.vars.wg_endpoint;
|
||||
persistentKeepalive = 25;
|
||||
}];
|
||||
|
||||
Reference in New Issue
Block a user