forked from mmmwhy/pure_attention
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ss-panel-v3-mod.sh
205 lines (205 loc) · 8.73 KB
/
ss-panel-v3-mod.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
#!/bin/bash
#Check Root
[ $(id -u) != "0" ] && { echo "Error: You must be root to run this script"; exit 1; }
install_ss_panel_mod_v3(){
yum -y remove httpd
yum install -y unzip zip
wget -c https://raw.githubusercontent.com/Shu-Yibin/ss-panel-and-ss-py-mu/master/lnmp1.3.zip && unzip lnmp1.3.zip && cd lnmp1.3 && chmod +x install.sh && ./install.sh lnmp
cd /home/wwwroot/default/
yum install git -y
rm -rf index.html
wget https://raw.githubusercontent.com/Shu-Yibin/ss-panel-and-ss-py-mu/master/ss.panel_mod.zip && unzip ss.panel_mod.zip
chattr -i .user.ini
mv .user.ini public
chown -R root:root *
chmod -R 777 *
chown -R www:www storage
chattr +i public/.user.ini
wget -N -P /usr/local/nginx/conf/ http://home.ustc.edu.cn/~mmmwhy/nginx.conf
service nginx restart
yum install perl-DBI freeradius freeradius-mysql freeradius-utils -y
mysql -uroot -proot -e"CREATE USER 'radius'@'%' IDENTIFIED BY 'root';"
mysql -uroot -proot -e"GRANT ALL ON *.* TO 'radius'@'%';"
mysql -uroot -proot -e"create database radius;"
mysql -uroot -proot -e"use radius;"
mysql -uroot -proot radius < /home/wwwroot/default/sql/all.sql
mysql -uroot -proot -e"CREATE USER 'ss-panel-radius'@'%' IDENTIFIED BY 'root';"
mysql -uroot -proot -e"GRANT ALL ON *.* TO 'ss-panel-radius'@'%';"
mysql -uroot -proot -e"CREATE USER 'sspanel'@'%' IDENTIFIED BY 'root';"
mysql -uroot -proot -e"GRANT ALL ON *.* TO 'sspanel'@'%';"
mysql -uroot -proot -e"create database sspanel;"
mysql -uroot -proot -e"use sspanel;"
mysql -uroot -proot sspanel < /home/wwwroot/default/sql/sspanel.sql
\cp /home/wwwroot/default/sql/sql.conf /etc/raddb/sql.conf
wget https://github.com/glzjin/Radius-install/raw/master/radiusd.conf -O /etc/raddb/radiusd.conf
wget https://github.com/glzjin/Radius-install/raw/master/default -O /etc/raddb/sites-enabled/default
wget https://github.com/glzjin/Radius-install/raw/master/dialup.conf -O /etc/raddb/sql/mysql/dialup.conf
wget https://github.com/glzjin/Radius-install/raw/master/dictionary -O /etc/raddb/dictionary
wget https://github.com/glzjin/Radius-install/raw/master/counter.conf -O /etc/raddb/sql/mysql/counter.conf
service radiusd start && chkconfig radiusd on
cd /home/wwwroot/default
php composer.phar install
yum -y install vixie-cron crontabs
rm -rf /var/spool/cron/root
echo 'SHELL=/bin/bash' >> /var/spool/cron/root
echo 'PATH=/sbin:/bin:/usr/sbin:/usr/bin' >> /var/spool/cron/root
echo '*/20 * * * * /usr/sbin/ntpdate pool.ntp.org > /dev/null 2>&1' >> /var/spool/cron/root
echo '30 22 * * * php /www/wwwroot/ss.panel/xcat sendDiaryMail' >> /var/spool/cron/root
echo '0 0 * * * php /www/wwwroot/ss.panel/xcat dailyjob' >> /var/spool/cron/root
echo '*/1 * * * * php /www/wwwroot/ss.panel/xcat checkjob' >> /var/spool/cron/root
/sbin/service crond restart
IPAddress=`wget http://members.3322.org/dyndns/getip -O - -q ; echo`;
echo "#############################################################"
echo "# 安装成功,登录http://${IPAddress}看看吧~ #"
echo "# Github: https://github.com/mmmwhy/ss-panel-and-ss-py-mu #"
echo "# Author: 91vps.club #"
echo "# Blog: https://91vps.club/2017/05/27/ss-panel-v3-mod/ #"
echo "#############################################################"
}
install_centos_ssr(){
yum -y remove httpd
yum -y update
yum -y install git -y
yum -y install python-setuptools && easy_install pip -y
yum -y groupinstall "Development Tools" -y
#512M的小鸡增加1G的Swap分区
dd if=/dev/zero of=/var/swap bs=1024 count=1048576
mkswap /var/swap
chmod 0644 /var/swap
swapon /var/swap
echo '/var/swap swap swap default 0 0' >> /etc/fstab
wget https://github.com/jedisct1/libsodium/releases/download/1.0.13/libsodium-1.0.13.tar.gz
tar xf libsodium-1.0.13.tar.gz && cd libsodium-1.0.13
./configure && make -j2 && make install
echo /usr/local/lib > /etc/ld.so.conf.d/usr_local_lib.conf
ldconfig
#clone shadowsocks
cd /root
git clone -b manyuser https://github.com/glzjin/shadowsocks.git "/root/shadowsocks"
#install devel
cd /root/shadowsocks
yum -y install python-devel
yum -y install libffi-devel
yum -y install openssl-devel
pip install -r requirements.txt
cp apiconfig.py userapiconfig.py
cp config.json user-config.json
#iptables
iptables -I INPUT -p tcp -m tcp --dport 104 -j ACCEPT
iptables -I INPUT -p udp -m udp --dport 104 -j ACCEPT
iptables -I INPUT -p tcp -m tcp --dport 1024: -j ACCEPT
iptables -I INPUT -p udp -m udp --dport 1024: -j ACCEPT
iptables-save >/etc/sysconfig/iptables
echo 'iptables-restore /etc/sysconfig/iptables' >> /etc/rc.local
echo '/root/shadowsocks/./logrun.sh ' >> /etc/rc.local
chmod +x /etc/rc.d/rc.local
}
install_ubuntu_ssr(){
apt-get install build-essential wget -y
apt-get install iptables git -y
wget https://github.com/jedisct1/libsodium/releases/download/1.0.13/libsodium-1.0.13.tar.gz
tar xf libsodium-1.0.13.tar.gz && cd libsodium-1.0.13
./configure && make -j2 && make install
echo /usr/local/lib > /etc/ld.so.conf.d/usr_local_lib.conf
ldconfig
apt-get install python-pip git -y
pip install cymysql
cd /root
git clone -b manyuser https://github.com/glzjin/shadowsocks.git "/root/shadowsocks"
cd shadowsocks
pip install -r requirements.txt
chmod +x *.sh
# 配置程序
cp apiconfig.py userapiconfig.py
cp config.json user-config.json
#iptables
iptables -I INPUT -p tcp -m tcp --dport 104 -j ACCEPT
iptables -I INPUT -p udp -m udp --dport 104 -j ACCEPT
iptables -I INPUT -p tcp -m tcp --dport 1024: -j ACCEPT
iptables -I INPUT -p udp -m udp --dport 1024: -j ACCEPT
}
install_node(){
clear
echo
echo "#############################################################"
echo "# One click Install Shadowsocks-Python-Manyuser #"
echo "# Github: https://github.com/mmmwhy/ss-panel-and-ss-py-mu #"
echo "# Author: 91VPS.CLUB #"
echo "# https://91vps.club/2017/05/27/ss-panel-v3-mod/ #"
echo "#############################################################"
echo
#Check Root
[ $(id -u) != "0" ] && { echo "Error: You must be root to run this script"; exit 1; }
#check OS version
check_sys(){
if [[ -f /etc/redhat-release ]]; then
release="centos"
elif cat /etc/issue | grep -q -E -i "debian"; then
release="debian"
elif cat /etc/issue | grep -q -E -i "ubuntu"; then
release="ubuntu"
elif cat /etc/issue | grep -q -E -i "centos|red hat|redhat"; then
release="centos"
elif cat /proc/version | grep -q -E -i "debian"; then
release="debian"
elif cat /proc/version | grep -q -E -i "ubuntu"; then
release="ubuntu"
elif cat /proc/version | grep -q -E -i "centos|red hat|redhat"; then
release="centos"
fi
bit=`uname -m`
}
install_ssr_for_each(){
check_sys
if [[ ${release} = "centos" ]]; then
install_centos_ssr
else
install_ubuntu_ssr
fi
}
read -p "Please input your domain(like:https://ss.feiyang.li or http://114.114.114.114): " Userdomain
read -p "Please input your muKey(like:mupass): " Usermukey
read -p "Please input your Node_ID(like:1): " UserNODE_ID
install_ssr_for_each
IPAddress=`wget http://members.3322.org/dyndns/getip -O - -q ; echo`;
cd /root/shadowsocks
echo -e "modify Config.py...\n"
Userdomain=${Userdomain:-"http://${IPAddress}"}
sed -i "s#https://zhaoj.in#${Userdomain}#" /root/shadowsocks/userapiconfig.py
Usermukey=${Usermukey:-"mupass"}
sed -i "s#glzjin#${Usermukey}#" /root/shadowsocks/userapiconfig.py
UserNODE_ID=${UserNODE_ID:-"3"}
sed -i '2d' /root/shadowsocks/userapiconfig.py
sed -i "2a\NODE_ID = ${UserNODE_ID}" /root/shadowsocks/userapiconfig.py
cd /root/shadowsocks
./logrun.sh
echo "#############################################################"
echo "# 安装完成,登录前端站点看看吧 #"
echo "# Github: https://github.com/mmmwhy/ss-panel-and-ss-py-mu #"
echo "# Author: 91VPS.CLUB #"
echo "# Blog: https://91vps.club/2017/05/27/ss-panel-v3-mod/ #"
echo "#############################################################"
}
echo
echo "#############################################################"
echo "# One click Install SS-panel and Shadowsocks-Py-Mu #"
echo "# Github: https://github.com/mmmwhy/ss-panel-and-ss-py-mu #"
echo "# Author: 91VPS.club #"
echo "# Blog: https://91vps.club/2017/05/27/ss-panel-v3-mod/ #"
echo "# Please choose the server you want #"
echo "# 1 SS-V3_mod_panel One click Install #"
echo "# 2 SS-node One click Install #"
echo "#############################################################"
echo
stty erase '^H' && read -p " 请输入数字 [1-2]:" num
case "$num" in
1)
install_ss_panel_mod_v3
;;
2)
install_node
;;
*)
echo "请输入正确数字 [1-2]"
;;
esac