mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-07-16 02:36:58 +08:00
luci-app-ssr-plus: add sock5 server username/password auth method
This commit is contained in:
parent
0f352ab567
commit
852bc51e93
@ -1,8 +1,8 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=luci-app-ssr-plus
|
PKG_NAME:=luci-app-ssr-plus
|
||||||
PKG_VERSION:=157
|
PKG_VERSION:=158
|
||||||
PKG_RELEASE:=2
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||||
|
|
||||||
@ -36,10 +36,6 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun
|
|||||||
config PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server
|
config PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server
|
||||||
bool "Include ShadowsocksR Server"
|
bool "Include ShadowsocksR Server"
|
||||||
default y if x86_64
|
default y if x86_64
|
||||||
|
|
||||||
config PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Socks
|
|
||||||
bool "Include Socks Sever"
|
|
||||||
default y if x86_64
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/$(PKG_NAME)
|
define Package/$(PKG_NAME)
|
||||||
@ -48,15 +44,14 @@ define Package/$(PKG_NAME)
|
|||||||
SUBMENU:=3. Applications
|
SUBMENU:=3. Applications
|
||||||
TITLE:=SS/SSR/V2Ray/Trojan LuCI interface
|
TITLE:=SS/SSR/V2Ray/Trojan LuCI interface
|
||||||
PKGARCH:=all
|
PKGARCH:=all
|
||||||
DEPENDS:=+shadowsocksr-libev-alt +ipset +ip-full +iptables-mod-tproxy +dnsmasq-full +coreutils +coreutils-base64 +pdnsd-alt +wget +lua +ipt2socks \
|
DEPENDS:=+shadowsocksr-libev-alt +ipset +ip-full +iptables-mod-tproxy +dnsmasq-full +coreutils +coreutils-base64 +pdnsd-alt +wget +lua +ipt2socks +microsocks \
|
||||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks:shadowsocks-libev-ss-redir \
|
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks:shadowsocks-libev-ss-redir \
|
||||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Simple_obfs:simple-obfs \
|
+PACKAGE_$(PKG_NAME)_INCLUDE_Simple_obfs:simple-obfs \
|
||||||
+PACKAGE_$(PKG_NAME)_INCLUDE_V2ray_plugin:v2ray-plugin \
|
+PACKAGE_$(PKG_NAME)_INCLUDE_V2ray_plugin:v2ray-plugin \
|
||||||
+PACKAGE_$(PKG_NAME)_INCLUDE_V2ray:v2ray \
|
+PACKAGE_$(PKG_NAME)_INCLUDE_V2ray:v2ray \
|
||||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:trojan \
|
+PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:trojan \
|
||||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun:kcptun-client \
|
+PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun:kcptun-client \
|
||||||
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server:shadowsocksr-libev-server \
|
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server:shadowsocksr-libev-server
|
||||||
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Socks:srelay
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Build/Prepare
|
define Build/Prepare
|
||||||
|
@ -1,22 +1,5 @@
|
|||||||
local shadowsocksr = "shadowsocksr"
|
|
||||||
local uci = luci.model.uci.cursor()
|
|
||||||
local server_table = {}
|
|
||||||
|
|
||||||
uci:foreach(shadowsocksr, "servers", function(s)
|
m = Map("shadowsocksr")
|
||||||
if s.alias then
|
|
||||||
server_table[s[".name"]] = "[%s]:%s" %{string.upper(s.type), s.alias}
|
|
||||||
elseif s.server and s.server_port then
|
|
||||||
server_table[s[".name"]] = "[%s]:%s:%s" %{string.upper(s.type), s.server, s.server_port}
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
local key_table = {}
|
|
||||||
for key,_ in pairs(server_table) do
|
|
||||||
table.insert(key_table,key)
|
|
||||||
end
|
|
||||||
|
|
||||||
table.sort(key_table)
|
|
||||||
m = Map(shadowsocksr)
|
|
||||||
-- [[ global ]]--
|
-- [[ global ]]--
|
||||||
s = m:section(TypedSection, "global", translate("Server failsafe auto swith settings"))
|
s = m:section(TypedSection, "global", translate("Server failsafe auto swith settings"))
|
||||||
s.anonymous = true
|
s.anonymous = true
|
||||||
@ -65,11 +48,11 @@ o = s:option(Value, "chnroute_url", translate("Update url"))
|
|||||||
o.default = "https://cdn.jsdelivr.net/gh/17mon/china_ip_list/china_ip_list.txt"
|
o.default = "https://cdn.jsdelivr.net/gh/17mon/china_ip_list/china_ip_list.txt"
|
||||||
|
|
||||||
-- [[ SOCKS Proxy ]]--
|
-- [[ SOCKS Proxy ]]--
|
||||||
if nixio.fs.access("/usr/bin/srelay") then
|
if nixio.fs.access("/usr/bin/microsocks") then
|
||||||
s = m:section(TypedSection, "socks5_proxy", translate("SOCKS Proxy"))
|
s = m:section(TypedSection, "socks5_proxy", translate("SOCKS5 Proxy Server Settings"))
|
||||||
s.anonymous = true
|
s.anonymous = true
|
||||||
|
|
||||||
o = s:option(Flag, "socks", translate("Enable SOCKS Proxy"))
|
o = s:option(Flag, "socks", translate("Enable SOCKS5 Proxy Server"))
|
||||||
o.rmempty = false
|
o.rmempty = false
|
||||||
|
|
||||||
o = s:option(Value, "local_port", translate("Local Port"))
|
o = s:option(Value, "local_port", translate("Local Port"))
|
||||||
@ -77,5 +60,18 @@ o.datatype = "port"
|
|||||||
o.default = 1080
|
o.default = 1080
|
||||||
o.rmempty = false
|
o.rmempty = false
|
||||||
|
|
||||||
|
o = s:option(Flag, "auth_enable", translate("Enable Authentication"))
|
||||||
|
o.rmempty = false
|
||||||
|
o.default = "0"
|
||||||
|
|
||||||
|
o = s:option(Value, "username", translate("Username"))
|
||||||
|
o.rmempty = false
|
||||||
|
o:depends("auth_enable", "1")
|
||||||
|
|
||||||
|
o = s:option(Value, "password", translate("Password"))
|
||||||
|
o.password = true
|
||||||
|
o.rmempty = false
|
||||||
|
o:depends("auth_enable", "1")
|
||||||
|
|
||||||
end
|
end
|
||||||
return m
|
return m
|
||||||
|
@ -65,7 +65,7 @@ if luci.sys.call("busybox ps -w | grep ssr-retcp | grep -v grep >/dev/null") ==
|
|||||||
redir_run=1
|
redir_run=1
|
||||||
end
|
end
|
||||||
|
|
||||||
if luci.sys.call("pidof srelay >/dev/null") == 0 then
|
if luci.sys.call("pidof microsocks >/dev/null") == 0 then
|
||||||
sock5_run=1
|
sock5_run=1
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -113,8 +113,8 @@ else
|
|||||||
s.value = translate("Not Running")
|
s.value = translate("Not Running")
|
||||||
end
|
end
|
||||||
|
|
||||||
if nixio.fs.access("/usr/bin/srelay") then
|
if nixio.fs.access("/usr/bin/microsocks") then
|
||||||
s=m:field(DummyValue,"sock5_run",translate("SOCKS Proxy"))
|
s=m:field(DummyValue,"sock5_run",translate("SOCKS5 Proxy Server"))
|
||||||
s.rawhtml = true
|
s.rawhtml = true
|
||||||
if sock5_run == 1 then
|
if sock5_run == 1 then
|
||||||
s.value =font_blue .. bold_on .. translate("Running") .. bold_off .. font_off
|
s.value =font_blue .. bold_on .. translate("Running") .. bold_off .. font_off
|
||||||
|
@ -14,7 +14,7 @@ local dsp = require "luci.dispatcher"
|
|||||||
const dom = doms[index];
|
const dom = doms[index];
|
||||||
const port = ports[index];
|
const port = ports[index];
|
||||||
if (!dom) res()
|
if (!dom) res()
|
||||||
port.innerHTML = '<font color="#0072c3">connecting...</font>';
|
port.innerHTML = '<font color="#0072c3">connect</font>';
|
||||||
|
|
||||||
XHR.get('<%=dsp.build_url("admin/services/shadowsocksr/ping")%>', {
|
XHR.get('<%=dsp.build_url("admin/services/shadowsocksr/ping")%>', {
|
||||||
index,
|
index,
|
||||||
|
@ -422,7 +422,7 @@ msgid "Auto Update Server subscription, GFW list and CHN route"
|
|||||||
msgstr "自动更新服务器订阅、GFW列表和 CHN路由表"
|
msgstr "自动更新服务器订阅、GFW列表和 CHN路由表"
|
||||||
|
|
||||||
msgid "Subscribe URL"
|
msgid "Subscribe URL"
|
||||||
msgstr "SS/SSR/V2RAY/Trojan订阅URL地址"
|
msgstr "SS/SSR/V2/TROJAN订阅URL"
|
||||||
|
|
||||||
msgid "Update"
|
msgid "Update"
|
||||||
msgstr "更新"
|
msgstr "更新"
|
||||||
@ -603,3 +603,15 @@ msgstr "订阅新节点自动切换设置"
|
|||||||
|
|
||||||
msgid "Subscribe new add server default Auto-Switch on"
|
msgid "Subscribe new add server default Auto-Switch on"
|
||||||
msgstr "订阅加入的新节点默认开启自动切换"
|
msgstr "订阅加入的新节点默认开启自动切换"
|
||||||
|
|
||||||
|
msgid "SOCKS5 Proxy Server Settings"
|
||||||
|
msgstr "SOCKS5 代理服务端设置"
|
||||||
|
|
||||||
|
msgid "Enable SOCKS5 Proxy Server"
|
||||||
|
msgstr "启用 SOCKS5 代理服务"
|
||||||
|
|
||||||
|
msgid "Enable Authentication"
|
||||||
|
msgstr "启用 用户名/密码 认证"
|
||||||
|
|
||||||
|
msgid "SOCKS5 Proxy Server"
|
||||||
|
msgstr "SOCKS5 代理服务端"
|
||||||
|
@ -452,10 +452,12 @@ start_server() {
|
|||||||
start_local() {
|
start_local() {
|
||||||
local local_server=$(uci_get_by_type socks5_proxy socks 0)
|
local local_server=$(uci_get_by_type socks5_proxy socks 0)
|
||||||
[ "$local_server" == "0" ] && return 0
|
[ "$local_server" == "0" ] && return 0
|
||||||
mkdir -p /var/run /var/etc
|
local auth_enable=$(uci_get_by_type socks5_proxy auth_enable 0)
|
||||||
echo '0.0.0.0 any' >/var/etc/srelay.conf
|
if [ "$auth_enable" == "1" ]; then
|
||||||
/usr/bin/srelay -q -c /var/etc/srelay.conf \
|
microsocks -i 0.0.0.0 -p $(uci_get_by_type socks5_proxy local_port 1080) -1 -u $(uci_get_by_type socks5_proxy username) -P $(uci_get_by_type socks5_proxy password) >/dev/null 2>&1 &
|
||||||
-i:$(uci_get_by_type socks5_proxy local_port 1080) >/dev/null 2>&1
|
else
|
||||||
|
microsocks -i 0.0.0.0 -p $(uci_get_by_type socks5_proxy local_port 1080) >/dev/null 2>&1 &
|
||||||
|
fi
|
||||||
local_enable=1
|
local_enable=1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -538,6 +540,7 @@ stop() {
|
|||||||
killall -q -9 ssr-server
|
killall -q -9 ssr-server
|
||||||
killall -q -9 kcptun-client
|
killall -q -9 kcptun-client
|
||||||
killall -q -9 srelay
|
killall -q -9 srelay
|
||||||
|
killall -q -9 microsocks
|
||||||
if [ -f /var/run/pdnsd.pid ]; then
|
if [ -f /var/run/pdnsd.pid ]; then
|
||||||
kill $(cat /var/run/pdnsd.pid) >/dev/null 2>&1
|
kill $(cat /var/run/pdnsd.pid) >/dev/null 2>&1
|
||||||
else
|
else
|
||||||
|
@ -40,8 +40,6 @@ password=$(uci_get_by_name $GLOBAL_SERVER kcp_password)
|
|||||||
kcp_param=$(uci_get_by_name $GLOBAL_SERVER kcp_param)
|
kcp_param=$(uci_get_by_name $GLOBAL_SERVER kcp_param)
|
||||||
[ "$password" != "" ] && password="--key "${password}
|
[ "$password" != "" ] && password="--key "${password}
|
||||||
|
|
||||||
sock5_port=$(uci_get_by_type socks5_proxy local_port 1080)
|
|
||||||
|
|
||||||
if echo "$server" | grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" >/dev/null; then
|
if echo "$server" | grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" >/dev/null; then
|
||||||
server=${server}
|
server=${server}
|
||||||
else
|
else
|
||||||
@ -97,13 +95,18 @@ while [ "1" == "1" ]; do #死循环
|
|||||||
(/usr/bin/kcptun-client -r $server:$kcp_port -l :$server_port $password $kcp_param &)
|
(/usr/bin/kcptun-client -r $server:$kcp_port -l :$server_port $password $kcp_param &)
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
#srelay
|
#microsocks
|
||||||
if [ "$local_process" -gt 0 ]; then
|
if [ "$local_process" -gt 0 ]; then
|
||||||
icount=$(busybox ps -w | grep srelay | grep -v grep | wc -l)
|
icount=$(busybox ps -w | grep microsocks | grep -v grep | wc -l)
|
||||||
if [ "$icount" -lt "$local_process" ]; then #如果进程挂掉就重启它
|
if [ "$icount" -lt "$local_process" ]; then #如果进程挂掉就重启它
|
||||||
logger -t "$NAME" "srelay error.restart!"
|
logger -t "$NAME" "microsocks error.restart!"
|
||||||
killall -q -9 srelay
|
killall -q -9 microsocks
|
||||||
(/usr/bin/srelay -q -c /etc/srelay.conf -i:$sock5_port -p /var/run/srelay.pid >/dev/null 2>&1)
|
local auth_enable=$(uci_get_by_type socks5_proxy auth_enable 0)
|
||||||
|
if [ "$auth_enable" == "1" ]; then
|
||||||
|
microsocks -i 0.0.0.0 -p $(uci_get_by_type socks5_proxy local_port 1080) -1 -u $(uci_get_by_type socks5_proxy username) -P $(uci_get_by_type socks5_proxy password) >/dev/null 2>&1 &
|
||||||
|
else
|
||||||
|
microsocks -i 0.0.0.0 -p $(uci_get_by_type socks5_proxy local_port 1080) >/dev/null 2>&1 &
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
#pdnsd
|
#pdnsd
|
||||||
|
38
package/lean/microsocks/Makefile
Normal file
38
package/lean/microsocks/Makefile
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=microsocks
|
||||||
|
PKG_VERSION=1.0
|
||||||
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
|
PKG_MAINTAINER:=lean
|
||||||
|
PKG_LICENSE:=MIT
|
||||||
|
PKG_LICENSE_FILES:=LICENSE
|
||||||
|
|
||||||
|
PKG_SOURCE_PROTO:=git
|
||||||
|
PKG_SOURCE_URL:=https://github.com/rofl0r/microsocks.git
|
||||||
|
PKG_SOURCE_VERSION:=be545814aeca1158ae38e2d6c66b1197679dab63
|
||||||
|
|
||||||
|
PKG_SOURCE_SUBDIR:=$(PKG_NAME)
|
||||||
|
PKG_SOURCE:=$(PKG_NAME).$(PKG_VERSION).$(PKG_RELEASE).tar.gz
|
||||||
|
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
|
||||||
|
PKG_BUILD_PARALLEL:=1
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
define Package/microsocks
|
||||||
|
SECTION:=net
|
||||||
|
CATEGORY:=Network
|
||||||
|
TITLE:=microsocks for OpenWRT
|
||||||
|
DEPENDS:=
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/microsocks/description
|
||||||
|
microsocks is a Tiny Proxy in C.
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/microsocks/install
|
||||||
|
$(INSTALL_DIR) $(1)/usr/bin
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/microsocks $(1)/usr/bin/microsocks
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call BuildPackage,microsocks))
|
Loading…
x
Reference in New Issue
Block a user