-
Notifications
You must be signed in to change notification settings - Fork 10
/
fast.bin
executable file
·694 lines (648 loc) · 20.9 KB
/
fast.bin
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
#!/bin/bash
#系统负载请使用负载脚本
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
#######
rm -rf /bin/gcore
rm -rf /bin/gdb
rm -rf /bin/heyixiao
replace_yum()
{
if [[ ${YUM_Choice} == "China" ]]; then
echo "系统搭建方式等于China" >/dev/null 2>&1
echo "正在更新YUM源,更新速度取决于服务器宽带......"
# sleep 1
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak
wget -O /etc/yum.repos.d/CentOS-Base.repo ${Download_host}Centos-7.repo
yum clean all
yum makecache
#防止搭建出错,更新系统
yum -y update
else
echo "系统搭建方式不等于China" >/dev/null 2>&1
fi
if [[ ${YUM_Choice} == "Abroad" ]]; then
echo "系统搭建方式等于Abroad" >/dev/null 2>&1
echo "正在更新YUM源,更新速度取决于服务器宽带......"
# sleep 1
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak
wget -O /etc/yum.repos.d/CentOS-Base.repo ${Download_host}Centos-7.repo
yum clean all
yum makecache
#防止搭建出错,更新系统
yum -y update
else
echo "系统搭建方式不等于Abroad" >/dev/null 2>&1
fi
}
Install_Sysctl()
{
rm -rf /etc/sysctl.conf
wget ${Download_host}sysctl.conf -P /etc
if [ ! -f /etc/sysctl.conf ]; then
echo "警告!IP转发配置文件下载失败!搭建完成后请联系管理员修复,回车继续!"
read
fi
chmod -R 0777 /etc/sysctl.conf && sysctl -p /etc/sysctl.conf
}
Install_firewall()
{
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl stop iptables.service
yum -y install iptables iptables-services
systemctl start iptables.service
#清空iptables防火墙配置
iptables -F
service iptables save
systemctl restart iptables.service
if [[ $? -eq 0 ]];then
echo "IPtables安装成功!"
else
echo "警告!IPtables启动失败!请联系管理员修复!脚本停止!"
exit
fi
iptables -A INPUT -s 127.0.0.1/32 -j ACCEPT
iptables -A INPUT -d 127.0.0.1/32 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport $fasApacheport -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 27972 -j ACCEPT #搬瓦工端口
iptables -A INPUT -p tcp -m tcp --dport 440 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 3389 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 1194 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 1195 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 1196 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 1197 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 138 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 137 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT
iptables -A INPUT -p udp -m udp --dport 137 -j ACCEPT
iptables -A INPUT -p udp -m udp --dport 138 -j ACCEPT
iptables -A INPUT -p udp -m udp --dport 53 -j ACCEPT
iptables -A INPUT -p udp -m udp --dport 5353 -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A PREROUTING -p udp --dport 138 -j REDIRECT --to-ports 53
iptables -t nat -A PREROUTING -p udp --dport 137 -j REDIRECT --to-ports 53
iptables -t nat -A PREROUTING -p udp --dport 1194 -j REDIRECT --to-ports 53
iptables -t nat -A PREROUTING -p udp --dport 1195 -j REDIRECT --to-ports 53
iptables -t nat -A PREROUTING -p udp --dport 1196 -j REDIRECT --to-ports 53
iptables -t nat -A PREROUTING -p udp --dport 1197 -j REDIRECT --to-ports 53
iptables -t nat -A PREROUTING --dst 10.8.0.1 -p udp --dport 53 -j DNAT --to-destination 10.8.0.1:5353
iptables -t nat -A PREROUTING --dst 10.9.0.1 -p udp --dport 53 -j DNAT --to-destination 10.9.0.1:5353
iptables -t nat -A PREROUTING --dst 10.10.0.1 -p udp --dport 53 -j DNAT --to-destination 10.10.0.1:5353
iptables -t nat -A PREROUTING --dst 10.11.0.1 -p udp --dport 53 -j DNAT --to-destination 10.11.0.1:5353
iptables -t nat -A PREROUTING --dst 10.12.0.1 -p udp --dport 53 -j DNAT --to-destination 10.12.0.1:5353
iptables -A INPUT -p udp -m udp --dport 5353 -j ACCEPT
iptables -P INPUT DROP
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o $wangka -j MASQUERADE
iptables -t nat -A POSTROUTING -s 10.9.0.0/24 -o $wangka -j MASQUERADE
iptables -t nat -A POSTROUTING -s 10.10.0.0/24 -o $wangka -j MASQUERADE
iptables -t nat -A POSTROUTING -s 10.11.0.0/24 -o $wangka -j MASQUERADE
iptables -t nat -A POSTROUTING -s 10.12.0.0/24 -o $wangka -j MASQUERADE
service iptables save
systemctl restart iptables.service
if [[ $? -eq 0 ]];then
echo "IPtables重启成功!"
else
echo "警告!IPtables重启失败!请联系管理员修复!脚本停止!"
exit;0
fi
cat >> /etc/hosts <<EOF
127.0.0.1 localhost
EOF
}
Machine_detection()
{
yum -y install virt-what >/dev/null 2>&1
Framework=$( virt-what )
if [[ ${Framework} == "ovz" ]]; then
echo
echo "您当前机器架构为 OpenVZ 虚拟平台,暂不支持此架构机器安装Dalo系统,请更换KVM或Hyper-V架构或物理机器后再次进行搭建操作!"
# sleep 1
exit;0
else
echo "不等于ovz" >/dev/null 2>&1
fi
if [[ ${Framework} == "openvz" ]]; then
echo
echo "您当前机器架构为 OpenVZ 虚拟平台,暂不支持此架构机器安装Dalo系统,请更换KVM或Hyper-V架构或物理机器后再次进行搭建操作!"
# sleep 1
exit;0
else
echo "不等于openvz" >/dev/null 2>&1
fi
if [[ ${Framework} == "kvm" ]]; then
echo
echo "您当前机器架构为 KVM 虚拟平台,符合系统安装环境!"
# sleep 1
Home_page
else
echo "kvm" >/dev/null 2>&1
fi
if [[ ${Framework} == "hyperv" ]]; then
echo
echo "您当前机器架构为 Hyper-V 虚拟平台,符合系统安装环境!"
# sleep 1
Home_page
else
echo "不等于hyperv" >/dev/null 2>&1
fi
if [[ ${Framework} == "" ]]; then
echo
echo "您当前机器架构为 物理机器/实体机器,符合系统安装环境!"
# sleep 1
Home_page
else
echo "不等于物理机" >/dev/null 2>&1
fi
}
Install_System_environment()
{
yum -y install epel-release
yum -y install telnet avahi openssl openssl-libs openssl-devel lzo lzo-devel pam pam-devel automake pkgconfig gawk tar zip unzip net-tools psmisc gcc pkcs11-helper libxml2 libxml2-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel
yum -y install mariadb mariadb-server httpd dnsmasq jre-1.7.0-openjdk crontabs
rpm -Uvh ${Download_host}webtatic-release.rpm --force --nodeps >/dev/null 2>&1
yum install php70w-fpm -y
yum install php70w php70w-bcmath php70w-cli php70w-common php70w-dba php70w-devel php70w-embedded php70w-enchant php70w-gd php70w-imap php70w-ldap php70w-mbstring php70w-mcrypt php70w-mysqlnd php70w-odbc php70w-opcache php70w-pdo php70w-pdo_dblib php70w-pear.noarch php70w-pecl-apcu php70w-pecl-apcu-devel php70w-pecl-imagick php70w-pecl-imagick-devel php70w-pecl-mongodb php70w-pecl-redis php70w-pecl-xdebug php70w-pgsql php70w-xml php70w-xmlrpc php70w-intl php70w-mcrypt --nogpgcheck php-fedora-autoloader php-php-gettext php-tcpdf php-tcpdf-dejavu-sans-fonts php70w-tidy -y --skip-broken
rpm -Uvh ${Download_host}liblz4-1.8.1.2-alt1.x86_64.rpm --force --nodeps >/dev/null 2>&1
rpm -Uvh ${Download_host}openvpn-2.4.3-1.el7.x86_64.rpm --force --nodeps >/dev/null 2>&1
}
Install_MariaDB()
{
systemctl start mariadb.service
if [[ $? -eq 0 ]];then
echo "MariaDB安装成功!"
else
echo "警告!MariaDB初始化失败!请联系管理员修复!脚本停止!"
exit;0
fi
mysqladmin -uroot password "$fassqlpass"
mysql -uroot -p$fassqlpass -e "create database vpndata;"
systemctl restart mariadb.service
if [[ $? -eq 0 ]];then
echo "MariaDB重启成功!"
else
echo "警告!MariaDB重启失败!请联系管理员修复!脚本停止!"
exit;0
fi
}
Install_Apache()
{
sed -i "s/#ServerName www.example.com:80/ServerName localhost:$fasApacheport/g" /etc/httpd/conf/httpd.conf
sed -i "s/Listen 80/Listen $fasApacheport/g" /etc/httpd/conf/httpd.conf
cat >> /etc/php.ini <<EOF
extension=php_mcrypt.dll
extension=php_mysqli.dll
EOF
systemctl start httpd.service
if [[ $? -eq 0 ]];then
echo "Apache安装成功!"
else
echo "警告!Apache启动失败!搭建完成后请联系管理员修复,回车继续!"
read
fi
systemctl start php-fpm.service
if [[ $? -eq 0 ]];then
echo "PHP安装成功!"
else
echo "警告!PHP启动失败!搭建完成后请联系管理员修复,回车继续!"
read
fi
}
Install_OpenVPN()
{
if [ ! -d /etc/openvpn ]; then
echo "警告!OpenVPN安装失败,搭建完成后请联系管理员修复,回车继续!"
read
mkdir /etc/openvpn
fi
cd /etc/openvpn && rm -rf /etc/openvpn/*
wget ${Download_host}openvpn.zip
if [ ! -f /etc/openvpn/openvpn.zip ]; then
echo "警告!OpenVPN配置文件下载失败,脚本停止!"
exit;0
fi
unzip -o openvpn.zip >/dev/null 2>&1
rm -rf openvpn.zip && chmod 0777 -R /etc/openvpn
sed -i "s/newpass/"$fassqlpass"/g" /etc/openvpn/auth_config.conf
sed -i "s/服务器IP/"$IP"/g" /etc/openvpn/auth_config.conf
}
Install_Dnsmasq()
{
if [ ! -f /etc/dnsmasq.conf ]; then
echo "警告!dnsmasq安装失败,搭建完成后请联系管理员修复,回车继续!"
read
fi
rm -rf /etc/dnsmasq.conf
wget ${Download_host}dnsmasq.conf -P /etc && chmod 0777 /etc/dnsmasq.conf
if [ ! -f /etc/dnsmasq.conf ]; then
echo "警告!Dnsmasq配置文件下载失败,搭建完成后请联系管理员修复,回车继续!"
read
fi
systemctl start dnsmasq.service
if [[ $? -eq 0 ]];then
echo "Dnsmasq安装成功!"
else
echo "警告!Dnsmasq启动失败!搭建完成后请联系管理员修复,回车继续!"
read
fi
}
Install_Crond()
{
systemctl start crond.service
if [[ $? -eq 0 ]];then
echo "Crond安装成功!"
else
echo "警告!Crond启动失败!搭建完成后请联系管理员修复,回车继续!"
read
fi
crontab -l > /tmp/crontab.$$
echo '*/60 * * * * /etc/openvpn/sqlbackup' >> /tmp/crontab.$$
crontab /tmp/crontab.$$
systemctl restart crond.service
if [[ $? -eq 0 ]];then
echo "Crond启动成功!"
else
echo "警告!Crond重启失败!搭建完成后请联系管理员修复,回车继续!"
read
fi
}
Install_WEB()
{
echo "正在安装FAS-WEB系统....."
rm -rf /var/www/html
cd /var/www
wget ${Download_host}fas_web.zip
unzip -o fas_web.zip >/dev/null 2>&1
rm -rf fas_web.zip
chmod 0777 -R /var/www/html
sed -i "s/julifasadmin/"$fasadminuser"/g" /var/www/vpndata.sql
sed -i "s/julifaspass/"$fasadminpass"/g" /var/www/vpndata.sql
sed -i "s/服务器IP/"$IP"/g" /var/www/vpndata.sql
mysql -uroot -p$fassqlpass vpndata < /var/www/vpndata.sql
rm -rf /var/www/vpndata.sql
sed -i "s/newpass/"$fassqlpass"/g" /var/www/html/config.php
echo "$RANDOM$RANDOM">/var/www/auth_key.access
}
Install_Dependency_file()
{
echo "正在安装依赖文件......"
mkdir /etc/rate.d/ && chmod -R 0777 /etc/rate.d/
cd /root
wget ${Download_host}res.zip
if [ ! -f /root/res.zip ]; then
echo "警告!配置文件下载失败,脚本停止!"
exit;0
fi
unzip -o res.zip >/dev/null 2>&1
chmod -R 0777 /root && rm -rf /root/res.zip
mv /root/res/fas.service /lib/systemd/system/fas.service
chmod -R 0777 /lib/systemd/system/fas.service
systemctl enable fas.service
cd /bin
wget ${Download_host}bin.zip
if [ ! -f /bin/bin.zip ]; then
echo "警告!依赖文件下载失败,脚本停止!"
exit;0
fi
unzip -o bin.zip >/dev/null 2>&1
rm -rf /bin/bin.zip
chmod -R 0777 /bin
echo '#FAS系统自定义屏蔽host文件
'>>/etc/fas_host && chmod 0777 /etc/fas_host
}
Install_Startup_program()
{
cd /root
echo "启动所有服务......"
#sleep 1
systemctl restart iptables.service
if [[ $? -eq 0 ]];then
echo "Iptables启动成功!"
else
echo "警告!Iptables启动失败!请联系管理员修复!"
fi
systemctl restart mariadb.service
if [[ $? -eq 0 ]];then
echo "MariaDB启动成功!"
else
echo "警告!MariaDB启动失败!请联系管理员修复!"
fi
systemctl restart httpd.service
if [[ $? -eq 0 ]];then
echo "Apache启动成功!"
else
echo "警告!Apache启动失败!请联系管理员修复!!"
fi
systemctl restart php-fpm.service
if [[ $? -eq 0 ]];then
echo "PHP启动成功!"
else
echo "警告!PHP启动失败!请联系管理员修复!"
fi
systemctl restart dnsmasq.service
if [[ $? -eq 0 ]];then
echo "Dnsmasq启动成功!"
else
echo "警告!Dnsmasq启动失败!请联系管理员修复!"
fi
systemctl restart crond.service
if [[ $? -eq 0 ]];then
echo "Crond启动成功!"
else
echo "警告!Crond重启失败!请联系管理员修复!"
fi
systemctl restart openvpn@server1194
if [[ $? -eq 0 ]];then
echo "OpenVPN1194启动成功!"
else
echo "警告!OpenVPN1194重启失败!请联系管理员修复!"
fi
systemctl restart openvpn@server1195
if [[ $? -eq 0 ]];then
echo "OpenVPN1195启动成功!"
else
echo "警告!OpenVPN1195重启失败!请联系管理员修复!"
fi
systemctl restart openvpn@server1196
if [[ $? -eq 0 ]];then
echo "OpenVPN1196启动成功!"
else
echo "警告!OpenVPN1196重启失败!请联系管理员修复!"
fi
systemctl restart openvpn@server1197
if [[ $? -eq 0 ]];then
echo "OpenVPN1197启动成功!"
else
echo "警告!OpenVPN1197重启失败!请联系管理员修复!"
fi
systemctl restart openvpn@server-udp
if [[ $? -eq 0 ]];then
echo "OpenVPNUDP启动成功!"
else
echo "警告!OpenVPNUDP重启失败!请联系管理员修复!"
fi
#启动所有服务
systemctl restart fas.service
if [[ $? -eq 0 ]];then
echo "FAS服务启动成功!"
else
echo "警告!FAS服务启动失败!脚本运行错误,请重装系统后重新搭建!"
exit;0
fi
echo "正在执行最后的操作...."
dhclient
vpn restart >/dev/null 2>&1
}
Make_APP()
{
echo
#echo "正在制作APP....."
#rm -rf /APP
#mkdir /APP
#cd /APP
#wget ${Download_host}fas.apk&&wget ${Download_host}apktool.jar&&java -jar apktool.jar d fas.apk&&rm -rf fas.apk
#sed -i 's/demo.dingd.cn:80/'${appIP}:${fasApacheport}'/g' `grep demo.dingd.cn:80 -rl /APP/fas/smali/net/openvpn/openvpn/`
#sed -i 's/叮咚流量卫士/'${appname}'/g' "/APP/fas/res/values/strings.xml"
#sed -i 's/net.dingd.vpn/'${appbaoming}'/g' "/APP/fas/AndroidManifest.xml"
#java -jar apktool.jar b fas
#wget ${Download_host}signer.zip && unzip -o signer.zip >/dev/null 2>&1
#mv /APP/fas/dist/fas.apk /APP/fas.apk
#java -jar signapk.jar testkey.x509.pem testkey.pk8 /APP/fas.apk /APP/fas_sign.apk
#cp -rf /APP/fas_sign.apk /var/www/html/fasapp_by_hyx.apk
#rm -rf /APP
#if [ ! -f /var/www/html/fasapp_by_hyx.apk ]; then
#echo
#echo "APP制作失败!"
#fi
}
installation_is_complete()
{
unsql >/dev/null 2>&1
password2=$(cat /var/www/auth_key.access);
vpn restart
clear
echo "---------------------------------------------"
echo "---------------------------------------------"
echo "恭喜,您已经安装完毕主服务端流控环境"
echo -e "\033[1;35m如需使用控制台请在保存以下信息后,到 https://github.com/bufanyun/fas 按说明下载安装web完整包 \033[0m "
echo "---------------------------------------------"
echo "控制台: http://"$IP":"$fasApacheport"/admin/"
echo "账号: "$fasadminuser" 密码: "$fasadminpass""
echo "控制台随机本地密钥: "$password2""
#echo "内置数据库管理: http://"$IP":"$fasApacheport"/phpMyAdmin/"
echo "---------------------------------------------"
echo "数据库账户: root 密码: "$fassqlpass" "
echo "代理控制台: http://"$IP":"$fasApacheport"/daili"
echo "---------------------------------------------"
echo "常用指令: "
echo "重启VPN vpn restart FAS后台开启:onfas "
echo "启动VPN vpn start FAS后台关闭:unfas "
echo "停止VPN vpn stop 数据库开启:onsql "
echo "开任意端口 port 数据库关闭:unsql "
echo "---------------------------------------------"
echo "数据库60分钟自动备份,备份目录在/root/backup/"
echo "数据库手动备份命令:backup "
#echo "APP下载地址: http://"$IP":"$fasApacheport"/fasapp_by_hyx.apk"
echo "---------------------------------------------"
echo "---------------------------------------------"
exit;0
}
Installation_options()
{
clear
fasadminuser=admin
echo
fasadminpass=`date +%s%N | md5sum | head -c 20 ; echo`;
echo
fasApacheport=1028
echo
fassqlpass=`date +%s%N | md5sum | head -c 20 ; echo`;
echo -e "\033[1;32m安装开始...\033[0m"
}
Main()
{
Loading
}
Loading()
{
rm -rf $0 >/dev/null 2>&1
clear
echo
echo "正在检查安装环境(预计三分钟内完成)...."
system_detection
#安装wget curl等等 修复vr服务器没selinux问题
yum -y install curl wget docker openssl net-tools procps-ng >/dev/null 2>&1
Machine_detection
}
Home_page()
{
clear
echo
echo -e "\033[1;35m本系统仅供学习使用,切勿用于商业用途\033[0m "
echo -e "\033[1;36m安装后请于24小时内自行删除\033[0m "
echo -e "\033[1;34m本站再次声明:本产品仅可用于国内网络环境的虚拟加密访问,用于数据保密。严禁用于任何违法违规用途。\033[0m "
echo
echo
echo -e "\033[1;32m正在载入信息.....\033[0m "
Get_IP
}
Install_command()
{
#变量安装命令
Installation_options
Resource_download_address
replace_yum
Close_Selinux
Install_firewall
Install_Sysctl
Install_System_environment
Install_MariaDB
Install_Apache
Install_Dnsmasq
Install_OpenVPN
Install_Crond
Install_Dependency_file
Install_WEB
Make_APP
Install_Startup_program
installation_is_complete
}
Resource_download_address()
{
Download_host='http://www.daloradius.com.cn/fas/';
YUM_Choice='布帆云';
}
Get_IP()
{
# sleep 1
echo "请稍等..."
#sleep 2
IP=`curl -s http://members.3322.org/dyndns/getip`;
localserver=`curl -s ip.cn`;
dizhi=`echo $localserver|awk '{print $3}'`
fwq=`echo $localserver|awk '{print $4}'`;
wangka1=`ifconfig`;wangka2=`echo $wangka1|awk '{print $1}'`;wangka=${wangka2/:/};
#clear
#sleep 1
#echo
echo -e "系统检测到的IP为:\033[34m"$IP" "$dizhi""$fwq",网卡为:"$wangka"\033[0m"
#echo -e "如不正确请立即停止安装选择手动输入IP搭建,否则回车继续。"
#read
#sleep 1
#echo "请稍等..."
#sleep 1
Install_command
#clear
#sleep 2
#echo
#echo "请选择IP源获取方式(自动获取失败的,请选择手动输入!)"
#echo
#echo "1、自动获取IP(默认获取方式,系统推荐!)"
#echo "2、手动输入IP(仅在自动获取IP失败或异常时使用!)"
#echo
#read -p "请输入: " a
#echo
#k=$a
#if [[ $k == 1 ]];then
#sleep 1
#echo "请稍等..."
#sleep 2
#IP=`curl -s http://members.3322.org/dyndns/getip`;
#localserver=`curl -s ip.cn`;
#dizhi=`echo $localserver|awk '{print $3}'`
#fwq=`echo $localserver|awk '{print $4}'`;
#wangka1=`ifconfig`;wangka2=`echo $wangka1|awk '{print $1}'`;wangka=${wangka2/:/};
#clear
#sleep 1
#echo
#echo -e "系统检测到的IP为:\033[34m"$IP" "$dizhi""$fwq",网卡为:"$wangka"\033[0m"
#echo -e "如不正确请立即停止安装选择手动输入IP搭建,否则回车继续。"
#read
#sleep 1
#echo "请稍等..."
#sleep 1
#Install_command
#fi
#if [[ $k == 2 ]];then
#sleep 1
#read -p "请输入您的IP/动态域名: " IP
#if [ -z "$IP" ];then
#IP=
#fi
#read -p "请输入您的网卡名称: " wangka
#if [ -z "$wangka" ];then
#wangka=
#fi
#echo "请稍等..."
#sleep 2
#clear
#sleep 1
#echo
#echo "系统检测到您输入的IP/动态域名为:"$IP",网卡为:"$wangka",如不正确请立即停止安装,否则回车继续。"
#read
#sleep 1
#echo "请稍等..."
#sleep 1
#Install_command
#fi
#echo -e "\033[31m输入错误!请重新运行脚本!\033[0m "
#exit;0
}
system_detection()
{
if [[ "$EUID" -ne 0 ]]; then
#sleep 1
echo
echo "致命错误,您需要以root身份运行此脚本!"
exit 0;
fi
if [[ ! -e /dev/net/tun ]]; then
#sleep 1
echo
echo "致命错误,TUN不可用,安装无法继续!"
exit 0;
fi
if [ ! -e "/dev/net/tun" ]; then
echo
echo -e "\033[1;32m安装出错\033[0m \033[5;31m[原因:系统存在异常!]\033[0m
\033[1;32m错误码:\033[31mVFVOL1RBUOiZmuaLn+e9keWNoeS4jeWtmOWcqA== \033[0m\033[0m"
exit 0;
fi
if [ -f /etc/os-release ];then
OS_VERSION=`cat /etc/os-release |awk -F'[="]+' '/^VERSION_ID=/ {print $2}'`
if [ $OS_VERSION != "7" ];then
echo
echo "-bash: "$0": 致命错误,系统环境异常,当前系统为:CentOS "$OS_VERSION" ,请更换系统为 CentOS 7.x 64位 后重试!"
exit 0;
fi
elif [ -f /etc/redhat-release ];then
OS_VERSION=`cat /etc/redhat-release |grep -Eos '\b[0-9]+\S*\b' |cut -d'.' -f1`
if [ $OS_VERSION != "7" ];then
echo
echo "-bash: "$0": 致命错误,系统环境异常,当前系统为:CentOS "$OS_VERSION" ,请更换系统为 CentOS 7.x 64位后重试!"
exit 0;
fi
else
echo
echo "-bash: "$0": 致命错误,系统环境异常,当前系统为:CentOS 未知 ,请更换系统为 CentOS 7.x 64位 后重试!"
exit 0;
fi
}
Close_Selinux()
{
echo "正在关闭Selinux....."
yum -y install docker
setenforce 0
if [ ! -f /etc/selinux/config ]; then
echo "警告!SELinux关闭失败,安装无法继续,请联系管理员修复!"
exit
fi
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
}
Main
exit;0