diff options
author | Paul Dee <itsascambutmailmeanyway@gmail.com> | 2021-11-11 01:31:43 +0100 |
---|---|---|
committer | Paul Dee <itsascambutmailmeanyway@gmail.com> | 2021-11-11 01:31:43 +0100 |
commit | 8a9dbe39d5b5f3227f46868b3b15f7cc72a50651 (patch) | |
tree | 4cb6427f719036cb03910ece4ddc64baa3298aa1 /protocols/luci-proto-wireguard/root/usr | |
parent | f16a2f3fbae0c527af812388390cc1bebe8d7eb3 (diff) |
luci-proto-wireguard: display interface public key
Signed-off-by: Paul Dee <itsascambutmailmeanyway@gmail.com>
Diffstat (limited to 'protocols/luci-proto-wireguard/root/usr')
-rwxr-xr-x | protocols/luci-proto-wireguard/root/usr/libexec/rpcd/luci.wireguard | 8 | ||||
-rw-r--r-- | protocols/luci-proto-wireguard/root/usr/share/rpcd/acl.d/luci-wireguard.json | 1 |
2 files changed, 9 insertions, 0 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 681e98e5c4..bbe91cdd6a 100755 --- a/protocols/luci-proto-wireguard/root/usr/libexec/rpcd/luci.wireguard +++ b/protocols/luci-proto-wireguard/root/usr/libexec/rpcd/luci.wireguard @@ -16,6 +16,14 @@ local methods = { return {keys = {priv = prv, pub = pub}} end }, + getPublicAndPrivateKeyFromPrivate = { + args = {privkey = "privkey"}, + call = function(args) + local pubkey = sys.exec("echo %s | wg pubkey 2>/dev/null" % util.shellquote(args.privkey)):sub(1, -2) + + return {keys = {priv = args.privkey, pub = pubkey}} + end + }, generateQrCode = { args = {privkey = "privkey", psk = "psk", allowed_ips = {"allowed_ips"}}, call = function(args) 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 04877d4f49..aa949b9d14 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 @@ -5,6 +5,7 @@ "ubus": { "luci.wireguard": [ "generateKeyPair", + "getPublicAndPrivateKeyFromPrivate", "generateQrCode" ] } |