Skip to content

Commit

Permalink
v0.26.10.3
Browse files Browse the repository at this point in the history
  - 添加自定义端口范围以及自定端口的自动添加防火墙放行、允许多用户登录、允许用户注册的配置
  • Loading branch information
cdwangtao committed Aug 13, 2021
1 parent f173ec5 commit f4eaacb
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 36 deletions.
2 changes: 2 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ v0.26.10.1
- 第一个beta版本
v0.26.10.2
- 添加端口防火墙设置
v0.26.10.3
- 添加自定义端口范围以及自定端口的自动添加防火墙放行、允许多用户登录、允许用户注册的配置
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

MODULE="nps"
VERSION="v0.26.10.2"
VERSION="v0.26.10.3"
TITLE="nps"
DESCRIPTION="一款轻量级、高性能、功能强大的内网穿透代理服务器。"
HOME_URL="Module_nps.asp"
Expand Down
2 changes: 1 addition & 1 deletion config.json.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version":"v0.26.10.2",
"version":"v0.26.10.3",
"md5":"a50806415e3d615822b91518a56c26d5",
"home_url":"Module_nps.asp",
"title":"nps",
Expand Down
6 changes: 3 additions & 3 deletions nps-set.ini
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ web_key_file=conf/server.key
auth_crypt_key =1234567812345678

#allow_ports=9001-9009,10001,11000-12000
allow_ports=${nps_common_allow_ports}

#Web management multi-user login
allow_user_login=false
allow_user_register=false
allow_user_login=${nps_common_allow_user_login}
allow_user_register=${nps_common_allow_user_register}
allow_user_change_username=false


