add ssserver

This commit is contained in:
paldier 2019-01-16 20:42:39 +08:00
parent f59a4f8244
commit 8d2bebb205
16 changed files with 462 additions and 0 deletions

View File

@ -80,6 +80,16 @@
"title": "frpc穿透", "title": "frpc穿透",
"version": "2.1.15" "version": "2.1.15"
}, },
{
"build_date": "2019-01-16_20:42:05",
"description": "ss-server",
"home_url": "Module_ssserver.asp",
"md5": "685832dcb4a2a9df0c080043269922c5",
"name": "ssserver",
"tar_url": "ssserver/ssserver.tar.gz",
"title": "ss-server",
"version": "2.1"
},
{ {
"build_date": "2019-01-13_19:04:43", "build_date": "2019-01-13_19:04:43",
"description": "kms", "description": "kms",

24
ssserver/backup.sh Normal file
View File

@ -0,0 +1,24 @@
#! /bin/sh
# you can do something here
# this shell scripts will run at the end of build.py scripts
tar_name="$1.tar.gz"
mkdir -p history
if [ ! -f ./history/version ];then
touch ./history/version
fi
version_old=`cat history/version | awk '{print $1}' | sort -rn |sed -n 1p`
version_new=`cat config.json.js |grep "version"|cut -d"\"" -f 4`
md5_old=`cat history/version | sort -nk1 | awk '{print $1}' |sed -n 1p`
md5_new=` md5sum $tar_name | awk '{print $1}'`
if [ -f ./$tar_name ];then
if [ "$version_old" != "$version_new" ];then
mkdir ./history/$version_new/
cp ./$tar_name ./history/$version_new/
echo $version_new $md5_new >> ./history/version
fi
fi

32
ssserver/build.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/sh
MODULE=ssserver
VERSION=2.1
TITLE=ss-server
DESCRIPTION=ss-server
HOME_URL=Module_ssserver.asp
# Check and include base
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ "$MODULE" == "" ]; then
echo "module not found"
exit 1
fi
if [ -f "$DIR/$MODULE/$MODULE/install.sh" ]; then
echo "install script not found"
exit 2
fi
# now include build_base.sh
. $DIR/../softcenter/build_base.sh
# change to module directory
cd $DIR
# do something here
do_build_result
sh backup.sh $MODULE

8
ssserver/config.json.js Normal file
View File

@ -0,0 +1,8 @@
{
"version":"2.1",
"md5":"685832dcb4a2a9df0c080043269922c5",
"home_url":"Module_ssserver.asp",
"title":"ss-server",
"description":"ss-server",
"build_date":"2019-01-16_20:42:05"
}

Binary file not shown.

1
ssserver/history/version Normal file
View File

@ -0,0 +1 @@
2.1 685832dcb4a2a9df0c080043269922c5

BIN
ssserver/ssserver.tar.gz Normal file

Binary file not shown.

BIN
ssserver/ssserver/bin/obfs-server Executable file

Binary file not shown.

BIN
ssserver/ssserver/bin/ss-server Executable file

Binary file not shown.

View File

@ -0,0 +1,19 @@
#! /bin/sh
cd /tmp
cp -rf /tmp/ssserver/bin/* /jffs/softcenter/bin
cp -rf /tmp/ssserver/scripts/* /jffs/softcenter/scripts/
cp -rf /tmp/ssserver/webs/* /jffs/softcenter/webs/
cp -rf /tmp/ssserver/res/* /jffs/softcenter/res/
if [ ! -L "/jffs/softcenter/init.d/S10Softcenter.sh" ]; then
cp -f /jffs/softcenter/scripts/ssserver.sh /jffs/softcenter/init.d/S66ssserver.sh
fi
cd /
rm -rf /tmp/ssserver* >/dev/null 2>&1
chmod 755 /jffs/softcenter/bin/ss-server
chmod 755 /jffs/softcenter/bin/*
chmod 755 /jffs/softcenter/init.d/*
chmod 755 /jffs/softcenter/scripts/*

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@ -0,0 +1,102 @@
#!/bin/sh
# ====================================变量定义====================================
# 版本号定义
version="2.2"
# 引用环境变量等
source /jffs/softcenter/scripts/base.sh
# 导入skipd数据
eval `dbus export ssserver`
# kill first
stop_ssserver(){
killall ss-server
killall obfs-server
}
# start ssserver
start_ssserver(){
[ $ssserver_udp -ne 1 ] && ARG_UDP="" || ARG_UDP="-u";
if [ "$ssserver_obfs" == "http" ];then
ARG_OBFS="--plugin obfs-server --plugin-opts obfs=http"
elif [ "$ssserver_obfs" == "tls" ];then
ARG_OBFS="--plugin obfs-server --plugin-opts obfs=tls"
else
ARG_OBFS=""
fi
#ss-server -c /jffs/softcenter/ssserver/ss.json $ARG_UDP $ARG_OBFS -f /tmp/ssserver.pid
/jffs/softcenter/bin/ss-server -s 0.0.0.0 -p $ssserver_port -k $ssserver_password -m $ssserver_method -t $ssserver_time $ARG_UDP -f /tmp/ssserver.pid $ARG_OBFS
}
open_port(){
iptables -t filter -I INPUT -p tcp --dport $ssserver_port -j ACCEPT >/dev/null 2>&1
iptables -t filter -I INPUT -p udp --dport $ssserver_port -j ACCEPT >/dev/null 2>&1
}
close_port(){
iptables -t filter -D INPUT -p tcp --dport $ssserver_port -j ACCEPT >/dev/null 2>&1
iptables -t filter -D INPUT -p udp --dport $ssserver_port -j ACCEPT >/dev/null 2>&1
}
write_nat_start(){
echo 添加nat-start触发事件...
dbus set __event__onnatstart_ssserver="/jffs/softcenter/scripts/ssserver.sh"
}
remove_nat_start(){
echo 删除nat-start触发...
dbus remove __event__onnatstart_koolproxy
}
write_output(){
ss_enable=`dbus get ss_basic_enable`
if [ "$ssserver_use_ss" == "1" ] && [ "$ss_enable" == "1" ];then
if [ ! -L "/tmp/etc/dnsmasq.user/gfwlist.conf" ];then
echo link gfwlist.conf
ln -sf /jffs/softcenter/ss/rules/gfwlist.conf /tmp/etc/dnsmasq.user/gfwlist.conf
fi
service restart_dnsmasq
iptables -t nat -A OUTPUT -p tcp -m set --match-set gfwlist dst -j REDIRECT --to-ports 3333
fi
}
del_output(){
iptables -t nat -D OUTPUT -p tcp -m set --match-set gfwlist dst -j REDIRECT --to-ports 3333 >/dev/null 2>&1
}
case $ACTION in
start)
if [ "$ssserver_enable" == "1" ];then
logger "[软件中心]: 启动ss-server"
start_ssserver
open_port
write_output
else
logger "[软件中心]: ss-server未设置开机启动跳过"
fi
;;
stop | kill )
close_port
stop_ssserver
remove_nat_start
del_output
;;
restart)
close_port
stop_ssserver
del_output
sleep 1
start_ssserver
open_port
write_nat_start
write_output
;;
*)
close_port
del_output
open_port
write_output
esac

View File

@ -0,0 +1,9 @@
#!/bin/sh
eval `dbus export ssserver`
if [ "$ssserver_enable" == "1" ];then
sh /jffs/softcenter/scripts/ssserver.sh restart
else
sh /jffs/softcenter/scripts/ssserver.sh stop
fi

View File

@ -0,0 +1,7 @@
#!/bin/sh
rm -rf /jffs/softcenter/bin/ssserver
rm -rf /jffs/softcenter/init.d/jffs/softcenter/init.d/S66ssserver.sh
rm -rf /jffs/softcenter/scripts/ssserve*.sh
rm -rf /jffs/softcenter/webs/Module_ssserver.asp
rm -rf /jffs/softcenter/scripts/uninstall_ssserver.sh

View File

@ -0,0 +1,248 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache"/>
<meta HTTP-EQUIV="Expires" CONTENT="-1"/>
<link rel="shortcut icon" href="images/favicon.png"/>
<link rel="icon" href="images/favicon.png"/>
<title>软件中心-SS-SERVER</title>
<link rel="stylesheet" type="text/css" href="index_style.css"/>
<link rel="stylesheet" type="text/css" href="form_style.css"/>
<link rel="stylesheet" type="text/css" href="usp_style.css"/>
<link rel="stylesheet" type="text/css" href="ParentalControl.css">
<link rel="stylesheet" type="text/css" href="css/icon.css">
<link rel="stylesheet" type="text/css" href="css/element.css">
<link rel="stylesheet" type="text/css" href="res/shadowsocks.css">
<script type="text/javascript" src="/state.js"></script>
<script type="text/javascript" src="/popup.js"></script>
<script type="text/javascript" src="/help.js"></script>
<script type="text/javascript" src="/validator.js"></script>
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/general.js"></script>
<script type="text/javascript" src="/switcherplugin/jquery.iphone-switch.js"></script>
<script>
function init() {
show_menu();
buildswitch();
conf2obj();
}
function menu_hook() {
tabtitle[tabtitle.length - 1] = new Array("", "ssserver");
tablink[tablink.length - 1] = new Array("", "Module_ssserver.asp");
}
function done_validating() {
refreshpage(5);
}
function buildswitch() {
$("#switch").click(
function() {
if (document.getElementById('switch').checked) {
document.form.ssserver_enable.value = 1;
} else {
document.form.ssserver_enable.value = 0;
}
});
}
function onSubmitCtrl(o, s) {
document.form.action_mode.value = s;
showLoading(5);
document.form.submit();
}
function conf2obj() {
$.ajax({
type: "get",
url: "dbconf?p=ssserver",
dataType: "script",
success: function(xhr) {
var p = "ssserver";
var params = ["method", "password", "port", "udp", "time", "use_ss", "obfs"];
for (var i = 0; i < params.length; i++) {
if (db_ssserver[p + "_" + params[i]]) {
$("#ssserver_" + params[i]).val(db_ssserver[p + "_" + params[i]]);
}
}
var rrt = document.getElementById("switch");
if (db_ssserver["ssserver_enable"] != "1") {
rrt.checked = false;
} else {
rrt.checked = true;
}
}
});
}
function reload_Soft_Center() {
location.href = "/Main_Soft_center.asp";
}
</script>
</head>
<body onload="init();">
<div id="TopBanner"></div>
<div id="Loading" class="popup_bg"></div>
<iframe name="hidden_frame" id="hidden_frame" src="" width="0" height="0" frameborder="0"></iframe>
<form method="POST" name="form" action="/applydb.cgi?p=ssserver_" target="hidden_frame">
<input type="hidden" name="current_page" value="Module_ssserver.asp"/>
<input type="hidden" name="next_page" value="Module_ssserver.asp"/>
<input type="hidden" name="group_id" value=""/>
<input type="hidden" name="modified" value="0"/>
<input type="hidden" name="action_mode" value=""/>
<input type="hidden" name="action_script" value="ssserver_config.sh"/>
<input type="hidden" name="action_wait" value="5"/>
<input type="hidden" name="first_time" value=""/>
<input type="hidden" name="preferred_lang" id="preferred_lang" value="<% nvram_get("preferred_lang"); %>"/>
<input type="hidden" name="firmver" value="<% nvram_get("firmver"); %>"/>
<input type="hidden" id="ssserver_enable" name="ssserver_enable" value='<% dbus_get_def("ssserver_enable", "0"); %>'/>
<table class="content" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="17">&nbsp;</td>
<td valign="top" width="202">
<div id="mainMenu"></div>
<div id="subMenu"></div>
</td>
<td valign="top">
<div id="tabMenu" class="submenuBlock"></div>
<table width="98%" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="top">
<table width="760px" border="0" cellpadding="5" cellspacing="0" bordercolor="#6b8fa3" class="FormTitle" id="FormTitle">
<tr>
<td bgcolor="#4D595D" colspan="3" valign="top">
<div>&nbsp;</div>
<div style="float:left;" class="formfonttitle">SS-SERVER</div>
<div style="float:right; width:15px; height:25px;margin-top:10px"><img id="return_btn" onclick="reload_Soft_Center();" align="right" style="cursor:pointer;position:absolute;margin-left:-30px;margin-top:-25px;" title="返回软件中心" src="/images/backprev.png" onMouseOver="this.src='/images/backprevclick.png'" onMouseOut="this.src='/images/backprev.png'"></div>
<div style="margin-left:5px;margin-top:10px;margin-bottom:10px"><img src="/images/New_ui/export/line_export.png"></div>
<div class="formfontdesc" id="cmdDesc">开启ss-server后就可以类似VPN一样将你的网络共享到公网让你和你的小伙伴远程连接。</div>
<table style="margin:10px 0px 0px 0px;" width="100%" border="1" align="center" cellpadding="4" cellspacing="0" bordercolor="#6b8fa3" class="FormTable">
<thead>
<tr>
<td colspan="2">ss-server开关</td>
</tr>
</thead>
<tr>
<th>开启ss-server</th>
<td colspan="2">
<div class="switch_field" style="display:table-cell">
<label for="switch">
<input id="switch" class="switch" type="checkbox" style="display: none;">
<div class="switch_container" >
<div class="switch_bar"></div>
<div class="switch_circle transition_style">
<div></div>
</div>
</div>
</label>
</div>
<span style="float: left;">二进制版本: 3.2.1</span>
</td>
</tr>
</table>
<table style="margin:10px 0px 0px 0px;" width="100%" border="1" align="center" cellpadding="4" cellspacing="0" bordercolor="#6b8fa3" class="FormTable" id="ssserver_detail">
<thead>
<tr>
<td colspan="2">ss-server详细设置</td>
</tr>
</thead>
<tr>
<th>加密方式</th>
<td>
<div>
<select id="ssserver_method" name="ssserver_method" style="width:164px;margin:0px 0px 0px 2px;" class="input_option" >
<option class="content_input_fd" value="rc4-md5">rc4-md5</option>
<option class="content_input_fd" value="aes-128-gcm">aes-128-gcm</option>
<option class="content_input_fd" value="aes-192-gcm">aes-192-gcm</option>
<option class="content_input_fd" value="aes-256-gcm">aes-256-gcm</option>
<option class="content_input_fd" value="aes-128-cfb">aes-128-cfb</option>
<option class="content_input_fd" value="aes-192-cfb">aes-192-cfb</option>
<option class="content_input_fd" value="aes-256-cfb">aes-256-cfb</option>
<option class="content_input_fd" value="aes-128-ctr">aes-128-ctr</option>
<option class="content_input_fd" value="aes-192-ctr">aes-192-ctr</option>
<option class="content_input_fd" value="aes-256-ctr">aes-256-ctr</option>
<option class="content_input_fd" value="camellia-128-cfb">camellia-128-cfb</option>
<option class="content_input_fd" value="camellia-192-cfb">camellia-192-cfb</option>
<option class="content_input_fd" value="camellia-256-cfb">camellia-256-cfb</option>
<option class="content_input_fd" value="bf-cfb">bf-cfb</option>
<option class="content_input_fd" value="chacha20-ietf-poly1305">chacha20-ietf-poly1305</option>
<option class="content_input_fd" value="xchacha20-ietf-poly1305">xchacha20-ietf-poly1305</option>
<option class="content_input_fd" value="salsa20">salsa20</option>
<option class="content_input_fd" value="chacha20">chacha20</option>
<option class="content_input_fd" value="chacha20-ietf">chacha20-ietf</option>
</select>
</div>
</td>
</tr>
<tr>
<th>密码</th>
<td>
<input type="password" name="ssserver_password" id="ssserver_password" class="input_ss_table" maxlength="100" value="" readonly onBlur="switchType(this, false);" onFocus="switchType(this, true);this.removeAttribute('readonly');"/>
</td>
</tr>
<tr>
<th>端口</th>
<td>
<div>
<input type="txt" name="ssserver_port" id="ssserver_port" class="input_ss_table" maxlength="100" value=""/>
</div>
</td>
</tr>
<tr>
<th>超时时间(秒)</th>
<td>
<div>
<input type="txt" name="ssserver_time" id="ssserver_time" class="input_ss_table" maxlength="100" value="600"/>
</div>
</td>
</tr>
<tr>
<th>UDP转发</th>
<td>
<select style="width:164px;margin-left: 2px;" class="input_option" id="ssserver_udp" name="ssserver_udp">
<option value="0" selected>关闭</option>
<option value="1">开启</option>
</select>
</td>
</tr>
<tr>
<th>混淆obfs</th>
<td>
<select style="width:164px;margin-left: 2px;" class="input_option" id="ssserver_obfs" name="ssserver_obfs">
<option value="0" selected>关闭</option>
<option value="http">http</option>
<option value="tls">tls</option>
</select>
</td>
</tr>
<tr>
<th>使用ss网络</th>
<td>
<select style="width:164px;margin-left: 2px;" class="input_option" id="ssserver_use_ss" name="ssserver_use_ss">
<option value="0" selected>关闭</option>
<option value="1">开启</option>
</select>
<br/>
<span>开启后连接到ss-server的客户端将能够访问ss网络但是ss插件的访问控制会失效。</span>
<br/>
<span>此功能要求软件中心的SS插件开启如果没有开启此功能将不会有效果。</span>
</td>
</tr>
</table>
<div id="warn" style="display: none;margin-top: 20px;text-align: center;font-size: 20px;margin-bottom: 20px;" class="formfontdesc" id="cmdDesc"><i>开启双线路负载均衡模式才能进行本页面设置建议负载均衡设置比例11</i></div>
<div class="apply_gen">
<button id="cmdBtn" class="button_gen" onclick="onSubmitCtrl(this, ' Refresh ')">提交</button>
</div>
<div style="margin-left:5px;margin-top:10px;margin-bottom:10px"><img src="/images/New_ui/export/line_export.png"></div>
</td>
</tr>
</table>
</td>
<td width="10" align="center" valign="top"></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<div id="footer"></div>
</body>
</html>

2
ssserver/version Normal file
View File

@ -0,0 +1,2 @@
2.1
685832dcb4a2a9df0c080043269922c5