From ea4e47523097831c9d9020c421289f4124464da8 Mon Sep 17 00:00:00 2001 From: Florian Rattay Date: Mon, 1 Aug 2022 14:56:23 +0200 Subject: [PATCH] Import json configurations with no PreShared-Key --- src/lib/WireGuard.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/WireGuard.js b/src/lib/WireGuard.js index 7886ac91..774e3858 100644 --- a/src/lib/WireGuard.js +++ b/src/lib/WireGuard.js @@ -110,8 +110,8 @@ PostDown = ${WG_POST_DOWN} # Client: ${client.name} (${clientId}) [Peer] PublicKey = ${client.publicKey} -PresharedKey = ${client.preSharedKey} -AllowedIPs = ${client.address}/32`; +${client.preSharedKey ? `PresharedKey = ${client.preSharedKey}\n` : '' +}AllowedIPs = ${client.address}/32`; } debug('Config saving...'); @@ -205,8 +205,8 @@ ${WG_MTU ? `MTU = ${WG_MTU}` : ''} [Peer] PublicKey = ${config.server.publicKey} -PresharedKey = ${client.preSharedKey} -AllowedIPs = ${WG_ALLOWED_IPS} +${client.preSharedKey ? `PresharedKey = ${client.preSharedKey}\n` : '' +}AllowedIPs = ${WG_ALLOWED_IPS} PersistentKeepalive = ${WG_PERSISTENT_KEEPALIVE} Endpoint = ${WG_HOST}:${WG_PORT}`; }