#extension
allow_flow_limit=false
allow_rate_limit=false
Expand Down
Binary file modified nps.tar.gz
Binary file not shown.
48 changes: 38 additions & 10 deletions nps/install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
!source /koolshare/scripts/base.sh
source /koolshare/scripts/base.sh
alias echo_date='echo 【$(TZ=UTC-8 date -R +%Y年%m月%d日\ %X)】:'
MODEL=
UI_TYPE=ASUSWRT
Expand Down Expand Up @@ -205,15 +205,43 @@ install_now(){
local VERSION=$(cat $DIR/version)
dbus set ${module}_version="${VERSION}"
dbus set ${module}_client_version=$(/koolshare/bin/${module} --version)
dbus set ${module}_common_cron_hour_min="hour"
dbus set ${module}_common_cron_time="12"

dbus set ${module}_common_bridge_port="85"
dbus set ${module}_common_web_port="86"
dbus set ${module}_common_web_username="admin"
dbus set ${module}_common_web_password="test123"
dbus set ${module}_common_http_proxy_port="55"
dbus set ${module}_common_https_proxy_port="66"

# 如果配置不存在 那么设置默认值
if [ "$(dbus get ${module}_common_bridge_port)" == "" ];then
dbus set ${module}_common_bridge_port="85"
fi
if [ "$(dbus get ${module}_common_web_port)" == "" ];then
dbus set ${module}_common_web_port="86"
fi
if [ "$(dbus get ${module}_common_web_username)" == "" ];then
dbus set ${module}_common_web_username="admin"
fi
if [ "$(dbus get ${module}_common_web_password)" == "" ];then
dbus set ${module}_common_web_password="test123"
fi
if [ "$(dbus get ${module}_common_http_proxy_port)" == "" ];then
dbus set ${module}_common_http_proxy_port="55"
fi
if [ "$(dbus get ${module}_common_https_proxy_port)" == "" ];then
dbus set ${module}_common_https_proxy_port="66"
fi
if [ "$(dbus get ${module}_common_allow_ports)" == "" ];then
dbus set ${module}_common_allow_ports="9001-9009,10001,11000-12000"
fi
if [ "$(dbus get ${module}_common_allow_user_login)" == "" ];then
dbus set ${module}_common_allow_user_login="false"
fi
if [ "$(dbus get ${module}_common_allow_user_register)" == "" ];then
dbus set ${module}_common_allow_user_register="false"
fi

if [ "$(dbus get ${module}_common_cron_hour_min)" == "" ];then
dbus set ${module}_common_cron_hour_min="hour"
fi
if [ "$(dbus get ${module}_common_cron_time)" == "" ];then
dbus set ${module}_common_cron_time="12"
fi


# 10.安装完毕 重启插件
# re-enable
Expand Down
38 changes: 24 additions & 14 deletions nps/scripts/nps_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ public_vkey=123
# log level LevelEmergency->0 LevelAlert->1 LevelCritical->2 LevelError->3 LevelWarning->4 LevelNotice->5 LevelInformational->6 LevelDebug->7
log_level=7
#log_path=nps.log
log_path=${LOG_FILE}
#Whether to restrict IP access, true or false or ignore
#ip_limit=true
Expand Down Expand Up @@ -126,13 +125,13 @@ web_key_file=conf/server.key
auth_crypt_key =1234567812345678
#allow_ports=9001-9009,10001,11000-12000
allow_ports=${nps_common_allow_ports}
#Web management multi-user login
allow_user_login=false
allow_user_register=false
allow_user_login=${nps_common_allow_user_login}
allow_user_register=${nps_common_allow_user_register}
allow_user_change_username=false
#extension
allow_flow_limit=false
allow_rate_limit=false
Expand Down Expand Up @@ -215,15 +214,6 @@ check_port(){
open_port(){
local t_port
local u_port
"",
"",
"nps_common_web_username",
"nps_common_web_password",
"",
"",
"nps_common_cron_time",
"nps_common_cron_hour_min"

[ "$(check_port tcp ${nps_common_bridge_port})" == "1" ] && iptables -I INPUT -p tcp --dport ${nps_common_bridge_port} -j ACCEPT >/tmp/ali_ntp.txt 2>&1 && t_port="${nps_common_bridge_port}"
[ "$(check_port tcp ${nps_common_web_port})" == "1" ] && iptables -I INPUT -p tcp --dport ${nps_common_web_port} -j ACCEPT >/tmp/ali_ntp.txt 2>&1 && t_port="${t_port} ${nps_common_web_port}"
[ "$(check_port tcp ${nps_common_http_proxy_port})" == "1" ] && iptables -I INPUT -p tcp --dport ${nps_common_http_proxy_port} -j ACCEPT >/tmp/ali_ntp.txt 2>&1 && t_port="${t_port} ${nps_common_http_proxy_port}"
Expand All @@ -232,6 +222,16 @@ open_port(){
[ "$(check_port udp ${nps_common_http_proxy_port})" == "1" ] && iptables -I INPUT -p udp --dport ${nps_common_web_port} -j ACCEPT >/tmp/ali_ntp.txt 2>&1 && u_port="${u_port} ${nps_common_web_port}"
[ "$(check_port udp ${nps_common_http_proxy_port})" == "1" ] && iptables -I INPUT -p udp --dport ${nps_common_http_proxy_port} -j ACCEPT >/tmp/ali_ntp.txt 2>&1 && u_port="${u_port} ${nps_common_http_proxy_port}"
[ "$(check_port udp ${nps_common_https_proxy_port})" == "1" ] && iptables -I INPUT -p udp --dport ${nps_common_https_proxy_port} -j ACCEPT >/tmp/ali_ntp.txt 2>&1 && u_port="${u_port} ${nps_common_https_proxy_port}"
# 动态设置 tcp udp
temp_ports="${nps_common_allow_ports//-/:}"
IFS=","
set -- $temp_ports
for temp_port
do
# echo "$val"
[ "$(check_port tcp ${temp_port})" == "1" ] && iptables -I INPUT -p tcp --dport ${temp_port} -j ACCEPT >/tmp/ali_ntp.txt 2>&1 && t_port="${t_port} ${temp_port}"
[ "$(check_port udp ${temp_port})" == "1" ] && iptables -I INPUT -p udp --dport ${temp_port} -j ACCEPT >/tmp/ali_ntp.txt 2>&1 && u_port="${u_port} ${temp_port}"
done
[ -n "${t_port}" ] && echo_date "开启TCP端口:${t_port}"
[ -n "${u_port}" ] && echo_date "开启UDP端口:${u_port}"
}
Expand All @@ -247,7 +247,17 @@ close_port(){
[ "$(check_port udp ${nps_common_web_port})" == "0" ] && iptables -D INPUT -p udp --dport ${nps_common_web_port} -j ACCEPT >/dev/null 2>&1 && u_port="${u_port} ${nps_common_web_port}"
[ "$(check_port udp ${nps_common_http_proxy_port})" == "0" ] && iptables -D INPUT -p udp --dport ${nps_common_http_proxy_port} -j ACCEPT >/dev/null 2>&1 && u_port="${u_port} ${nps_common_http_proxy_port}"
[ "$(check_port udp ${nps_common_https_proxy_port})" == "0" ] && iptables -D INPUT -p udp --dport ${nps_common_https_proxy_port} -j ACCEPT >/dev/null 2>&1 && u_port="${u_port} ${nps_common_https_proxy_port}"
[ -n "${t_port}" ] && echo_date "关闭TCP端口:${t_port}"
# 动态设置 tcp udp
temp_ports="${nps_common_allow_ports//-/:}"
IFS=","
set -- $temp_ports
for temp_port
do
# echo "$val"
[ "$(check_port tcp ${temp_port})" == "0" ] && iptables -D INPUT -p tcp --dport ${temp_port} -j ACCEPT >/dev/null 2>&1 && t_port="${t_port} ${temp_port}"
[ "$(check_port udp ${temp_port})" == "0" ] && iptables -D INPUT -p udp --dport ${temp_port} -j ACCEPT >/dev/null 2>&1 && u_port="${u_port} ${temp_port}"
done
[ -n "${t_port}" ] && echo_date "关闭TCP端口:${t_port}"
[ -n "${u_port}" ] && echo_date "关闭UDP端口:${u_port}"
}
# 5秒后关闭
Expand Down
2 changes: 1 addition & 1 deletion nps/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.26.10.2
v0.26.10.3
37 changes: 32 additions & 5 deletions nps/webs/Module_nps.asp
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,13 @@ var params_input = [
"nps_common_web_password",
"nps_common_http_proxy_port",
"nps_common_https_proxy_port",
"nps_common_allow_ports",
"nps_common_allow_user_login",
"nps_common_allow_user_register",
"nps_common_cron_time",
"nps_common_cron_hour_min"
];
var params_check = ["nps_enable"];
var refresh_flag;
var count_down;
Expand Down Expand Up @@ -393,7 +397,7 @@ function get_log(action){
<div id="nps_status"><i><span id="status">获取中...</span></i></div>
</td>
<tr>
<th width="20%"><a class="hintstyle" href="javascript:void(0);" onclick="openssHint(1)">端口</a></th>
<th width="20%"><a class="hintstyle" href="javascript:void(0);" onclick="openssHint(1)">客户端连接端口</a></th>
<td>
<input type="text" class="input_ss_table" value="" id="nps_common_bridge_port" name="nps_common_bridge_port" maxlength="5" value="" placeholder=""/>
</td>
Expand All @@ -417,18 +421,41 @@ function get_log(action){
</td>
</tr>
<tr>
<th width="20%"><a class="hintstyle" href="javascript:void(0);" onclick="openssHint(5)">http端口</a></th>
<th width="20%"><a class="hintstyle" href="javascript:void(0);" onclick="openssHint(5)">HTTP 端口</a></th>
<td>
<input type="text" class="input_ss_table" value="" id="nps_common_http_proxy_port" name="nps_common_http_proxy_port" maxlength="5" value="" placeholder=""/>
</td>
</tr>
<tr>
<th width="20%"><a class="hintstyle" href="javascript:void(0);" onclick="openssHint(6)">https端口</a></th>
<th width="20%"><a class="hintstyle" href="javascript:void(0);" onclick="openssHint(6)">HTTPS 端口</a></th>
<td>
<input type="text" class="input_ss_table" value="" id="nps_common_https_proxy_port" name="nps_common_https_proxy_port" maxlength="5" value="" placeholder=""/>
</td>
</tr>

<tr>
<th width="20%"><a class="hintstyle" href="javascript:void(0);" onclick="openssHint(7)">允许端口</a></th>
<td>
<input type="text" class="input_ss_table" value="" id="nps_common_allow_ports" name="nps_common_allow_ports" maxlength="50" value="" placeholder=""/>
</td>
</tr>
<tr>
<th width="20%"><a class="hintstyle" href="javascript:void(0);" onclick="openssHint(8)">允许多用户-用户登录</a></th>
<td>
<select id="nps_common_allow_user_login" name="nps_common_allow_user_login" style="width:165px;margin:0px 0px 0px 2px;" class="input_option" >
<option value="true">开启</option>
<option value="false">关闭</option>
</select>
</td>
</tr>
<tr>
<th width="20%"><a class="hintstyle" href="javascript:void(0);" onclick="openssHint(9)">允许多用户-用户注册</a></th>
<td>
<select id="nps_common_allow_user_register" name="nps_common_allow_user_register" style="width:165px;margin:0px 0px 0px 2px;" class="input_option" >
<option value="true">开启</option>
<option value="false">关闭</option>
</select>
</td>
</tr>
<!--
<tr>
<th width="20%"><a class="hintstyle" href="javascript:void(0);" onclick="openssHint(1)">Dashboard port</a></th>
Expand Down Expand Up @@ -538,7 +565,7 @@ function get_log(action){
-->

<tr>
<th width="20%"><a class="hintstyle" href="javascript:void(0);" onclick="openssHint(7)">定时注册服务</a>(<i>0为关闭</i>)</th>
<th width="20%"><a class="hintstyle" href="javascript:void(0);" onclick="openssHint(10)">定时注册服务</a>(<i>0为关闭</i>)</th>
<td>
<input type="text" id="nps_common_cron_time" name="nps_common_cron_time" class="input_ss_table" style="width:30px" value="30" placeholder="" />
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
v0.26.10.2
v0.26.10.3
a50806415e3d615822b91518a56c26d5

0 comments on commit f4eaacb

Please sign in to comment.