wg sops
This commit is contained in:
@@ -10,12 +10,21 @@
|
|||||||
config.sops.secrets."${config.syscfg.hostname}_wg_priv".path;
|
config.sops.secrets."${config.syscfg.hostname}_wg_priv".path;
|
||||||
listenPort = 1515;
|
listenPort = 1515;
|
||||||
mtu = 1340;
|
mtu = 1340;
|
||||||
|
postUp = if config.syscfg.net.wg.server.enable then ''
|
||||||
|
for keyfile in /run/secrets/*_wg_pub; do
|
||||||
|
if [ -f "$keyfile" ]; then
|
||||||
|
${pkgs.wireguard-tools}/bin/wg set %i \
|
||||||
|
peer "$(cat "$keyfile")" \
|
||||||
|
allowed-ips 10.10.1.0/24,fd10:10:10::0/64
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
'' else '''';
|
||||||
peers =
|
peers =
|
||||||
if config.syscfg.net.wg.server.enable then
|
if config.syscfg.net.wg.server.enable then
|
||||||
map(secretName:{
|
map(secretName:{
|
||||||
name = "${secretName}";
|
name = "${secretName}";
|
||||||
allowedIPs = [ "10.10.1.0/24" "fd10:10:10::0/64" ];
|
allowedIPs = [ "10.10.1.0/24" "fd10:10:10::0/64" ];
|
||||||
publicKeyFile = config.sops.secrets."${secretName}_wg_pub".path;
|
publicKey = config.sops.secrets."${secretName}_wg_pub".path;
|
||||||
}) config.syscfg.net.wg.server.peers
|
}) config.syscfg.net.wg.server.peers
|
||||||
else
|
else
|
||||||
[{
|
[{
|
||||||
|
|||||||
Reference in New Issue
Block a user