summaryrefslogtreecommitdiffhomepage
path: root/protocols/luci-proto-wireguard/root
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/luci-proto-wireguard/root')
-rwxr-xr-xprotocols/luci-proto-wireguard/root/usr/libexec/rpcd/luci.wireguard7
-rw-r--r--protocols/luci-proto-wireguard/root/usr/share/rpcd/acl.d/luci-wireguard.json3
2 files changed, 9 insertions, 1 deletions
diff --git a/protocols/luci-proto-wireguard/root/usr/libexec/rpcd/luci.wireguard b/protocols/luci-proto-wireguard/root/usr/libexec/rpcd/luci.wireguard
index bbe91cdd6a..f1f8f16d00 100755
--- a/protocols/luci-proto-wireguard/root/usr/libexec/rpcd/luci.wireguard
+++ b/protocols/luci-proto-wireguard/root/usr/libexec/rpcd/luci.wireguard
@@ -8,6 +8,13 @@ local uci = require "uci"
local fs = require "nixio.fs"
local methods = {
+ generatePsk = {
+ call = function()
+ local psk = sys.exec("wg genpsk"):sub(1, -2)
+
+ return {psk = psk}
+ end
+ },
generateKeyPair = {
call = function()
local prv = sys.exec("wg genkey 2>/dev/null"):sub(1, -2)
diff --git a/protocols/luci-proto-wireguard/root/usr/share/rpcd/acl.d/luci-wireguard.json b/protocols/luci-proto-wireguard/root/usr/share/rpcd/acl.d/luci-wireguard.json
index aa949b9d14..9d0a561411 100644
--- a/protocols/luci-proto-wireguard/root/usr/share/rpcd/acl.d/luci-wireguard.json
+++ b/protocols/luci-proto-wireguard/root/usr/share/rpcd/acl.d/luci-wireguard.json
@@ -6,7 +6,8 @@
"luci.wireguard": [
"generateKeyPair",
"getPublicAndPrivateKeyFromPrivate",
- "generateQrCode"
+ "generateQrCode",
+ "generatePsk"
]
}
}