allow clients with no privateKey

see https://github.com/wg-easy/wg-easy/discussions/791

I disabled the download from the frontend.
If someone tries to manually call the API, the privateKey block is set to "REPLACE_ME" to indicate that this value must be set manually.
This commit is contained in:
Thomas Willems 2024-01-27 19:15:07 +01:00
parent bfd281fc9f
commit c7cc3eca4a
No known key found for this signature in database
4 changed files with 27 additions and 8 deletions

View file

@ -141,7 +141,7 @@ AllowedIPs = ${client.address}/32`;
createdAt: new Date(client.createdAt),
updatedAt: new Date(client.updatedAt),
allowedIPs: client.allowedIPs,
downloadableConfig: 'privateKey' in client,
persistentKeepalive: null,
latestHandshakeAt: null,
transferRx: null,
@ -198,7 +198,7 @@ AllowedIPs = ${client.address}/32`;
return `
[Interface]
PrivateKey = ${client.privateKey}
PrivateKey = ${client.privateKey ? `${client.privateKey}` : 'REPLACE_ME'}
Address = ${client.address}/24
${WG_DEFAULT_DNS ? `DNS = ${WG_DEFAULT_DNS}` : ''}
${WG_MTU ? `MTU = ${WG_MTU}` : ''}