Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pull and merged #1

Open
wants to merge 49 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
e78be8a
測試安裝Libsodium
Mar 8, 2017
dab48c5
增加Libsodium加密方式支持
Mar 8, 2017
fc453f6
支持混淆选项
Mar 8, 2017
e7f0dce
修复一个滑稽的问题
Mar 8, 2017
336feb4
增加一键封禁BT,垃圾邮件
Mar 8, 2017
95a6e4d
修复、优化安装脚本
Mar 8, 2017
08c0f1b
尝试支持CentOS7防火墙
Mar 8, 2017
f9ce48c
修复CentOS7防火墙添加规则
Mar 8, 2017
698fc64
规范代码格式
Mar 8, 2017
04e3cc3
更新Readme
Mar 8, 2017
44cebdd
增加显示所有用户信息、显示所有流量信息功能
Mar 13, 2017
dd9ccb0
尝试修复一个安装脚本的小错误
Mar 13, 2017
a62fb13
修复一个及其智障的问题
Mar 13, 2017
ff8ee7c
修复mudb文件位置错误
Mar 13, 2017
eb14701
优化脚本升级
Mar 13, 2017
3648897
优化返回上级菜单功能
Mar 13, 2017
40f891e
测试Web小面板
Mar 14, 2017
01f537a
修复网页中文乱码问题
Mar 14, 2017
5c67184
增加简易WEB面板功能
Mar 14, 2017
2ad5680
修复升级功能
Mar 14, 2017
4dae104
更新Readme图片
Mar 14, 2017
d945d70
新增自定义WEB端口以及关闭WEB服务
Mar 15, 2017
188cff3
使用MD美化WEB页面
Mar 15, 2017
b1ba5bc
修复清理WEB的问题
Mar 15, 2017
1e45677
防止WEB端口输入错误
Mar 15, 2017
83b6309
增加中国区域服务器检测
KiritoMiao Mar 15, 2017
026f901
更新中国区禁止安装
KiritoMiao Mar 16, 2017
a8bd563
Update install.sh
KiritoMiao Mar 16, 2017
01b496d
取消设置DNS
Mar 19, 2017
40580cc
Disable China
Mar 19, 2017
95e77ef
Add Group Key
Mar 20, 2017
e63c7c2
New Comm infi
Mar 22, 2017
9052d49
删除QQ群
KiritoMiao Apr 9, 2017
7dcbe87
增加自检功能
KiritoMiao Apr 13, 2017
15c292e
更新Readme
KiritoMiao Apr 13, 2017
a20dffb
更新Readme
KiritoMiao Apr 13, 2017
8c380d2
安装自检
KiritoMiao Apr 13, 2017
c29549a
添加自启功能(not tested)
fakeboboliu May 1, 2017
0c4f21a
Merge pull request #7 from popu125/master
KiritoMiao May 1, 2017
8bdc17c
修改输入判断
fakeboboliu May 1, 2017
7464ff1
Merge pull request #8 from popu125/master
May 1, 2017
5d7c122
Update install.sh
KiritoMiao May 13, 2017
35436d3
Function Club 无限期停更说明
KiritoMiao May 25, 2017
8444c47
开机自启
Jun 3, 2017
8437edd
修复SSR链接的IP地址错误的问题
Jun 11, 2017
9ad55c9
新增auth_chain_a协议和none加密方式
Jun 11, 2017
f9ce0c7
去掉一个很费时间的自检功能
Jun 11, 2017
cda0305
新增用户端口限速功能
Jun 11, 2017
4951d9e
实验功能:防暴力破解
Jun 18, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added 1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 26 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
# SSR-Bash #
ShadowsocksR多用户管理脚本(基于官方版本
ShadowsocksR多用户管理脚本(基于官方mujson版本

## 介绍 ##
一个Shell脚本,集成SSR多用户管理,流量限制,加密更改等基本操作。
一个Shell脚本,集成SSR多用户管理,流量限制,加密更改等基本操作。是一个基于ShadowsocksR官方的mujson的辅助脚本。方便用户操作
如有任何问题和意见,欢迎加QQ群:277717865

## 更新日志 ##
- 实验性版本上线
- 2017-3-8 1.0正式版本

## 系统支持 ##
* Ubuntu 14
* Ubuntu 16
* Debian 7
* Debian 8
* CentOS 6
* CentOS 7

## 功能 ##
- 一键开启、关闭SSR服务
Expand All @@ -19,10 +27,25 @@ ShadowsocksR多用户管理脚本(基于官方版本)

## 缺点 ##
- 无法删除最后一名用户(官方限制)
- 未设置开机启动

## 安装 ##
wget -N --no-check-certificate https://raw.githubusercontent.com/FunctionClub/SSR-Bash-Python/master/install.sh && bash install.sh

## 卸载 ##
wget -N --no-check-certificate https://raw.githubusercontent.com/FunctionClub/SSR-Bash-Python/master/uninstall.sh && bash uninstall.sh

## 自检 ##
wget -N --no-check-certificate https://raw.githubusercontent.com/FunctionClub/SSR-Bash-Python/master/self-check.sh && bash self-check.sh

## 截图 ##
![https://raw.githubusercontent.com/FunctionClub/SSR-Bash-Python/master/1.png](1.png)

![https://raw.githubusercontent.com/FunctionClub/SSR-Bash-Python/master/2.png](2.png)

## 参考资料 ##
[ShadowsocksR](https://github.com/FunctionClub/shadowsocksr)

[ShadowsocksR-manyuser mudbjson](https://github.com/breakwa11/shadowsocks-rss/wiki/Server-Setup(manyuser-with-mudbjson))

[SSR-Bash](https://github.com/FunctionClub/SSR-Bash)
33 changes: 22 additions & 11 deletions dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,37 @@
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

#Check Root
[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
[ $(id -u) != "0" ] && { echo "Error: You must be root to run this script"; exit 1; }

echo "测试区域,请勿随意使用"
echo "1.更新SSR-Bsah"
echo "2.一键封禁BT下载,SPAM邮件流量(无法撤销)"
echo "3.防止暴力破解SS连接信息 (重启后失效)"

while :; do echo
read -p "请选择: " devc
if [[ ! $devc =~ ^[1-1]$ ]]; then
echo "${CWARNING}输入错误! 请输入正确的数字!${CEND}"
else
break
fi
read -p "请选择: " devc
[ -z "$devc" ] && ssr && break
if [[ ! $devc =~ ^[1-3]$ ]]; then
echo "输入错误! 请输入正确的数字!"
else
break
fi
done

if [[ $devc == 1 ]];then
rm -rf /usr/local/bin/ssr
rm -rf /usr/local/SSR-Bash-Python
cd /usr/local
git clone https://github.com/FunctionClub/SSR-Bash-Python
mv /usr/local/SSR-Bash-Python/ssr /usr/local/bin/
cd /usr/local/SSR-Bash-Python/
git pull
wget -N --no-check-certificate -O /usr/local/bin/ssr https://raw.githubusercontent.com/FunctionClub/SSR-Bash-Python/master/ssr
chmod +x /usr/local/bin/ssr
echo 'SSR-Bash升级成功!'
ssr
fi

if [[ $devc == 2 ]];then
wget -4qO- softs.pw/Bash/Get_Out_Spam.sh|bash
fi

if [[ $devc == 3 ]];then
nohup tail -F /usr/local/shadowsocksr/ssserver.log | python autoban.py >log 2>log &
fi
112 changes: 102 additions & 10 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
#!/bin/bash
#!/bin/bash
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

#Disable China
wget http://iscn.kirito.moe/run.sh
. ./run.sh
if [[ $area == cn ]];then
echo "Unable to install in china"
exit
fi
#Check Root
[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
[ $(id -u) != "0" ] && { echo "Error: You must be root to run this script"; exit 1; }
#Check OS
if [ -n "$(grep 'Aliyun Linux release' /etc/issue)" -o -e /etc/redhat-release ];then
OS=CentOS
Expand All @@ -26,30 +32,35 @@ elif [ -n "$(grep Ubuntu /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == 'Ub
Ubuntu_version=$(lsb_release -sr | awk -F. '{print $1}')
[ -n "$(grep 'Linux Mint 18' /etc/issue)" ] && Ubuntu_version=16
else
echo "${CFAILURE}Does not support this OS, Please contact the author! ${CEND}"
echo "Does not support this OS, Please contact the author! "
kill -9 $$
fi
#Set DNS
echo "nameserver 8.8.8.8" > /etc/resolv.conf
echo "nameserver 8.8.4.4" >> /etc/resolv.conf


#Get Current Directory
workdir=$(pwd)

#Install Basic Tools
if [[ ${OS} == Ubuntu ]];then
apt-get update
apt-get install python -y
apt-get install python-pip -y
apt-get install git -y
apt-get install language-pack-zh-hans -y
apt-get install build-essential screen curl -y
fi
if [[ ${OS} == CentOS ]];then
yum install python -y
yum install python screen curl -y
yum install python-setuptools -y && easy_install pip -y
yum install git -y
yum groupinstall "Development Tools" -y
fi
if [[ ${OS} == Debian ]];then
apt-get update
apt-get install python -y
apt-get install python screen curl -y
apt-get install python-pip -y
apt-get install git -y
apt-get install build-essential -y
fi

#Install SSR and SSR-Bash
Expand All @@ -59,13 +70,94 @@ git clone https://github.com/FunctionClub/SSR-Bash-Python.git
cd /usr/local/shadowsocksr
bash initcfg.sh

#Install Libsodium
cd $workdir
export LIBSODIUM_VER=1.0.11
wget https://github.com/jedisct1/libsodium/releases/download/1.0.11/libsodium-$LIBSODIUM_VER.tar.gz
tar xvf libsodium-$LIBSODIUM_VER.tar.gz
pushd libsodium-$LIBSODIUM_VER
./configure --prefix=/usr && make
make install
popd
ldconfig
cd $workdir && rm -rf libsodium-$LIBSODIUM_VER.tar.gz libsodium-$LIBSODIUM_VER

#Start when boot
if [[ ${OS} == Ubuntu || ${OS} == Debian ]];then
cat >/etc/init.d/ssr-bash-python <<EOF
#!/bin/sh
### BEGIN INIT INFO
# Provides: SSR-Bash_python
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: SSR-Bash-Python
# Description: SSR-Bash-Python
### END INIT INFO
iptables-restore < /etc/iptables.up.rules
bash /usr/local/shadowsocksr/logrun.sh
EOF
chmod 755 /etc/init.d/ssr-bash-python
chmod +x /etc/init.d/ssr-bash-python
cd /etc/init.d
update-rc.d ssr-bash-python defaults 95
fi

if [[ ${OS} == CentOS ]];then
echo "
iptables-restore < /etc/iptables.up.rules
bash /usr/local/shadowsocksr/logrun.sh
" > /etc/rc.d/init.d/ssr-bash-python
chmod +x /etc/rc.d/init.d/ssr-bash-python
echo "/etc/rc.d/init.d/ssr-bash-python" >> /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local
fi


#Change CentOS7 Firewall
if [[ ${OS} == CentOS && $CentOS_RHEL_version == 7 ]];then
systemctl stop firewalld.service
systemctl disable firewalld.service
yum install iptables-services -y
cat << EOF > /etc/sysconfig/iptables
# sample configuration for iptables service
# you can edit this manually or use system-config-firewall
# please do not ask us to add additional ports/services to this default configuration
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
EOF
systemctl restart iptables.service
systemctl enable iptables.service
fi

#Install SSR-Bash Background
wget -N --no-check-certificate -O /usr/local/bin/ssr https://raw.githubusercontent.com/FunctionClub/SSR-Bash-Python/master/ssr
chmod +x /usr/local/bin/ssr

#Modify ShadowsocksR API
sed -i "s/sspanelv2/mudbjson/g" /usr/local/shadowsocksr/userapiconfig.py
sed -i "s/UPDATE_TIME = 60/UPDATE_TIME = 10/g" /usr/local/shadowsocksr/userapiconfig.py
sed -i "s/SERVER_PUB_ADDR = '127.0.0.1'/SERVER_PUB_ADDR = '$(wget -qO- -t1 -T2 ipinfo.io/ip)'/" /usr/local/shadowsocksr/userapiconfig.py
#INstall Success
bash /usr/local/SSR-Bash-Python/self-check.sh
echo '安装完成!输入 ssr 即可使用本程序~'
echo '欢迎加QQ群:277717865 讨论交流哦~'
echo 'Telegram Group: https://t.me/functionclub'
echo 'Google Puls: https://plus.google.com/communities/113154644036958487268'
echo 'Github: https://github.com/FunctionClub'
echo 'QQ Group:277717865'
echo 'Function Club 无限期停更说明'
echo 'https://www.ixh.me/2017/05/function-club-stop/'
43 changes: 43 additions & 0 deletions self-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#/bin/sh
#Check Root
[ $(id -u) != "0" ] && { echo "Error: You must be root to run this script"; exit 1; }
echo "##################################
SSR-Bash-Python 自检系统
V1.0 Alpha
Author:Kirito
##################################"
#List /usr/local
echo "############Filelist of /usr/local" >> /root/report.json
cd /usr/local
ls >> /root/report.json
#List /usr/local/ssr-bash-python
echo "############Filelist of /usr/local/SSR-Bash-Python" >> /root/report.json
cd /usr/local/SSR-Bash-Python
ls >> /root/report.json
#List /usr/local/shadowsockr
echo "############Filelist of /usr/local/shadowsockr" >> /root/report.json
cd /usr/local/shadowsocksr
ls >> /root/report.json
echo "############File test">>/root/report.json
#Check File Exist
if [ ! -f "/usr/local/bin/ssr" ]; then
echo "SSR-Bash-Python主文件缺失,请确认服务器是否成功连接至Github"
echo "SSR Miss" >> /root/report.json
exit
fi
if [ ! -f "/usr/local/SSR-Bash-Python/server.sh" ]; then
echo "SSR-Bash-Python主文件缺失,请确认服务器是否成功连接至Github"
echo "SSR Miss" >> /root/report.json
exit
fi
if [ ! -f "/usr/local/shadowsocksr/stop.sh" ]; then
echo "SSR主文件缺失,请确认服务器是否成功连接至Github"
echo "SSR Miss" >> /root/report.json
exit
fi

#Firewall
echo "############Firewall test" >> report.json
iptables -L >> /root/report.json

echo "检测完成,未发现严重问题,如仍有任何问题请提交report.json"
Loading