luci-app-mentohust: update
This commit is contained in:
parent
7b60890708
commit
a81a7e6949
53
package/ctcgfw/luci-app-mentohust/Makefile
Normal file
53
package/ctcgfw/luci-app-mentohust/Makefile
Normal file
@ -0,0 +1,53 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-mentohust
|
||||
PKG_VERSION=1.1.1
|
||||
PKG_RELEASE:=0
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/luci-app-mentohust
|
||||
SECTION:=luci
|
||||
CATEGORY:=LuCI
|
||||
SUBMENU:=3. Applications
|
||||
TITLE:=MentoHUST 802.1X Client for LuCI
|
||||
PKGARCH:=all
|
||||
DEPENDS:=+mentohust
|
||||
endef
|
||||
|
||||
define Package/luci-app-mentohust/description
|
||||
This package contains LuCI configuration pages for 8021xclient.
|
||||
endef
|
||||
|
||||
define Package/luci-app-mentohust/conffiles
|
||||
/etc/config/mentohust
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
$(foreach po,$(wildcard ${CURDIR}/files/luci/i18n/*.po), \
|
||||
po2lmo $(po) $(PKG_BUILD_DIR)/$(patsubst %.po,%.lmo,$(notdir $(po)));)
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/luci-app-mentohust/install
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/mentohust
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/mentohust.*.lmo $(1)/usr/lib/lua/luci/i18n/
|
||||
$(INSTALL_CONF) ./files/root/etc/config/mentohust $(1)/etc/config/mentohust
|
||||
$(INSTALL_BIN) ./files/root/etc/init.d/mentohust $(1)/etc/init.d/mentohust
|
||||
$(INSTALL_DATA) ./files/luci/model/cbi/mentohust/general.lua $(1)/usr/lib/lua/luci/model/cbi/mentohust/general.lua
|
||||
$(INSTALL_DATA) ./files/luci/model/cbi/mentohust/log.lua $(1)/usr/lib/lua/luci/model/cbi/mentohust/log.lua
|
||||
$(INSTALL_DATA) ./files/luci/controller/mentohust.lua $(1)/usr/lib/lua/luci/controller/mentohust.lua
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,luci-app-mentohust))
|
||||
@ -0,0 +1,16 @@
|
||||
module("luci.controller.mentohust", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/mentohust") then
|
||||
return
|
||||
end
|
||||
if luci.sys.call("command -v mentohust >/dev/null") ~= 0 then
|
||||
return
|
||||
end
|
||||
entry({"admin", "services", "mentohust"},
|
||||
alias("admin", "services", "mentohust", "general"),
|
||||
_("MentoHUST"), 10).dependent = true
|
||||
|
||||
entry({"admin", "services", "mentohust", "general"}, cbi("mentohust/general"), _("MentoHUST Settings"), 10).leaf = true
|
||||
entry({"admin", "services", "mentohust", "log"}, cbi("mentohust/log"), _("MentoHUST LOG"), 20).leaf = true
|
||||
end
|
||||
@ -0,0 +1,152 @@
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=UTF-8\n"
|
||||
|
||||
msgid "MentoHUST Settings"
|
||||
msgstr "MentoHUST 设置"
|
||||
|
||||
msgid "MentoHUST LOG"
|
||||
msgstr "MentoHUST 日志"
|
||||
|
||||
msgid "Log file:/tmp/mentohust.log"
|
||||
msgstr "日志文件:/tmp/mentohust.log"
|
||||
|
||||
msgid "Configure MentoHUST 802.11x."
|
||||
msgstr "配置MentoHUST 802.11x验证。"
|
||||
|
||||
msgid "Normal Settings"
|
||||
msgstr "常规设置"
|
||||
|
||||
msgid "The username given to you by your network administrator"
|
||||
msgstr "您的用户名(或管理员分配的用户名)"
|
||||
|
||||
msgid "The password you set or given to you by your network administrator"
|
||||
msgstr "您的密码(或管理员分配的密码)"
|
||||
|
||||
msgid "Physical interface of WAN"
|
||||
msgstr "WAN口的物理接口"
|
||||
|
||||
msgid "PingHost"
|
||||
msgstr "Ping主机"
|
||||
|
||||
msgid "Ping host for drop detection, 0.0.0.0 to turn off this feature"
|
||||
msgstr "Ping主机,用于掉线检测,0.0.0.0表示关闭该功能"
|
||||
|
||||
msgid "IP Address"
|
||||
msgstr "IP地址"
|
||||
|
||||
msgid "Your IPv4 Address. (DHCP users can set to 0.0.0.0)"
|
||||
msgstr "你的IPV4地址,DHCP用户可设为0.0.0.0"
|
||||
|
||||
msgid "NetMask"
|
||||
msgstr "子网掩码"
|
||||
|
||||
msgid "NetMask, it doesn't matter"
|
||||
msgstr "掩码,无关紧要"
|
||||
|
||||
msgid "Gateway, if specified, will monitor gateway ARP information"
|
||||
msgstr "网关,如果指定了就会监视网关ARP信息"
|
||||
|
||||
msgid "DNS server"
|
||||
msgstr "DNS服务器"
|
||||
|
||||
msgid "DNS server, it doesn't matter"
|
||||
msgstr "DNS服务器,无关紧要"
|
||||
|
||||
msgid "Timeout"
|
||||
msgstr "验证超时"
|
||||
|
||||
msgid "Each timeout of the package (seconds)"
|
||||
msgstr "每次发包超时时间(秒)"
|
||||
|
||||
msgid "EchoInterval"
|
||||
msgstr "Echo包间隔"
|
||||
|
||||
msgid "Interval for sending Echo packets (seconds)"
|
||||
msgstr "发送Echo包的间隔(秒)"
|
||||
|
||||
msgid "RestartWait"
|
||||
msgstr "验证失败等待时间"
|
||||
|
||||
msgid "Failed Wait (seconds) Wait for seconds after authentication failed or restart authentication after server request"
|
||||
msgstr "失败等待(秒)认证失败后等待多少秒或者服务器请求后重启认证"
|
||||
|
||||
msgid "StartMode"
|
||||
msgstr "组播地址类型"
|
||||
|
||||
msgid "Multicast address type when searching for servers"
|
||||
msgstr "寻找服务器时的组播地址类型(某些交换机可能会丢弃标准包)"
|
||||
|
||||
msgid "Standard"
|
||||
msgstr "标准"
|
||||
|
||||
msgid "Ruijie"
|
||||
msgstr "锐捷"
|
||||
|
||||
msgid "Uses MentoHUST for Xaar certification"
|
||||
msgstr "将MentoHUST用于赛尔认证"
|
||||
|
||||
msgid "DhcpMode"
|
||||
msgstr "DHCP设置"
|
||||
|
||||
msgid "DHCP method"
|
||||
msgstr "DHCP方式"
|
||||
|
||||
msgid "None"
|
||||
msgstr "无"
|
||||
|
||||
msgid "secondary authentication"
|
||||
msgstr "二次认证"
|
||||
|
||||
msgid "after certification"
|
||||
msgstr "认证后"
|
||||
|
||||
msgid "before certification"
|
||||
msgstr "认证前"
|
||||
|
||||
msgid "ShowNotify"
|
||||
msgstr "通知级别"
|
||||
|
||||
msgid "Whether to display notifications 0 (no) 1 to 20 (yes)"
|
||||
msgstr "是否显示通知: 0(否) 1~20(是)"
|
||||
|
||||
msgid "Client Version"
|
||||
msgstr "客户端版本号"
|
||||
|
||||
msgid "Client version number. If client verification is not enabled but the version number is required, it can be specified here. The format is 3.30."
|
||||
msgstr "客户端版本号,如果未开启客户端校验但对版本号有要求,可以在此指定,形如3.30"
|
||||
|
||||
msgid "DataFile"
|
||||
msgstr "数据文件"
|
||||
|
||||
msgid "Authentication data file, if you need to verify the client, you need to set correctly"
|
||||
msgstr "认证数据文件,如果需要校验客户端,就需要正确设置"
|
||||
|
||||
msgid "DhcpScript"
|
||||
msgstr "DHCP的脚本"
|
||||
|
||||
msgid "DHCP script"
|
||||
msgstr "进行DHCP的脚本"
|
||||
|
||||
msgid "RUNNING"
|
||||
msgstr "运行中"
|
||||
|
||||
msgid "NOT RUNNING"
|
||||
msgstr "未运行"
|
||||
|
||||
msgid "ONLINE"
|
||||
msgstr "能访问互联网"
|
||||
|
||||
msgid "NOT ONLINE"
|
||||
msgstr "不能访问互联网"
|
||||
|
||||
msgid "Settings"
|
||||
msgstr "设置"
|
||||
|
||||
msgid "Network Status"
|
||||
msgstr "网络状态"
|
||||
|
||||
msgid "Pinghost not set"
|
||||
msgstr "没有设置Ping主机"
|
||||
|
||||
msgid "Clear log"
|
||||
msgstr "清除日志"
|
||||
@ -0,0 +1,111 @@
|
||||
local function is_running(name)
|
||||
if luci.sys.call("pidof %s >/dev/null" %{name}) == 0 then
|
||||
return translate("RUNNING")
|
||||
else
|
||||
return translate("NOT RUNNING")
|
||||
end
|
||||
end
|
||||
|
||||
local function is_online(ipaddr)
|
||||
if ipaddr == "0.0.0.0" then
|
||||
return translate("Pinghost not set")
|
||||
end
|
||||
if luci.sys.call("ping -c1 -w1 %s >/dev/null 2>&1" %{ipaddr}) == 0 then
|
||||
return translate("ONLINE")
|
||||
else
|
||||
return translate("NOT ONLINE")
|
||||
end
|
||||
end
|
||||
|
||||
require("luci.sys")
|
||||
|
||||
m = Map("mentohust", translate("MentoHUST"), translate("Configure MentoHUST 802.11x."))
|
||||
|
||||
s = m:section(TypedSection, "mentohust", translate("Status"))
|
||||
s.anonymous = true
|
||||
status = s:option(DummyValue,"_mentohust_status", "MentoHUST")
|
||||
status.value = "<span id=\"_mentohust_status\">%s</span>" %{is_running("mentohust")}
|
||||
status.rawhtml = true
|
||||
t = io.popen('uci get mentohust.@mentohust[0].pinghost')
|
||||
netstat=is_online(tostring(t:read("*line")))
|
||||
t:close()
|
||||
if netstat ~= "" then
|
||||
netstatus = s:option(DummyValue,"_network_status", translate("Network Status"))
|
||||
netstatus.value = "<span id=\"_network_status\">%s</span>" %{netstat}
|
||||
netstatus.rawhtml = true
|
||||
end
|
||||
|
||||
o = m:section(TypedSection, "mentohust", translate("Settings"))
|
||||
o.addremove = false
|
||||
o.anonymous = true
|
||||
|
||||
o:tab("base", translate("Normal Settings"))
|
||||
o:tab("advanced", translate("Advanced Settings"))
|
||||
|
||||
enable = o:taboption("base", Flag, "enable", translate("Enable"))
|
||||
name = o:taboption("base", Value, "username", translate("Username"),translate("The username given to you by your network administrator"))
|
||||
pass = o:taboption("base", Value, "password", translate("Password"), translate("The password you set or given to you by your network administrator"))
|
||||
pass.password = true
|
||||
|
||||
ifname = o:taboption("base", ListValue, "ifname", translate("Interfaces"), translate("Physical interface of WAN"))
|
||||
for k, v in ipairs(luci.sys.net.devices()) do
|
||||
if v ~= "lo" then
|
||||
ifname:value(v)
|
||||
end
|
||||
end
|
||||
|
||||
pinghost = o:taboption("base", Value, "pinghost", translate("PingHost"), translate("Ping host for drop detection, 0.0.0.0 to turn off this feature"))
|
||||
pinghost.default = "0.0.0.0"
|
||||
|
||||
ipaddr = o:taboption("advanced", Value, "ipaddr", translate("IP Address"), translate("Your IPv4 Address. (DHCP users can set to 0.0.0.0)"))
|
||||
ipaddr.default = "0.0.0.0"
|
||||
|
||||
mask = o:taboption("advanced", Value, "mask", translate("NetMask"), translate("NetMask, it doesn't matter"))
|
||||
mask.default = "0.0.0.0"
|
||||
|
||||
gateway = o:taboption("advanced", Value, "gateway", translate("Gateway"), translate("Gateway, if specified, will monitor gateway ARP information"))
|
||||
gateway.default = "0.0.0.0"
|
||||
|
||||
dnsserver = o:taboption("advanced", Value, "dns", translate("DNS server"), translate("DNS server, it doesn't matter"))
|
||||
dnsserver.default = "0.0.0.0"
|
||||
|
||||
timeout = o:taboption("advanced", Value, "timeout", translate("Timeout"), translate("Each timeout of the package (seconds)"))
|
||||
timeout.default = "8"
|
||||
|
||||
echointerval = o:taboption("advanced", Value, "echointerval", translate("EchoInterval"), translate("Interval for sending Echo packets (seconds)"))
|
||||
echointerval.default = "30"
|
||||
|
||||
restartwait = o:taboption("advanced", Value, "restartwait", translate("RestartWait"), translate("Failed Wait (seconds) Wait for seconds after authentication failed or restart authentication after server request"))
|
||||
restartwait.default = "15"
|
||||
|
||||
startmode = o:taboption("advanced", ListValue, "startmode", translate("StartMode"), translate("Multicast address type when searching for servers"))
|
||||
startmode:value(0, translate("Standard"))
|
||||
startmode:value(1, translate("Ruijie"))
|
||||
startmode:value(2, translate("Uses MentoHUST for Xaar certification"))
|
||||
startmode.default = "0"
|
||||
|
||||
dhcpmode = o:taboption("advanced", ListValue, "dhcpmode", translate("DhcpMode"), translate("DHCP method"))
|
||||
dhcpmode:value(0, translate("None"))
|
||||
dhcpmode:value(1, translate("secondary authentication"))
|
||||
dhcpmode:value(2, translate("after certification"))
|
||||
dhcpmode:value(3, translate("before certification"))
|
||||
dhcpmode.default = "2"
|
||||
|
||||
shownotify = o:taboption("advanced", Value, "shownotify", translate("ShowNotify"), translate("Whether to display notifications 0 (no) 1 to 20 (yes)"))
|
||||
shownotify.default = "5"
|
||||
|
||||
version = o:taboption("advanced", Value, "version", translate("Client Version"), translate("Client version number. If client verification is not enabled but the version number is required, it can be specified here. The format is 3.30."))
|
||||
version.default = "0.00"
|
||||
|
||||
datafile = o:taboption("advanced", Value, "datafile", translate("DataFile"), translate("Authentication data file, if you need to verify the client, you need to set correctly"))
|
||||
datafile.default = "/etc/mentohust/"
|
||||
|
||||
dhcpscript = o:taboption("advanced", Value, "dhcpscript", translate("DhcpScript"), translate("DHCP script"))
|
||||
dhcpscript.default = "udhcpc -i"
|
||||
|
||||
local apply = luci.http.formvalue("cbi.apply")
|
||||
if apply then
|
||||
io.popen("/etc/init.d/mentohust restart")
|
||||
end
|
||||
|
||||
return m
|
||||
@ -0,0 +1,23 @@
|
||||
local fs = require "nixio.fs"
|
||||
|
||||
local f = SimpleForm("mentohust",
|
||||
translate("MentoHUST LOG"),
|
||||
translate("Log file:/tmp/mentohust.log"))
|
||||
|
||||
local o = f:field(Value, "mentohust_log")
|
||||
|
||||
o.template = "cbi/tvalue"
|
||||
o.rows = 32
|
||||
|
||||
function o.cfgvalue(self, section)
|
||||
return fs.readfile("/tmp/mentohust.log")
|
||||
end
|
||||
|
||||
function o.write(self, section, value)
|
||||
require("luci.sys").call('cat /dev/null > /tmp/mentohust.log 2>/dev/null')
|
||||
end
|
||||
|
||||
f.submit = translate("Clear log")
|
||||
f.reset = false
|
||||
|
||||
return f
|
||||
@ -0,0 +1 @@
|
||||
config mentohust
|
||||
85
package/ctcgfw/luci-app-mentohust/files/root/etc/init.d/mentohust
Executable file
85
package/ctcgfw/luci-app-mentohust/files/root/etc/init.d/mentohust
Executable file
@ -0,0 +1,85 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
START=90
|
||||
|
||||
run_mentohust()
|
||||
{
|
||||
local enable
|
||||
local username
|
||||
local password
|
||||
local ifname
|
||||
local cmd
|
||||
config_get_bool enable $1 enable
|
||||
config_get username $1 username
|
||||
config_get password $1 password
|
||||
config_get ifname $1 ifname
|
||||
|
||||
if [ $enable ] && [ $username ] && [ $password ] && [ $ifname ]; then
|
||||
local pinghost
|
||||
local startmode
|
||||
local dhcpmode
|
||||
local ipaddr
|
||||
local mask
|
||||
local gateway
|
||||
local dns
|
||||
local timeout
|
||||
local echointerval
|
||||
local restartwait
|
||||
local shownotify
|
||||
local version
|
||||
local datafile
|
||||
local dhcpscript
|
||||
|
||||
config_get pinghost $1 pinghost
|
||||
config_get startmode $1 startmode
|
||||
config_get dhcpmode $1 dhcpmode
|
||||
config_get ipaddr $1 ipaddr
|
||||
config_get mask $1 mask
|
||||
config_get gateway $1 gateway
|
||||
config_get dns $1 dns
|
||||
config_get timeout $1 timeout
|
||||
config_get echointerval $1 echointerval
|
||||
config_get restartwait $1 restartwait
|
||||
config_get shownotify $1 shownotify
|
||||
config_get version $1 version
|
||||
config_get datafile $1 datafile
|
||||
config_get dhcpscript $1 dhcpscript
|
||||
|
||||
if [ "$ipaddr" != "" ]; then cmd=$cmd" -i"$ipaddr;fi
|
||||
if [ "$mask" != "" ]; then cmd=$cmd" -m"$mask;fi
|
||||
if [ "$pinghost" != "0.0.0.0" ] && [ "$pinghost" != "" ]; then cmd=$cmd" -o"$pinghost;fi
|
||||
if [ "$startmode" != "0" ] && [ "$startmode" != "" ]; then cmd=$cmd" -a"$startmode;fi
|
||||
if [ "$dhcpmode" != "0" ] && [ "$dhcpmode" != "" ]; then cmd=$cmd" -d"$dhcpmode;fi
|
||||
if [ "$gateway" != "0.0.0.0" ] && [ "$gateway" != "" ]; then cmd=$cmd" -g"$gateway;fi
|
||||
if [ "$dns" != "0.0.0.0" ] && [ "$dns" != "" ]; then cmd=$cmd" -s"$dns;fi
|
||||
if [ "$timeout" != "8" ] && [ "$timeout" != "" ]; then cmd=$cmd" -t"$timeout;fi
|
||||
if [ "$echointerval" != "30" ] && [ "$echointerval" != "" ]; then cmd=$cmd" -e"$echointerval;fi
|
||||
if [ "$restartwait" != "15" ] && [ "$restartwait" != "" ]; then cmd=$cmd" -r"$restartwait;fi
|
||||
if [ "$shownotify" != "5" ] && [ "$shownotify" != "" ]; then cmd=$cmd" -y"$shownotify;fi
|
||||
if [ "$version" != "0.00" ] && [ "$version" != "" ]; then cmd=$cmd" -v"$version;fi
|
||||
if [ "$datafile" != "/etc/mentohust/" ] && [ "$datafile" != "" ]; then cmd=$cmd" -f"$datafile;fi
|
||||
if [ "$dhcpscript" != "udhcpc -i" ] && [ "$dhcpscript" != "" ]; then cmd=$cmd" -c'"$dhcpscript"'";fi
|
||||
|
||||
/bin/ash -c "mentohust -u$username -p$password -n$ifname -b3 -w $cmd"
|
||||
else
|
||||
/bin/ash -c "mentohust -k"
|
||||
fi
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
config_load mentohust
|
||||
config_foreach run_mentohust mentohust
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
killall mentohust
|
||||
}
|
||||
|
||||
restart()
|
||||
{
|
||||
mentohust -k
|
||||
sleep 1
|
||||
config_load mentohust
|
||||
config_foreach run_mentohust mentohust
|
||||
}
|
||||
@ -1,64 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2016-2017 Jian Chang <aa65535@live.com>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-mentohust
|
||||
PKG_VERSION:=4.0.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_LICENSE:=GPLv3
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_MAINTAINER:=Chen Minqiang <ptpt52@gmail.com>
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/luci-app-mentohust
|
||||
CATEGORY:=Ptpt52
|
||||
SUBMENU:=Mentohust
|
||||
TITLE:=LuCI Support for mentohust
|
||||
PKGARCH:=all
|
||||
DEPENDS:=+mentohust
|
||||
endef
|
||||
|
||||
define Package/luci-app-mentohust/description
|
||||
LuCI Support for mentohust.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
$(foreach po,$(wildcard ${CURDIR}/files/luci/i18n/*.po), \
|
||||
po2lmo $(po) $(PKG_BUILD_DIR)/$(patsubst %.po,%.lmo,$(notdir $(po)));)
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/luci-app-mentohust/postinst
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
rm -rf /tmp/luci-indexcache /tmp/luci-modulecache
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/luci-app-mentohust/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/mentohust.*.lmo $(1)/usr/lib/lua/luci/i18n/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller
|
||||
$(INSTALL_DATA) ./files/luci/controller/*.lua $(1)/usr/lib/lua/luci/controller/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/mentohust
|
||||
$(INSTALL_DATA) ./files/luci/model/cbi/mentohust/*.lua $(1)/usr/lib/lua/luci/model/cbi/mentohust/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/view/mentohust
|
||||
$(INSTALL_DATA) ./files/luci/view/mentohust/*.htm $(1)/usr/lib/lua/luci/view/mentohust/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,luci-app-mentohust))
|
||||
@ -1,37 +0,0 @@
|
||||
--[[
|
||||
|
||||
LuCI mentohust
|
||||
Author:ptpt52
|
||||
Email:ptpt52@gmail.com
|
||||
|
||||
]]--
|
||||
|
||||
module("luci.controller.mentohust", package.seeall)
|
||||
|
||||
function index()
|
||||
|
||||
if not nixio.fs.access("/etc/config/mentohust") then
|
||||
return
|
||||
end
|
||||
local page
|
||||
page = entry({"admin", "services", "mentohust"}, cbi("mentohust/mentohust"), _("MentoHUST"), 10)
|
||||
page.i18n = "mentohust"
|
||||
page.dependent = true
|
||||
|
||||
entry({"admin", "services", "mentohust", "status"}, call("status")).leaf = true
|
||||
end
|
||||
|
||||
function status()
|
||||
local sys = require "luci.sys"
|
||||
local ipkg = require "luci.model.ipkg"
|
||||
local http = require "luci.http"
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
|
||||
local status = {
|
||||
running = (sys.call("pidof mentohust > /dev/null") == 0),
|
||||
h_mentohust = ipkg.installed("mentohust"),
|
||||
}
|
||||
|
||||
http.prepare_content("application/json")
|
||||
http.write_json(status)
|
||||
end
|
||||
@ -1,155 +0,0 @@
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=UTF-8\n"
|
||||
|
||||
msgid "MentoHUST"
|
||||
msgstr "MentoHUST"
|
||||
|
||||
msgid "A Ruijie and Cernet supplicant on Linux and MacOS"
|
||||
msgstr "Linux/MacOS 平台的锐捷认证客户端"
|
||||
|
||||
msgid "Start option"
|
||||
msgstr "启动选项"
|
||||
|
||||
msgid "Configure mentohust's start option"
|
||||
msgstr "配置mentohust的启动选项"
|
||||
|
||||
msgid "MentoHUST_enable"
|
||||
msgstr "启用MentoHUST"
|
||||
|
||||
msgid "enable or disable mentohust"
|
||||
msgstr "启用或禁用mentohust"
|
||||
|
||||
msgid "Router Proxy"
|
||||
msgstr "路由代理伪装"
|
||||
|
||||
msgid "max conntrack limits"
|
||||
msgstr "最大连接数限制"
|
||||
|
||||
msgid "0 means no limit, default to 280"
|
||||
msgstr "0表示没有限制,默认限制280"
|
||||
|
||||
msgid "router proxy to fake single client"
|
||||
msgstr "隐藏代理的多个设备避免因为代理检测断网"
|
||||
|
||||
msgid "Config mentohust"
|
||||
msgstr "配置mentohust"
|
||||
|
||||
msgid "The options below are all of mentohust's arguments."
|
||||
msgstr "下面是mentohust的配置参数"
|
||||
|
||||
msgid "Username"
|
||||
msgstr "用户名"
|
||||
|
||||
msgid "Password"
|
||||
msgstr "密码"
|
||||
|
||||
msgid "net card name"
|
||||
msgstr "网卡"
|
||||
|
||||
msgid "ServiceName"
|
||||
msgstr "服务名"
|
||||
|
||||
msgid "default to 'internet'"
|
||||
msgstr "默认是internet"
|
||||
|
||||
msgid "IP"
|
||||
msgstr "IP"
|
||||
|
||||
msgid "default to localhost's IP"
|
||||
msgstr "默认本机IP"
|
||||
|
||||
msgid "netmask"
|
||||
msgstr "子网掩码"
|
||||
|
||||
msgid "default to localhost's netmask"
|
||||
msgstr "默认本机子网掩码"
|
||||
|
||||
msgid "gateway"
|
||||
msgstr "网关地址"
|
||||
|
||||
msgid "default to 0.0.0.0"
|
||||
msgstr "默认 0.0.0.0"
|
||||
|
||||
msgid "DNS"
|
||||
msgstr "DNS"
|
||||
|
||||
msgid "Ping host"
|
||||
msgstr "Ping主机"
|
||||
|
||||
msgid "default to 0.0.0.0,i.e. disable this function"
|
||||
msgstr "默认 0.0.0.0 表示禁用此功能"
|
||||
|
||||
msgid "authenticate timeout(s)"
|
||||
msgstr "认证超时(秒)"
|
||||
|
||||
msgid "default to 8s"
|
||||
msgstr "默认8秒"
|
||||
|
||||
msgid "heartbeat timeout(s)"
|
||||
msgstr "心跳间隔(秒)"
|
||||
|
||||
msgid "default to 30s"
|
||||
msgstr "默认30秒"
|
||||
|
||||
msgid "wait on failure timeout(s)"
|
||||
msgstr "失败等待时间(秒)"
|
||||
|
||||
msgid "default to 15s"
|
||||
msgstr "默认15秒"
|
||||
|
||||
msgid "max failure times"
|
||||
msgstr "重连次数"
|
||||
|
||||
msgid "0 means no limit,default to 8"
|
||||
msgstr "0表示没有限制,默认8"
|
||||
|
||||
msgid "mulcast address"
|
||||
msgstr "组播地址"
|
||||
|
||||
msgid "default to 0"
|
||||
msgstr "默认0"
|
||||
|
||||
msgid "0(standard)"
|
||||
msgstr "0(标准)"
|
||||
|
||||
msgid "1(ruijjie)"
|
||||
msgstr "1(锐捷)"
|
||||
|
||||
msgid "2(saier)"
|
||||
msgstr "2(赛尔)"
|
||||
|
||||
msgid "DHCP type"
|
||||
msgstr "DHCP类型"
|
||||
|
||||
msgid "default to 0"
|
||||
msgstr "默认0"
|
||||
|
||||
msgid "0(not in used)"
|
||||
msgstr "0(不使用)"
|
||||
|
||||
msgid "1(secondary authenticate)"
|
||||
msgstr "1(二次认证)"
|
||||
|
||||
msgid "2(post authenticate)"
|
||||
msgstr "2(认证后)"
|
||||
|
||||
msgid "3(pre authenticate)"
|
||||
msgstr "3(认证前)"
|
||||
|
||||
msgid "client version"
|
||||
msgstr "客户端版本"
|
||||
|
||||
msgid "default to 0.00,compatible with xrgsu"
|
||||
msgstr "默认0.00,兼容xrgsu"
|
||||
|
||||
msgid "customized data file"
|
||||
msgstr "自定义数据文件"
|
||||
|
||||
msgid "not in used by default"
|
||||
msgstr "默认不使用"
|
||||
|
||||
msgid "DHCP script"
|
||||
msgstr "DHCP脚本"
|
||||
|
||||
msgid "use dhclient by default"
|
||||
msgstr "默认使用dhclient"
|
||||
@ -1,75 +0,0 @@
|
||||
--[[
|
||||
|
||||
LuCI mentohust
|
||||
Author:ptpt52
|
||||
Email:ptpt52@gmail.com
|
||||
|
||||
]]--
|
||||
|
||||
require("luci.tools.webadmin")
|
||||
|
||||
m = Map("mentohust", translate("MentoHUST"), translate("A Ruijie and Cernet supplicant on Linux and MacOS"))
|
||||
|
||||
m:section(SimpleSection).template = "mentohust/mentohust"
|
||||
|
||||
s = m:section(TypedSection, "option", translate("Start option"),translate("Configure mentohust's start option"))
|
||||
s.anonymous = true
|
||||
s:option(Flag, "enable", translate("MentoHUST_enable"), translate("enable or disable mentohust")).default="0"
|
||||
s:option(Flag, "rproxy", translate("Router Proxy"), translate("router proxy to fake single client")).default="0"
|
||||
s:option(Value, "nf_limit", translate("max conntrack limits"),translate("0 means no limit, default to 280")).default="280"
|
||||
|
||||
s = m:section(TypedSection, "mentohust", translate("Config mentohust"),translate("The options below are all of mentohust's arguments."))
|
||||
s.anonymous = true
|
||||
s:option(Value, "Username", translate("Username")).default="yourusername"
|
||||
|
||||
pw=s:option(Value, "Password", translate("Password"))
|
||||
pw.password = true
|
||||
pw.rmempty = false
|
||||
pw.default= "yourpassword"
|
||||
|
||||
nic=s:option(ListValue, "Nic", translate("net card name"))
|
||||
nic.anonymous = true
|
||||
for k, v in pairs(luci.sys.net.devices()) do
|
||||
nic:value(v)
|
||||
end
|
||||
|
||||
s:option(Value, "ServiceName", translate("ServiceName"),translate("default to 'internet'")).default="internet"
|
||||
|
||||
s:option(Value, "IP", translate("IP"),translate("default to localhost's IP")).default="0.0.0.0"
|
||||
|
||||
s:option(Value, "Mask", translate("netmask"),translate("default to localhost's netmask")).default="255.255.255.0"
|
||||
|
||||
s:option(Value, "Gateway", translate("gateway"),translate("default to 0.0.0.0")).default="0.0.0.0"
|
||||
|
||||
s:option(Value, "DNS", translate("DNS"),translate("default to 0.0.0.0")).default="0.0.0.0"
|
||||
|
||||
s:option(Value, "PingHost", translate("Ping host"),translate("default to 0.0.0.0,i.e. disable this function")).default="0.0.0.0"
|
||||
|
||||
s:option(Value, "Timeout", translate("authenticate timeout(s)"),translate("default to 8s")).default="8"
|
||||
|
||||
s:option(Value, "EchoInterval", translate("heartbeat timeout(s)"),translate("default to 30s")).default="30"
|
||||
|
||||
s:option(Value, "RestartWait", translate("wait on failure timeout(s)"),translate("default to 15s")).default="15"
|
||||
|
||||
s:option(Value, "MaxFail", translate("max failure times"),translate("0 means no limit,default to 8")).default="8"
|
||||
|
||||
t=s:option(ListValue, "StartMode", translate("mulcast address"),translate("default to 0"))
|
||||
t:value("0", translate("0(standard)"))
|
||||
t:value("1", translate("1(ruijjie)"))
|
||||
t:value("2", translate("2(saier)"))
|
||||
t.default = "0"
|
||||
|
||||
t= s:option(ListValue, "DhcpMode", translate("DHCP type"),translate("default to 0"))
|
||||
t:value("0", translate("0(not in used)"))
|
||||
t:value("1", translate("1(secondary authenticate)"))
|
||||
t:value("2", translate("2(post authenticate)"))
|
||||
t:value("3", translate("3(pre authenticate)"))
|
||||
t.default = "0"
|
||||
|
||||
s:option(Value, "Version", translate("client version"),translate("default to 0.00,compatible with xrgsu")).default="0.00"
|
||||
|
||||
s:option(Value, "DataFile", translate("customized data file"),translate("not in used by default")).default="/etc/mentohust"
|
||||
|
||||
s:option(Value, "DhcpScript", translate("DHCP script"),translate("use dhclient by default")).default="udhcpc -i"
|
||||
|
||||
return m
|
||||
@ -1,24 +0,0 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(5, '<%=luci.dispatcher.build_url("admin/services/mentohust/status")%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('mentohust_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<em><%:The Mentohust service is running.%></em>';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
var links = '<em><%:The Mentohust service is not running.%></em>';
|
||||
tb.innerHTML = links;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 10px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Mentohust Status%></legend>
|
||||
<p id="mentohust_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
||||
Loading…
Reference in New Issue
Block a user