diff options
Diffstat (limited to 'protocols/luci-proto-yggdrasil/root')
-rwxr-xr-x | protocols/luci-proto-yggdrasil/root/usr/libexec/rpcd/luci.yggdrasil | 36 | ||||
-rw-r--r-- | protocols/luci-proto-yggdrasil/root/usr/share/rpcd/acl.d/luci-proto-yggdrasil.json | 10 |
2 files changed, 46 insertions, 0 deletions
diff --git a/protocols/luci-proto-yggdrasil/root/usr/libexec/rpcd/luci.yggdrasil b/protocols/luci-proto-yggdrasil/root/usr/libexec/rpcd/luci.yggdrasil new file mode 100755 index 0000000000..35d6627be7 --- /dev/null +++ b/protocols/luci-proto-yggdrasil/root/usr/libexec/rpcd/luci.yggdrasil @@ -0,0 +1,36 @@ +#!/bin/sh + +. /usr/share/libubox/jshn.sh + +case "$1" in + list) + json_init + json_add_object "generateKeyPair" + json_close_object + json_add_object "getPeers" + json_add_string "interface" + json_close_object + json_dump + ;; + call) + case "$2" in + generateKeyPair) + json_load "$(yggdrasil -genconf -json)" + json_get_vars PrivateKey + json_cleanup + json_init + json_add_object "keys" + json_add_string "priv" "$PrivateKey" + json_add_string "pub" "${PrivateKey:64}" + json_close_object + json_dump + ;; + getPeers) + read -r input + json_load "$input" + json_get_vars interface + yggdrasilctl -endpoint="unix:///tmp/yggdrasil/${interface}.sock" -json getPeers + ;; + esac + ;; +esac diff --git a/protocols/luci-proto-yggdrasil/root/usr/share/rpcd/acl.d/luci-proto-yggdrasil.json b/protocols/luci-proto-yggdrasil/root/usr/share/rpcd/acl.d/luci-proto-yggdrasil.json new file mode 100644 index 0000000000..0351d8610d --- /dev/null +++ b/protocols/luci-proto-yggdrasil/root/usr/share/rpcd/acl.d/luci-proto-yggdrasil.json @@ -0,0 +1,10 @@ +{ + "luci-proto-yggdrasil": { + "description": "Grant access to LuCI Yggdrasil procedures", + "write": { + "ubus": { + "luci.yggdrasil": [ "generateKeyPair", "getPeers" ] + } + } + } +} |