Skip PresharedKey generation (#271)

Helpful for those who already have users deployed.

Enter `-` in the Preshared Key field at user creation time to skip its
creation.

The template conf takes care of the rest.

Fixes issue #235
This commit is contained in:
Paul Dee
2022-12-13 21:35:13 +01:00
committed by GitHub
parent 99b586f1f7
commit 4b0a0d9061
2 changed files with 5 additions and 2 deletions

View File

@@ -231,6 +231,9 @@ func NewClient(db store.IStore) echo.HandlerFunc {
})
}
client.PresharedKey = presharedKey.String()
} else if client.PresharedKey == "-" {
client.PresharedKey = ""
log.Infof("skipped PresharedKey generation for user: %v", client.Name)
} else {
_, err := wgtypes.ParseKey(client.PresharedKey)
if err != nil {