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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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 {

View file

@ -206,7 +206,7 @@
<summary><strong>Public and Preshared Keys</strong>
<i class="fas fa-info-circle" data-toggle="tooltip"
data-original-title="If you don't want to let the server generate and store the
client's private, you can manually specify its public and preshared key here
client's private key, you can manually specify its public and preshared key here
. Note: QR code will not be generated">
</i>
</summary>
@ -220,7 +220,7 @@
<label for="client_preshared_key" class="control-label">
Preshared Key
</label>
<input type="text" class="form-control" id="client_preshared_key" name="client_preshared_key" placeholder="Autogenerated">
<input type="text" class="form-control" id="client_preshared_key" name="client_preshared_key" placeholder="Autogenerated - enter &quot;-&quot; to skip generation">
</div>
</details>
</div>