forked from y1ndan/shadowsocksR_1nstall
-
Notifications
You must be signed in to change notification settings - Fork 0
/
魔改V3.sh
1536 lines (1096 loc) · 37.7 KB
/
魔改V3.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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#! /bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
# 检测系统
function checkos(){
if [ -f /etc/redhat-release ];
then
echo
echo " 当前系统为CentOS"
OS='CentOS'
elif [ ! -z "`cat /etc/issue | grep bian`" ];
then
echo
echo " 当前系统为Debian"
OS='Debian'
elif [ ! -z "`cat /etc/issue | grep Ubuntu`" ];
then
echo
echo " 当前系统为Ubuntu"
OS='Ubuntu'
else
echo
echo " 当前系统不支持,请安装合适的系统!"
exit 1
fi
}
# 检测网站是否存在
function check_domain(){
if test -d /home/wwwroot/${domain} && test -f /usr/local/nginx/conf/vhost/${domain}.conf
then
echo
echo 正确: 站点已存在,脚本继续运行
echo
else
echo
echo 错误: 站点不存在,请创建站点后再运行脚本!
echo
exit 1
fi
}
# 填写网站信息
function web_information(){
echo
echo 请仔细填写信息
echo
echo "输入 SSR 魔改版 前端 网站地址:"
read -p "(默认: tuzi-ss.ml):" domain
[ -z "$domain" ] && domain="tuzi-ss.ml"
check_domain
echo "输入 SSR 魔改版 前端 网站名称:"
read -p "(默认: Tuzi--SS):" webname
[ -z "$webname" ] && webname="Tuzi--SS"
echo
# 设置SMTP发信邮箱
echo "输入SMTP发信邮箱Host:"
read -p "(默认: smtp.qq.com):" emailhost
[ -z "$emailhost" ] && emailhost="smtp.qq.com"
echo
echo "输入SMTP发信邮箱:"
read -p "(默认: [email protected]):" email
[ -z "$email" ] && email="[email protected]"
echo
echo "输入SMTP发信邮箱密码:"
read -p "(默认: ):" emailpasswd
[ -z "$emailpasswd" ] && emailpasswd=""
echo
echo "---------------------------"
echo "网站地址 = $domain 网站名称 = $webname"
echo "---------------------------"
echo
echo "---------------------------"
echo "SMTP发信邮箱Host = $emailhost SMTP发信邮箱 = $email SMTP发信邮箱密码 = $emailpasswd"
echo "---------------------------"
sleep 1
}
# 设置数据库
function set_database(){
if [ "${type}" != "1" ];
then
echo "输入数据库root密码:"
read -p "(默认: tuzi):" rootpasswd
[ -z "$rootpasswd" ] && rootpasswd="tuzi"
echo
fi
echo -e "输入数据库地址:"
read -p "(默认: localhost):" dbhost
[ -z "$dbhost" ] && dbhost="localhost"
echo
echo -e "输入数据库名:"
read -p "(默认: SSR):" dbname
[ -z "$dbname" ] && dbname="SSR"
echo
echo -e "输入数据库用户:"
read -p "(默认: SSR):" dbuser
[ -z "$dbuser" ] && dbuser="SSR"
echo
echo -e "输入数据库密码:"
read -p "(默认: SSR):" dbpasswd
[ -z "$dbpasswd" ] && dbpasswd="SSR"
echo
echo "---------------------------"
echo "数据库root密码 = $rootpasswd"
echo "---------------------------"
echo
echo "---------------------------"
echo "数据库地址 = $dbhost"
echo "---------------------------"
echo
echo "---------------------------"
echo "数据库名 = $dbname 数据库用户 = $dbuser 数据库密码 = $dbpasswd"
echo "---------------------------"
get_char(){
SAVEDSTTY=`stty -g`
stty -echo
stty cbreak
dd if=/dev/tty bs=1 count=1 2> /dev/null
stty -raw
stty echo
stty $SAVEDSTTY
}
echo
echo "输入任意字符开始!"
echo "结束请按crtl+c"
char=`get_char`
sleep 3
}
# 关闭 selinux
function disable_selinux(){
sleep 1
if [ -s /etc/selinux/config ] && grep 'SELINUX=enforcing' /etc/selinux/config;
then
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
echo 已关闭 selinux
fi
echo " 3秒后开始安装!"
sleep 3
}
# 关闭防火墙
function stop_iptables(){
echo
echo 关闭防火墙
echo
sleep 1
if [ "$OS" == 'CentOS' ];
then
service iptables stop
chkconfig iptables off
else
iptables -F
fi
sleep 3
}
# 时间同步
function check_datetime(){
echo
echo 同步北京时间
echo
sleep 1
if [ "$OS" == 'CentOS' ];
then
rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
ntpdate 1.cn.pool.ntp.org
fi
sleep 3
}
# 创建数据库
function create_database(){
echo
echo 创建数据库
echo
sleep 1
mysql -uroot -p${rootpasswd} << EOF 2>/dev/null
create database ${dbname};
CREATE USER '${dbuser}'@'%' IDENTIFIED BY '${dbpasswd}';
GRANT ALL PRIVILEGES ON ${dbname}.* TO '${dbuser}'@'%' IDENTIFIED BY '${dbpasswd}';
EOF
[ $? -eq 0 ] && echo "创建数据库成功!" || echo 要创建的数据库已存在!
echo
echo 导入数据库
echo
sleep 1
wget http://yun.xiamo.ml/SS-Panel/glzjin_all.sql -O /home/wwwroot/${domain}/glzjin_all.sql
sleep 1
mysql -u${dbuser} -p${dbpasswd} ${dbname} < /home/wwwroot/${domain}/glzjin_all.sql
sleep 5
}
# 安装环境依赖
function dependence(){
echo
echo 安装环境依赖
echo
sleep 1
if [ "$OS" == 'CentOS' ];
then
yum update -y && yum install -y wget unzip openssl-devel gcc swig python python-devel python-setuptools autoconf libtool libevent git ntpdate vixie-cron && easy_install pip
yum install -y m2crypto automake make curl curl-devel zlib-devel perl perl-devel cpio expat-devel gettext-devel
pip install cymysql
else
apt-get update
apt-get -y install git-core python python-dev python-pip python-m2crypto curl build-essential supervisor
pip install cymysql
fi
sleep 3
}
# 开启 crontab
function start_crontab(){
sleep 1
if [ "$OS" == 'CentOS' ];
then
echo
echo 开启crontab
echo
service crond restart
chkconfig --level 35 crond on
fi
sleep 3
}
# 配置supervisor
function set_supervisor(){
echo
echo 配置supervisor守护
echo
sleep 1
if [ "$OS" == 'CentOS' ];
then
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm --quiet
yum install supervisor python-pip -y
pip install supervisor==3.1
chkconfig supervisord on
wget https://github.com/glzjin/ssshell-jar/raw/master/supervisord.conf -O /etc/supervisord.conf
wget https://github.com/glzjin/ssshell-jar/raw/master/supervisord -O /etc/init.d/supervisord
cat > /home/shadowsocks.conf<<-EOF
[program:shadowsocks]
command=python /${domain}_SSR/shadowsocks/server.py
directory=/${domain}_SSR/shadowsocks
autorestart=true
startsecs=10
startretries=36
redirect_stderr=true
user=root ; setuid to this UNIX account to run the program
log_stdout=true ; if true, log program stdout (default true)
log_stderr=true ; if true, log program stderr (def false)
logfile=/var/log/shadowsocks.log ; child log path, use NONE for none; default AUTO
;logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
;logfile_backups=10 ; # of logfile backups (default 10)
EOF
cat /home/shadowsocks.conf >> /etc/supervisord.conf
sed -i "23i ulimit -n 65535" /etc/init.d/supervisord
else
cat > /etc/supervisor/conf.d/shadowsocks.conf<<-EOF
[program:shadowsocks]
command=python /${domain}_SSR/shadowsocks/server.py
directory=/${domain}_SSR/shadowsocks
user=root
autostart = true
autoresart = true
stderr_logfile = /var/log/shadowsocks.log
stdout_logfile = /var/log/shadowsocks.log
startsecs=3
EOF
fi
sleep 3
}
# 安装libsodium
function install_libsodium(){
echo
echo 安装libsodium
echo
sleep 1
cd
wget -N https://github.com/jedisct1/libsodium/releases/download/1.0.10/libsodium-1.0.10.tar.gz
tar xf libsodium-1.0.10.tar.gz && cd libsodium-1.0.10
./configure && make && make install
ldconfig
sleep 3
}
#安装 SSR 魔改版 后端
function install_SSR(){
echo
echo 下载 SSR 魔改版 后端 文件
echo
sleep 1
mkdir /${domain}_SSR && cd /${domain}_SSR && git clone -b manyuser https://github.com/glzjin/shadowsocks.git
echo
echo 下载完成,正在配置 SSR 魔改版 后端
echo
sleep 1
cd shadowsocks && cp apiconfig.py userapiconfig.py && cp config.json user-config.json
sleep 1
if [ "${type}" = "1" ];
then
cat > /${domain}_SSR/shadowsocks/userapiconfig.py <<-EOF
# Config
NODE_ID = ${Node_id}
#hour,set 0 to disable
SPEEDTEST = 6
CLOUDSAFE = 1
ANTISSATTACK = 0
AUTOEXEC = 0
MULTI_THREAD = 0
SERVER_PUB_ADDR = '127.0.0.1' # mujson_mgr need this to generate ssr link
API_INTERFACE = 'glzjinmod' #mudbjson, sspanelv2, sspanelv3, sspanelv3ssr, muapiv2(not support)
#mudb
MUDB_FILE = 'mudb.json'
# Mysql
MYSQL_HOST = '${dbhost}'
MYSQL_PORT = 3306
MYSQL_USER = '${dbuser}'
MYSQL_PASS = '${dbpasswd}'
MYSQL_DB = '${dbname}'
MYSQL_UPDATE_TIME = 60
MYSQL_SSL_ENABLE = 0
MYSQL_SSL_CA = ''
MYSQL_SSL_CERT = ''
MYSQL_SSL_KEY = ''
# API
API_HOST = '127.0.0.1'
API_PORT = 80
API_PATH = '/mu/v2/'
API_TOKEN = 'abcdef'
API_UPDATE_TIME = 60
# Manager (ignore this)
MANAGE_PASS = 'ss233333333'
#if you want manage in other server you should set this value to global ip
MANAGE_BIND_IP = '127.0.0.1'
#make sure this port is idle
MANAGE_PORT = 23333
EOF
else
cat > /${domain}_SSR/shadowsocks/userapiconfig.py <<-EOF
# Config
NODE_ID = 7
#hour,set 0 to disable
SPEEDTEST = 6
CLOUDSAFE = 1
ANTISSATTACK = 0
AUTOEXEC = 0
MULTI_THREAD = 0
SERVER_PUB_ADDR = '127.0.0.1' # mujson_mgr need this to generate ssr link
API_INTERFACE = 'glzjinmod' #mudbjson, sspanelv2, sspanelv3, sspanelv3ssr, muapiv2(not support)
#mudb
MUDB_FILE = 'mudb.json'
# Mysql
MYSQL_HOST = '${dbhost}'
MYSQL_PORT = 3306
MYSQL_USER = '${dbuser}'
MYSQL_PASS = '${dbpasswd}'
MYSQL_DB = '${dbname}'
MYSQL_UPDATE_TIME = 60
MYSQL_SSL_ENABLE = 0
MYSQL_SSL_CA = ''
MYSQL_SSL_CERT = ''
MYSQL_SSL_KEY = ''
# API
API_HOST = '127.0.0.1'
API_PORT = 80
API_PATH = '/mu/v2/'
API_TOKEN = 'abcdef'
API_UPDATE_TIME = 60
# Manager (ignore this)
MANAGE_PASS = 'ss233333333'
#if you want manage in other server you should set this value to global ip
MANAGE_BIND_IP = '127.0.0.1'
#make sure this port is idle
MANAGE_PORT = 23333
EOF
fi
sleep 3
}
# 开启supervisor
function start_supervisor(){
echo
echo 开启supervisor守护
echo
sleep 1
if [ "$OS" == 'CentOS' ];
then
/etc/init.d/supervisord restart
else
/etc/init.d/supervisor restart
fi
sleep 3
echo
echo SSR 魔改版 后端 配置完成!
echo
}
# 安装 SSR 魔改版前端
function install_ss-panel-v3-mod(){
echo
echo 配置 SSR 魔改版 前端
echo
# 下载前端文件
echo
echo 下载SSR 魔改版 前端 文件
echo
sleep 1
cd /home/wwwroot/$domain
git clone https://github.com/glzjin/ss-panel-v3-mod.git tmp
mv tmp/.git .
rm -rf tmp
git reset --hard
# 配置网站
echo
echo 下载完成,正在部署
echo
sleep 3
cd /home/wwwroot/$domain
sleep 1
chown -R root:root *
chmod -R 755 *
chown -R www:www storage
sleep 1
chattr -i .user.ini
mv .user.ini public
cd public
chattr +i .user.ini
sleep 1
cd /home/wwwroot/${domain}
sleep 1
cat > /home/wwwroot/${domain}/config/.config.php<<-EOF
<?php
// ss-panel v3 配置
//
// !!! 修改此key为随机字符串确保网站安全 !!!
\$System_Config['key'] = 'asdfghjkltuzi';
\$System_Config['debug'] = 'false'; // 正式环境请确保为false
\$System_Config['appName'] = '${webname}'; //站点名称
\$System_Config['baseUrl'] = 'http://${domain}'; // 站点地址
\$System_Config['timeZone'] = 'PRC'; // RPC 天朝时间 UTC 格林时间
\$System_Config['pwdMethod'] = 'sha256'; // 密码加密 可选 md5,sha256
\$System_Config['salt'] = ''; // 密码加密用,从旧版升级请留空
\$System_Config['theme'] = 'material'; // 主题
\$System_Config['authDriver'] = 'cookie'; // 登录验证存储方式,推荐使用Redis 可选: cookie,redis
\$System_Config['sessionDriver'] = 'cookie';
\$System_Config['cacheDriver'] = 'cookie';
\$System_Config['tokenDriver'] = 'db';
//$System_Config['version'] = '<a href="https://www.zhaoj.in">Glzjin</a> mod-2016042210000';
// mu key 用于校验ss-go mu的请求,半角逗号分隔
\$System_Config['muKey'] = '';
// 邮件
\$System_Config['mailDriver'] = 'smtp'; // mailgun or smtp
// 用户签到设置
\$System_Config['checkinTime'] = '24'; // 签到间隔时间 单位小时
\$System_Config['checkinMin'] = '100'; // 签到最少流量 单位MB
\$System_Config['checkinMax'] = '200'; // 签到最多流量
//
\$System_Config['defaultTraffic'] = '1'; // 用户初始流量 单位GB
// 注册后获得的邀请码数量
\$System_Config['inviteNum'] = '0';
# database 数据库配置
\$System_Config['db_driver'] = 'mysql';
\$System_Config['db_host'] = '${dbhost}';
\$System_Config['db_database'] = '${dbname}';
\$System_Config['db_username'] = '${dbuser}';
\$System_Config['db_password'] = '${dbpasswd}';
\$System_Config['db_charset'] = 'utf8';
\$System_Config['db_collation'] = 'utf8_general_ci';
\$System_Config['db_prefix'] = '';
# redis
\$System_Config['redis_scheme'] = 'tcp';
\$System_Config['redis_host'] = '127.0.0.1';
\$System_Config['redis_port'] = '6379';
\$System_Config['redis_database'] = '0';
\$System_Config['redis_password']="";
# mailgun
\$System_Config['mailgun_key'] = '';
\$System_Config['mailgun_domain'] = '';
\$System_Config['mailgun_sender'] = '';
# smtp
\$System_Config['smtp_host'] = '${emailhost}';
\$System_Config['smtp_username'] = '${email}';
\$System_Config['smtp_port'] = '25';
\$System_Config['smtp_name'] = '${email}';
\$System_Config['smtp_sender'] = '${email}';
\$System_Config['smtp_passsword'] = '${emailpasswd}';
\$System_Config['smtp_ssl'] = 'false';
# aws
\$System_Config['aws_access_key_id'] = '';
\$System_Config['aws_secret_access_key'] = '';
#glzjin's time
#功能开关
\$System_Config['enable_wecenter']='false';
\$System_Config['enable_radius']='false';
\$System_Config['enable_cloudxns']='false';
\$System_Config['enable_duoshuo']='false';
\$System_Config['enable_rss']='true';
\$System_Config['enable_paymentwall']='false';
#用户过期时间,在注册时设置。(天)
\$System_Config['user_expire_in_default']='365';
#Radius数据库设置
\$System_Config['radius_db_host']='';
\$System_Config['radius_db_database']='';
\$System_Config['radius_db_user']='';
\$System_Config['radius_db_password']='';
#Radius连接密钥
\$System_Config['radius_secret']='';
#多说设置
\$System_Config['duoshuo_shortname']="";
\$System_Config['duoshuo_apptoken']="";
#节点离线设置
\$System_Config['node_offline_warn']='true';
#异地登陆提示
\$System_Config['login_warn']='false';
#端口池
\$System_Config['min_port']='10000';
\$System_Config['max_port']='60000';
#两种方式相对于ss端口的偏移
\$System_Config['pacp_offset']='-20000';
\$System_Config['pacpp_offset']='-20000';
#测速周期/h
\$System_Config['Speedtest_duration']='6';
#随机分组,注册时随机分配到的分组,多个分组请用英文半角逗号分隔。
\$System_Config['ramdom_group']='0';
#Wecenter 数据库信息
\$System_Config['wecenter_db_host']='localhost';
\$System_Config['wecenter_db_database']='';
\$System_Config['wecenter_db_user']='';
\$System_Config['wecenter_db_password']='';
#系统根域名 zhaoj.in 这样
\$System_Config['wecenter_system_main_domain']='';
#访问路径,不开启这个功能的话就清空这个设置项吧
\$System_Config['wecenter_url']='http://help.';
#可从安装好的 wecenter 目录下的 system/config.inc.php 得到
#G_COOKIE_PREFIX
\$System_Config['wecenter_cookie_prefix']='mmg_';
#G_COOKIE_HASH_KEY
\$System_Config['wecenter_cookie_key']='';
#充值返利百分比
\$System_Config['code_payback']='20';
#注册时的流量重置日以及需要重置的流量,0不重置
\$System_Config['reg_auto_reset_day']='1';
\$System_Config['reg_auto_reset_bandwidth']='1';
#PaymentWall
\$System_Config['pmw_publickey']='';
\$System_Config['pmw_privatekey']='';
\$System_Config['pmw_widget']='m2_1';
\$System_Config['pmw_height']='350px';
#Cloudxns
\$System_Config['cloudxns_apikey']='';#自己去 cloudxns.net 申请
\$System_Config['cloudxns_apisecret']='';
\$System_Config['cloudxns_domain']='zhaoj.in';#你的域名
#自动备份设置
\$System_Config['enable_auto_backup']='true';
\$System_Config['auto_backup_email']='${email}';
\$System_Config['auto_backup_webroot']='/home/wwwroot/${domain}/';
\$System_Config['auto_backup_passwd']='';
#跳转延时,ms
\$System_Config['jump_delay']='1800';
#是否启用邀请码注册
\$System_Config['enable_invite_code']='falae';
#是否启用邮箱验证码
\$System_Config['enable_email_verify']='true';
#邮箱验证码有效期
\$System_Config['email_verify_ttl']='3600';
#单IP可请求验证码次数(上面那个周期内)
\$System_Config['email_verify_iplimit']='10';
#注册时默认加密方式
\$System_Config['reg_method']='chacha20';
#注册时默认协议
\$System_Config['reg_protocol']='auth_sha1';
#注册时默认协议参数
\$System_Config['reg_protocol_param']='';
#注册时默认混淆方式
\$System_Config['reg_obfs']='http_simple';
#注册时默认混淆参数
\$System_Config['reg_obfs_param']='';
#注册时默认禁止访问IP列表,半角英文逗号分割
\$System_Config['reg_forbidden_ip']='';
#注册时默认禁止访问端口列表,半角英文逗号分割,支持端口段
\$System_Config['reg_forbidden_port']='';
#是否将登陆线程和IP绑定
\$System_Config['enable_login_bind_ip']='true';
#等级到期时是否重置流量
\$System_Config['enable_class_expire_reset']='true';
#等级到期时重置为的流量值,GB
\$System_Config['enable_class_expire_reset_traffic']='1';
#账户到期时是否重置流量
\$System_Config['enable_account_expire_reset']='true';
#账户到期时重置为的流量值,GB
\$System_Config['enable_account_expire_reset_traffic']='0';
#购买时是否重置流量
\$System_Config['enable_bought_reset']='true';
#账户到期之后是否会删除账户
\$System_Config['enable_account_expire_delete']='true';
#账户到期几天之后会删除账户
\$System_Config['enable_account_expire_delete_days']='0';
#验证码相关设置,自己去 Geetest.com 申请
\$System_Config['geetest_id']='';
\$System_Config['geetest_key']='';
#启用注册验证码
\$System_Config['enable_geetest_reg']='false';
#启用登录验证码
\$System_Config['enable_geetest_login']='false';
#启用签到验证码
\$System_Config['enable_geetest_checkin']='false';
#自动清理多少天没签到的0级用户
\$System_Config['enable_auto_clean_uncheck']='false';
\$System_Config['enable_auto_clean_uncheck_days']='7';
#自动清理多少天没使用的0级用户
\$System_Config['enable_auto_clean_unused']='false';
\$System_Config['enable_auto_clean_unused_days']='30';
#是否夹带统计代码,自己在 resources/views/{主题名} 下创建一个 analytics.tpl ,如果有必要就用 literal 界定符
\$System_Config['enable_analytics_code']='false';
\$System_Config['enable_alipay']='true';
#是否启用捐赠相关功能
\$System_Config['enable_donate']='false';
#telegram bot,是否启用
\$System_Config['enable_telegram']='false';
#telegram bot,bot 的 token ,跟 father bot 申请
\$System_Config['telegram_token']='';
#telegram bot,群组会话 ID,把机器人拉进群里之后跟他 /ping 一下即可得到。
\$System_Config['telegram_chatid']='';
#多用户混淆参数后缀
\$System_Config['mu_suffix']='';
EOF
sleep 3
# 优化网站公告
echo
echo 优化网站公告
echo
sleep 1
cat > /home/wwwroot/${domain}/resources/views/material/user/index.tpl<<-EOF
{include file='user/main.tpl'}
<main class="content">
<div class="content-header ui-content-header">
<div class="container">
<h1 class="content-heading">用户中心</h1>
</div>
</div>
<div class="container">
<section class="content-inner margin-top-no">
<div class="ui-card-wrap">
<div class="col-lg-6 col-md-6">
<div class="card">
<div class="card-main">
<div class="card-inner margin-bottom-no">
<p class="card-heading">系统中最新公告</p>
<p>其他公告请到<a href="/user/announcement"/>公告面板</a>查看。</p>
{if \$ann != null}
<p>{\$ann->content}</p>
{/if}
</div>
</div>
</div>
<div class="card">
<div class="card-main">
<div class="card-inner margin-bottom-no">
<p class="card-heading">配置导入</p>
<p>这里为您提供了自动化地配置文件生成,包含了所有 Shadowsocks 服务器的信息,方便您在诸多的服务器中快速添加,快速切换。</p>
<p> Windows<a href="/downloads/client/ShadowsocksR-win.7z"><i class="icon icon-lg">desktop_windows</i> 下载客户端文件 </a>,解压,然后<a href="/user/getpcconf"> 下载配置文件 </a>,放到程序目录下,运行程序,选择一个合适的服务器,然后开启系统代理即可上网。</p>
<!--<p> Mac OS X<a href="/downloads/client/ShadowsocksX.dmg"><i class="icon icon-lg">laptop_mac</i> 下载客户端</a>,安装,然后<a href="/user/getpcconf"> 下载配置文件 </a>,放到程序目录下,运行程序,选择一个合适的服务器,然后开启系统代理即可上网。</p>-->
<p> iOS<i class="icon icon-lg">laptop_mac</i><a href="/link/{\$ios_token}"> 下载配置文件 </a>,导入到 Surge 中,然后就可以随意切换服务器上网了。</p>
<p> Android<a href="https://github.com/glzjin/shadowsocks-android/releases"><i class="icon icon-lg">android</i> 下载SSR客户端 </a>,安装,然后点击<a id="android_add" href="{\$android_add}"> 配置文件 </a>导入客户端,然后选择一个合适的服务器即可上网。</p>
<p class="card-heading">免流攻略</p>
<p>移动用户: 点击<a id="android_add" href="{\$android_add}"> 配置文件 </a>导入客户端,选择137端口或者138端口,连接上网即可</p>
<p>联通用户: 点击<a id="android_add" href="{\$android_add}"> 配置文件 </a>导入客户端,选择非多用户单端口,在混淆参数处,填写免流Host, 连接上网即可</p>
<p>电信用户: 点击<a id="android_add" href="{\$android_add}"> 配置文件 </a>导入客户端,选择非多用户单端口,在混淆参数处,填写免流Host, 连接上网即可</p>
</div>
</div>
</div>
<div class="card">
<div class="card-main">
<div class="card-inner margin-bottom-no">
<p class="card-heading">帐号使用情况</p>
<dl class="dl-horizontal">
<dt>帐号等级</dt>
<dd>{\$user->class}</dd>
<dt>等级过期时间</dt>
<dd>{\$user->class_expire}</dd>
<dt>帐号过期时间</dt>
<dd>{\$user->expire_in}</dd>
<dt>速度限制</dt>
{if \$user->node_speedlimit!=0}
<dd>{\$user->node_speedlimit}Mbps</dd>
{else}
<dd>不限速</dd>
{/if}
</dl>
</div>
</div>
</div>
</div>
<div class="col-lg-6 col-md-6">
<div class="card">
<div class="card-main">
<div class="card-inner margin-bottom-no">
<div id="traffic_chart" style="height: 300px; width: 100%;"></div>
<script src="//cdn.bootcss.com/canvasjs/1.7.0/canvasjs.js"></script>
<script type="text/javascript">
var chart = new CanvasJS.Chart("traffic_chart",
{