luci-app-wireguard: merge app and proto rpcd
Signed-off-by: lvoegl <lvoegl@tdt.de>
This commit is contained in:
parent
8950c9f66c
commit
d98935c45b
6 changed files with 12 additions and 30 deletions
|
@ -7,7 +7,7 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
LUCI_TITLE:=WireGuard Status
|
LUCI_TITLE:=WireGuard Status
|
||||||
LUCI_DEPENDS:=+wireguard-tools +luci-proto-wireguard
|
LUCI_DEPENDS:=+wireguard-tools
|
||||||
LUCI_PKGARCH:=all
|
LUCI_PKGARCH:=all
|
||||||
|
|
||||||
include ../../luci.mk
|
include ../../luci.mk
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
|
|
||||||
var callGetWgInstances = rpc.declare({
|
var callGetWgInstances = rpc.declare({
|
||||||
object: 'luci.wireguard_status',
|
object: 'luci.wireguard',
|
||||||
method: 'getWgInstances'
|
method: 'getWgInstances'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,14 @@ local io = require "io"
|
||||||
local uci = require "uci"
|
local uci = require "uci"
|
||||||
|
|
||||||
local methods = {
|
local methods = {
|
||||||
|
generateKeyPair = {
|
||||||
|
call = function()
|
||||||
|
local prv = sys.exec("wg genkey 2>/dev/null"):sub(1, -2)
|
||||||
|
local pub = sys.exec("echo '" .. prv .. "' | wg pubkey 2>/dev/null"):sub(1, -2)
|
||||||
|
|
||||||
|
return {keys = {priv = prv, pub = pub}}
|
||||||
|
end
|
||||||
|
},
|
||||||
getWgInstances = {
|
getWgInstances = {
|
||||||
call = function()
|
call = function()
|
||||||
local data = {}
|
local data = {}
|
|
@ -3,7 +3,7 @@
|
||||||
"description": "Grant access to LuCI app wireguard",
|
"description": "Grant access to LuCI app wireguard",
|
||||||
"read": {
|
"read": {
|
||||||
"ubus": {
|
"ubus": {
|
||||||
"luci.wireguard_status": [
|
"luci.wireguard": [
|
||||||
"getWgInstances"
|
"getWgInstances"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
LUCI_TITLE:=Support for WireGuard VPN
|
LUCI_TITLE:=Support for WireGuard VPN
|
||||||
LUCI_DEPENDS:=+wireguard-tools
|
LUCI_DEPENDS:=+wireguard-tools +luci-app-wireguard
|
||||||
LUCI_PKGARCH:=all
|
LUCI_PKGARCH:=all
|
||||||
|
|
||||||
include ../../luci.mk
|
include ../../luci.mk
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
. /usr/share/libubox/jshn.sh
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
list)
|
|
||||||
json_init
|
|
||||||
json_add_object "generateKeyPair"
|
|
||||||
json_close_object
|
|
||||||
json_dump
|
|
||||||
;;
|
|
||||||
call)
|
|
||||||
case "$2" in
|
|
||||||
generateKeyPair)
|
|
||||||
prv=$(wg genkey)
|
|
||||||
pub=$(echo $prv | wg pubkey)
|
|
||||||
json_init
|
|
||||||
json_add_object "keys"
|
|
||||||
json_add_string "priv" "$prv"
|
|
||||||
json_add_string "pub" "$pub"
|
|
||||||
json_close_object
|
|
||||||
json_dump
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
esac
|
|
Loading…
Reference in a new issue