1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-12 10:31:51 +00:00

New interface for dsvpn VPN

This commit is contained in:
Ycarus (Yannick Chabanois) 2020-12-03 11:21:43 +01:00
parent 0bf0bee341
commit 2df8bdf052
14 changed files with 81 additions and 406 deletions

View file

@ -24,7 +24,9 @@ validate_section() {
'port:port' \
'dev:string' \
'localip:host' \
'remoteip:host'
'remoteip:host' \
'mode:string:client' \
'externalip:string:auto'
}
start_instance() {
@ -39,7 +41,8 @@ start_instance() {
[ -n "${key}" ] || return 1
[ "${key}" != "secretkey" ] || return 1
[ -n "${port}" ] || return 1
[ -z "${host}" ] && host="auto"
[ -z "${port}" ] && port="auto"
[ -n "${dev}" ] || return 1
echo "${key}" > /tmp/${PROG_NAME}-${1}.key
@ -57,14 +60,15 @@ start_instance() {
procd_open_instance
procd_set_param command ${PROG} client \
procd_set_param command ${PROG} ${mode} \
/tmp/${PROG_NAME}-${1}.key \
$host \
$port \
$dev \
${localip:+$localip} \
${remoteip:+$remoteip} \
$(ip r get $host | awk '{print $3}' | tr -d "\n")
${remoteip:+$remoteip}
[ "$mode" = "client" ] && procd_append_param command $(ip r get $host | awk '{print $3}' | tr -d "\n")
[ "$mode" = "server" ] && procd_append_param command externalip
procd_set_param respawn 0 30 5

View file

@ -1,11 +1,11 @@
#
# Copyright (C) 2018-2019 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
# Copyright (C) 2018-2020 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
#
#
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI Support for DSVPN
LUCI_TITLE:=LuCI Interface to DSVPN
LUCI_DEPENDS:=+dsvpn
PKG_LICENSE:=GPLv3

View file

@ -0,0 +1,66 @@
'use strict';
'require rpc';
'require form';
'require fs';
'require uci';
'require tools.widgets as widgets';
var callHostHints;
return L.view.extend({
callHostHints: rpc.declare({
object: 'luci-rpc',
method: 'getHostHints',
expect: { '': {} }
}),
load: function() {
return this.callHostHints();
},
render: function(hosts) {
var m, s, o;
m = new form.Map('dsvpn', _('DSVPN'));
s = m.section(form.GridSection, 'dsvpn', _('Instances'));
s.addremove = true;
s.anonymous = true;
s.nodescriptions = true;
o = s.option(form.Flag, 'enable', _('Enabled'));
o.default = o.enabled;
o = s.option(form.ListValue, 'mode', _('Mode'));
o.value('client',_('Client'));
o.value('server',_('Server'));
o.modalonly = true;
o = s.option(form.Value, 'host', _('Host'));
o.rmempty = false;
o = s.option(form.Value, 'port', _('Port'));
o.rmempty = false;
o = s.option(form.Value, 'key', _('Key'));
o.rmempty = false;
o.modalonly = true;
o = s.option(form.Value, 'dev', _('Interface name'));
o.rmempty = false;
o.modalonly = true;
o = s.option(form.Value, 'localip', _('Local IP'));
o.datatype = 'or(ip4addr,ip6addr)';
o.rmempty = false;
o = s.option(form.Value, 'remoteip', _('Remote IP'));
o.datatype = 'or(ip4addr,ip6addr)';
o.rmempty = false;
o = s.option(form.Value, 'label', _('Label'));
o.rmempty = true;
return m.render();
}
});

View file

@ -1,7 +0,0 @@
module("luci.controller.dsvpn", package.seeall)
function index()
--entry({"admin", "openmptcprouter", "mlvpn"}, cbi("mlvpn"), _("DSVPN"))
--entry({"admin", "services", "dsvpn"}, cbi("dsvpn"), _("DSVPN"))
entry({"admin", "vpn", "dsvpn"}, cbi("dsvpn"), _("DSVPN"))
end

View file

@ -1,44 +0,0 @@
local net = require "luci.model.network".init()
local sys = require "luci.sys"
local ifaces = sys.net:devices()
local m, s, o
m = Map("dsvpn", translate("DSVPN"))
s = m:section(TypedSection, "dsvpn", translate("Settings"))
s.anonymous = true
s.addremove = false
o = s:option(Flag, "enable", translate("Enable"))
o.rmempty = false
o = s:option(Value, "host", translate("Remote host"))
o.placeholder = "128.128.128.128"
o.default = "128.128.128.128"
o.datatype = "host"
o.rmempty = false
o = s:option(Value, "port", translate("Remote port"))
o.placeholder = "65011"
o.default = "65011"
o.datatype = "port"
o = s:option(Value, "key", translate("Key"))
o.password = true
o.rmempty = false
o = s:option(Value, "localip", translate("Tunnel local IP"))
o.default = "10.255.251.2"
o.datatype = "host"
o = s:option(Value, "remoteip", translate("Tunnel remote IP"))
o.default = "10.255.251.1"
o.datatype = "host"
o = s:option(Value, "dev", translate("Interface name"))
o.placeholder = "tun0"
o.default = "tun0"
o.rmempty = false
return m

View file

@ -1,50 +0,0 @@
msgid ""
msgstr ""
"PO-Revision-Date: 2020-10-05 12:39+0000\n"
"Last-Translator: Weblate Admin <contact@openmptcprouter.com>\n"
"Language-Team: German <http://weblate.openmptcprouter.com/projects/omr/"
"luciapplicationsdsvpn/de/>\n"
"Language: de\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.0.4\n"
#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:4
#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:5
#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:6
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:6
msgid "DSVPN"
msgstr "DSVPN"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:12
msgid "Enable"
msgstr "Aktivieren"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:39
msgid "Interface name"
msgstr "Name der Verbindung"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:26
msgid "Key"
msgstr "Schlüssel"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:15
msgid "Remote host"
msgstr "Gegenstelle (FQDN oder IP-Adresse)"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:21
msgid "Remote port"
msgstr "Port der Gegenstelle"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:8
msgid "Settings"
msgstr "Einstellungen"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:31
msgid "Tunnel local IP"
msgstr "Lokale Tunnel-IP"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:35
msgid "Tunnel remote IP"
msgstr "Gegenstellen-Tunnel-IP"

View file

@ -1,53 +0,0 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2020-09-30 08:50+0000\n"
"Last-Translator: Anonymous <noreply@weblate.org>\n"
"Language-Team: French <http://weblate.openmptcprouter.com/projects/omr/"
"luciapplicationsdsvpn/fr/>\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.0.4\n"
#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:4
#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:5
#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:6
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:6
msgid "DSVPN"
msgstr "DSVPN"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:12
msgid "Enable"
msgstr "Activer"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:39
msgid "Interface name"
msgstr "Nom de l'interface"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:26
msgid "Key"
msgstr "Clé"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:15
msgid "Remote host"
msgstr "Nom de l'hôte distant ou adresse IP"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:21
msgid "Remote port"
msgstr "Port distant"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:8
msgid "Settings"
msgstr "Paramètres"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:31
msgid "Tunnel local IP"
msgstr "Adresse IP locale du tunnel"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:35
msgid "Tunnel remote IP"
msgstr "Adresse IP distance du tunnel"

View file

@ -1,50 +0,0 @@
msgid ""
msgstr ""
"PO-Revision-Date: 2020-09-21 12:51+0000\n"
"Last-Translator: Weblate Admin <contact@openmptcprouter.com>\n"
"Language-Team: Italian <http://weblate.openmptcprouter.com/projects/omr/"
"luciapplicationsdsvpn/it/>\n"
"Language: it\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.0.4\n"
#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:4
#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:5
#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:6
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:6
msgid "DSVPN"
msgstr "DSVPN"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:12
msgid "Enable"
msgstr "Attivare"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:39
msgid "Interface name"
msgstr "Nome interfaccia"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:26
msgid "Key"
msgstr "Key"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:15
msgid "Remote host"
msgstr "Rimuovi server"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:21
msgid "Remote port"
msgstr "Porta remota"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:8
msgid "Settings"
msgstr "Impostazioni"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:31
msgid "Tunnel local IP"
msgstr "IP locale del tunnel"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:35
msgid "Tunnel remote IP"
msgstr "IP remoto del tunnel"

View file

@ -1,50 +0,0 @@
msgid ""
msgstr ""
"PO-Revision-Date: 2020-08-18 17:37+0000\n"
"Last-Translator: Quentin PAGÈS <githubou@quentino.fr>\n"
"Language-Team: Occitan <http://weblate.openmptcprouter.com/projects/omr/"
"luciapplicationsdsvpn/oc/>\n"
"Language: oc\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.0.4\n"
#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:4
#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:5
#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:6
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:6
msgid "DSVPN"
msgstr "DSVPN"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:12
msgid "Enable"
msgstr "Activat"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:39
msgid "Interface name"
msgstr "Nom de linterfàcia"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:26
msgid "Key"
msgstr "Clau"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:15
msgid "Remote host"
msgstr "Nom de lòste distant o adreça IP"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:21
msgid "Remote port"
msgstr "Pòrt distant"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:8
msgid "Settings"
msgstr "Paramètres"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:31
msgid "Tunnel local IP"
msgstr "Adreça IP locala del tunèl"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:35
msgid "Tunnel remote IP"
msgstr "Adreça IP distanta del tunèl"

View file

@ -1,41 +0,0 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:4
#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:5
#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:6
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:6
msgid "DSVPN"
msgstr ""
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:12
msgid "Enable"
msgstr ""
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:39
msgid "Interface name"
msgstr ""
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:26
msgid "Key"
msgstr ""
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:15
msgid "Remote host"
msgstr ""
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:21
msgid "Remote port"
msgstr ""
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:8
msgid "Settings"
msgstr ""
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:31
msgid "Tunnel local IP"
msgstr ""
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:35
msgid "Tunnel remote IP"
msgstr ""

View file

@ -1,50 +0,0 @@
msgid ""
msgstr ""
"PO-Revision-Date: 2020-06-11 16:36+0000\n"
"Last-Translator: antrouter <xinyangla@188.com>\n"
"Language-Team: Chinese (Simplified) <http://weblate.openmptcprouter.com/"
"projects/omr/luciapplicationsdsvpn/zh_Hans/>\n"
"Language: zh_Hans\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 4.0.4\n"
#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:4
#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:5
#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:6
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:6
msgid "DSVPN"
msgstr "DS虚拟专网"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:12
msgid "Enable"
msgstr "开启"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:39
msgid "Interface name"
msgstr "网卡名称"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:26
msgid "Key"
msgstr "秘钥"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:15
msgid "Remote host"
msgstr "远程主机"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:21
msgid "Remote port"
msgstr "远程端口"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:8
msgid "Settings"
msgstr "设置"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:31
msgid "Tunnel local IP"
msgstr "隧道本地IP"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:35
msgid "Tunnel remote IP"
msgstr "隧道远程IP"

View file

@ -1,50 +0,0 @@
msgid ""
msgstr ""
"PO-Revision-Date: 2020-07-09 07:31+0000\n"
"Last-Translator: antrouter <xinyangla@188.com>\n"
"Language-Team: Chinese (Traditional) <http://weblate.openmptcprouter.com/"
"projects/omr/luciapplicationsdsvpn/zh_Hant/>\n"
"Language: zh_Hant\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 4.0.4\n"
#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:4
#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:5
#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:6
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:6
msgid "DSVPN"
msgstr "DS虛擬專用網"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:12
msgid "Enable"
msgstr "啟用"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:39
msgid "Interface name"
msgstr "接口名稱"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:26
msgid "Key"
msgstr "秘鑰"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:15
msgid "Remote host"
msgstr "遠程主機"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:21
msgid "Remote port"
msgstr "遠端埠"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:8
msgid "Settings"
msgstr "設定"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:31
msgid "Tunnel local IP"
msgstr "隧道本地IP"
#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:35
msgid "Tunnel remote IP"
msgstr "隧道遠程IP"

View file

@ -1,10 +1,10 @@
{
"admin/vpn/dsvpn": {
"title": "DSVPN",
"order": 10,
"order": 60,
"action": {
"type": "cbi",
"path": "dsvpn"
"type": "view",
"path": "services/dsvpn"
},
"depends": {
"acl": [ "luci-app-dsvpn" ]

View file

@ -1,6 +1,6 @@
{
"luci-app-dsvpn": {
"description": "Grant UCI access for luci-app-dsvpn",
"description": "Grant access to DSVPN",
"read": {
"uci": [ "dsvpn" ]
},