-
Notifications
You must be signed in to change notification settings - Fork 75
/
BARRACUDA.sh.txt
executable file
·594 lines (517 loc) · 12.4 KB
/
BARRACUDA.sh.txt
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
#!/bin/bash
###----------------------------------------###
###
### Barracuda Aegir Installer
###
### Copyright (C) 2010-2024 Omega8.cc
### [email protected] www.omega8.cc
###
### This program is free software. You can
### redistribute it and/or modify it under
### the terms of the GNU GPL as published by
### the Free Software Foundation, version 2
### or later.
###
### This program is distributed in the hope
### that it will be useful, but WITHOUT ANY
### WARRANTY; without even the implied
### warranty of MERCHANTABILITY or FITNESS
### FOR A PARTICULAR PURPOSE. See the GNU GPL
### for more details.
###
### You should have received a copy of the
### GNU GPL along with this program.
### If not, see http://www.gnu.org/licenses/
###
### Code: https://github.com/omega8cc/boa
###
###----------------------------------------###
export PATH=/usr/local/bin:/usr/local/sbin:/opt/local/bin:/usr/bin:/usr/sbin:/bin:/sbin
export SHELL=/bin/bash
###
### Software versions
###
_ADMINER_VRN=4.8.1
_BZR_VRN=2.6.0
_CGP_VRN=master-22-07-2020
_CHIVE_VRN=1.3
_COMPOSER_VRN=2.8.2
_CSF_VRN=14.21
_CURL_VRN=8.10.1
_DB_SRC=repo.percona.com
###
###
_DRUSH_ELEVEN_VRN=11.6.0.9
_DRUSH_TEN_VRN=10.6.2.9
_DRUSH_EIGHT_VRN=8.4.12.9
_DRUSH_EIGHT_TEST_VRN=8.4.12-force
###
###
_GEOS_VRN=3.7.1
_GIT_VRN=2.45.2
_GOACCESS_VRN=1.7.1
_ICU_LEGACY_VRN=52_2
_ICU_MODERN_VRN=73-1
_IMAGE_MAGICK_VRN=7.1.1-7
_IMAGICK_OLD_VRN=3.1.2
_IMAGICK_VRN=3.7.0
_IONCUBE_VRN=13.3.1
_JETTY_7_VRN=7.6.17.v20150415
_JETTY_8_VRN=8.1.17.v20150415
_JETTY_9_VRN=9.2.16.v20160414
_JSMIN_PHP_LEGACY_VRN=2.0.1
_JSMIN_PHP_MODERN_VRN=3.1.0
_LIB_TIDY_VRN=5.2.0
_LIB_YAML_VRN=0.2.5
_LOGJ4_VRN=1.2.17
_LSHELL_VRN=0.10.7.1
_MAILPARSE_VRN=2.1.6
_NEW_RELIC_VRN=11.3.0.16
_NODE_VRN=v22.5.0
_MONGO_VRN=1.6.14
_MONGODB_VRN=1.2.5
_MSS_VRN=master-29-06-2024
_MYQUICK_VRN_FIVE=0.11.5-2
_MYQUICK_VRN_EIGHT=0.16.7-3
_MYSQLTUNER_VRN=1.9.4
_NGINX_VRN=1.27.2
_OPENSSH_VRN=9.9p1
_OPENSSL_LEGACY_VRN=1.0.2u
_OPENSSL_EOL_VRN=1.1.1w
_OPENSSL_MODERN_VRN=3.3.2
_PDNSD_VRN=1.2.9a
_PERCONA_5_7_VRN=5.7
_PERCONA_8_0_VRN=8.0
_PERCONA_8_3_VRN=8.3
_PERCONA_8_4_VRN=8.4
_PHP56_API=20131226
_PHP56_VRN=5.6.40
_PHP70_API=20151012
_PHP70_VRN=7.0.33
_PHP71_API=20160303
_PHP71_VRN=7.1.33
_PHP72_API=20170718
_PHP72_VRN=7.2.34
_PHP73_API=20180731
_PHP73_VRN=7.3.33
_PHP74_API=20190902
_PHP74_VRN=7.4.33
_PHP80_API=20200930
_PHP80_VRN=8.0.30
_PHP81_API=20210902
_PHP81_VRN=8.1.30
_PHP82_API=20220829
_PHP82_VRN=8.2.25
_PHP83_API=20230831
_PHP83_VRN=8.3.13
_PHP_APCU=5.1.23
_PHP_IGBINARY_THREE=3.2.15
_PHP_IGBINARY_TWO=2.0.8
_PHP_MCRYPT=1.0.6
_PHPREDIS_SIX_NEW_VRN=6.1.0
_PHPREDIS_SIX_VRN=6.0.2
_PHPREDIS_FIVE_VRN=5.3.7
_PHPREDIS_FOUR_VRN=4.3.0
_PHPREDIS_THREE_VRN=3.1.6
_PURE_FTPD_VRN=1.0.51
_PXC_VRN=1.4.16
_REDIS_FOUR_VRN=4.0.14
_REDIS_FIVE_VRN=5.0.9
_REDIS_SIX_VRN=6.2.7
_REDIS_SEVEN_VRN=7.0.15
_RUBY_VRN=3.3.4
_SLF4J_VRN=1.7.21
_SOLR_1_VRN=1.4.1
_SOLR_3_VRN=3.6.2
_SOLR_4_VRN=4.9.1
_SOLR_7_VRN=7.7.3
_TWIGC_VRN=1.24.0
_UNBOUND_VRN=1.21.1
_UPROGRESS_LEGACY_VRN=1.0.3.1
_UPROGRESS_SEVEN_VRN=2.0.1.6
_UPROGRESS_EIGHT_VRN=2.0.2
_VNSTAT_VRN=2.7
_WKHTMLTOX_VRN=12.6-1
_YAML_PHP_LEGACY_VRN=1.3.2
_YAML_PHP_SEVENO_VRN=2.1.0
_YAML_PHP_MODERN_VRN=2.2.3
_ZLIB_VRN=1.3.1
###
### Default variables
###
_CUSTOM_NAME="nginx"
_DRUSH_VERSION="${_DRUSH_EIGHT_VRN}"
_DRUSH_VERSION_TEST="${_DRUSH_EIGHT_TEST_VRN}"
_FORCE_REDIS_RESTART=NO
_LOC_OS_CODE=""
_PURGE_ALL_THISHTIP=NO
export _SMALLCORE7_V=7.101.1
export _DRUPAL7="drupal-${_SMALLCORE7_V}"
_SPINNER=NO
_THIS_DB_PORT=3306
if [ -n "${STY+x}" ]; then
_SPINNER=NO
fi
###
### Helper variables
###
_aptLiSys="/etc/apt/sources.list"
_barCnf="/root/.barracuda.cnf"
_bldPth="/opt/tmp/boa"
_crlGet="-L --max-redirs 3 -k -s --retry 9 --retry-delay 9 -A iCab"
_wgetGet="--max-redirect=3 --no-check-certificate -q --tries=9 --wait=9 --user-agent='iCab'"
_aptAllow="--allow-unauthenticated"
_aptYesUnth="-y ${_aptAllow}"
_filIncB="barracuda.sh.cnf"
_gitHub="https://github.com/omega8cc"
_gitLab="https://gitlab.com/omega8cc"
_libFnc="${_bldPth}/lib/functions"
_locCnf="${_bldPth}/aegir/conf"
_mtrInc="/var/aegir/config/includes"
_mtrNgx="/var/aegir/config/server_master/nginx"
_mtrTpl="/var/aegir/.drush/sys/provision/http/Provision/Config/Nginx"
_pthLog="/var/xdrago/log"
if [ ! -e "${_pthLog}" ] && [ -e "/var/xdrago_wait/log" ]; then
_pthLog="/var/xdrago_wait/log"
fi
_vBs="/var/backups"
###
### SA variables
###
_saCoreN="SA-CORE-2014-005"
_saCoreS="${_saCoreN}-D7"
_saIncDb="includes/database/database.inc"
_saPatch="/var/xdrago/conf/${_saCoreS}.patch"
###
### Avoid too many questions
###
export DEBIAN_FRONTEND=noninteractive
export APT_LISTCHANGES_FRONTEND=none
if [ -z "${TERM+x}" ]; then
export TERM=vt100
fi
###
### Clean pid files on exit
###
_clean_pid_exit() {
echo "REASON ${e} on $(date 2>&1)" >> /root/.barracuda.sh.exit.exceptions.log
[ -e "/run/boa_wait.pid" ] && rm -f /run/boa_wait.pid
[ -e "/run/boa_run.pid" ] && rm -f /run/boa_run.pid
service cron start &> /dev/null
exit 1
}
###
### Panic on missing include
###
_panic_exit() {
echo
echo " EXIT: Required lib file not available?"
echo " EXIT: $1"
echo " EXIT: Cannot continue"
echo " EXIT: Bye (0)"
echo
_clean_pid_exit _panic_exit_a
}
###
### Include default settings and basic functions
###
[ -r "${_vBs}/${_filIncB}" ] || _panic_exit "${_vBs}/${_filIncB}"
source "${_vBs}/${_filIncB}"
###
### Download helpers and libs
###
_download_helpers_libs
###
### Include shared functions
###
_FL="helper dns system sql redis nginx php jetty master xtra firewall hotfix"
for f in ${_FL}; do
[ -r "${_libFnc}/${f}.sh.inc" ] || _panic_exit "${f}"
source "${_libFnc}/${f}.sh.inc"
done
###
### Make sure we are running as root
###
_if_running_as_root_barracuda
###
### Welcome msg
###
echo " "
_msg "Skynet Agent v.${_X_VERSION} on $(dmidecode -s system-manufacturer 2>&1) welcomes you aboard!"
echo " "
sleep 3
###
### Early procedures
###
_normalize_ip_name_variables
_mode_detection
_check_exception_mycnf
_virt_detection
_os_detection
_os_detection_minimal
_if_rebuild_src_on_major_os_upgrade
_if_long_generate_on_major_os_upgrade
###
### Quick php-idle ON/OFF procedure only
###
_if_php_idle_on_off
###
### Packages install/update on init
###
_sources_list_update
_basic_packages_install_on_init
_more_packages_install_on_init
_run_aptitude_full_upgrade
###
### Misc checks
###
_check_boa_php_compatibility
_check_boa_version
if [ "${_CHECKS_REMOTE_REPOS}" = "YES" ]; then
_check_github_for_aegir_head_mode
_check_db_src
_check_git_repos
fi
_check_ip_hostname
_check_prepare_dirs_permissions
###
### Turn Off AppArmor temporarily while running barracuda
###
if [ "${_OS_CODE}" = "stretch" ] || [ "${_OS_CODE}" = "jessie" ]; then
[ ! -e "/root/.turn_off_apparmor_in_octopus.cnf" ] && touch /root/.turn_off_apparmor_in_octopus.cnf
else
_turn_off_apparmor_temporarily
fi
###
### Optional major system upgrades
###
_early_sys_ctrl_mark
_if_post_major_os_upgrade
_if_major_os_upgrade
_normal_sys_ctrl_mark
###
### Upgrade only Aegir Master Instance (obsolete mode)
###
if [ "${_ALLOW_HEAVY_REBUILDS}" = "YES" ]; then
_if_upgrade_only_aegir_master
fi
###
### System packages install and update
###
_sys_packages_update
_if_proxysql_update
_sys_packages_install
_java_check_fix
_locales_check_fix
###
### Do not allow strong passwords until locales work properly
###
if [ "${_LOCALE_TEST}" = "BROKEN" ]; then
_STRONG_PASSWORDS=NO
fi
###
### Install key packages first
###
_run_aptitude_full_upgrade
_run_aptitude_deps_install
_kill_nash
###
### OpenSSL modern and legacy support
###
_LC_SSL_CTRL="/root/.install.legacy.openssl.cnf"
_MD_SSL_CTRL="/root/.install.modern.openssl.cnf"
if [ "${_STATUS}" = "INIT" ] || [ ! -x "/usr/local/ssl/bin/openssl" ]; then
if [ -e "${_MD_SSL_CTRL}" ]; then
chattr -i ${_MD_SSL_CTRL}
rm -f ${_MD_SSL_CTRL}
fi
touch ${_LC_SSL_CTRL}
_if_ssl_install_src
_ssl_paths_sync
_ssl_crypto_lib_fix
_curl_install_src
fi
if [ -x "/usr/local/ssl/bin/openssl" ]; then
[ -e "${_LC_SSL_CTRL}" ] && rm -f ${_LC_SSL_CTRL}
fi
if [ "${_STATUS}" = "INIT" ] || [ ! -x "/usr/local/ssl3/bin/openssl" ]; then
if [ ! -e "${_LC_SSL_CTRL}" ]; then
if [ ! -e "${_MD_SSL_CTRL}" ]; then
touch ${_MD_SSL_CTRL}
chattr +i ${_MD_SSL_CTRL}
fi
fi
elif [ "${_STATUS}" = "UPGRADE" ]; then
if [ ! -e "/opt/php73/bin/php" ] \
&& [ ! -e "/opt/php72/bin/php" ] \
&& [ ! -e "/opt/php71/bin/php" ] \
&& [ ! -e "/opt/php70/bin/php" ] \
&& [ ! -e "/opt/php56/bin/php" ]; then
if [ ! -e "${_MD_SSL_CTRL}" ] \
&& [ ! -e "${_LC_SSL_CTRL}" ]; then
touch ${_MD_SSL_CTRL}
chattr +i ${_MD_SSL_CTRL}
fi
fi
if [ ! -x "/usr/local/ssl/bin/openssl" ] \
&& [ -e "${_LC_SSL_CTRL}" ]; then
if [ -e "${_MD_SSL_CTRL}" ]; then
chattr -i ${_MD_SSL_CTRL}
rm -f ${_MD_SSL_CTRL}
fi
fi
fi
if [ -x "/usr/local/ssl/bin/openssl" ] \
&& [ -x "/usr/local/ssl3/bin/openssl" ]; then
if [ ! -e "${_MD_SSL_CTRL}" ]; then
touch ${_MD_SSL_CTRL}
chattr +i ${_MD_SSL_CTRL}
fi
fi
###
### Install OpenSSL and cURL from sources
###
if [ "${_ALLOW_HEAVY_REBUILDS}" = "YES" ] || [ ! -x "/usr/local/ssl3/bin/openssl" ]; then
_if_ssl_install_src
_ssl_paths_sync
_ssl_crypto_lib_fix
_curl_install_src
fi
###
### Install OpenSSH from sources
###
if [ "${_SSH_FROM_SOURCES}" = "YES" ] && [ "${_ALLOW_HEAVY_REBUILDS}" = "YES" ]; then
if [ "${_STATUS}" = "INIT" ] || [ "${_STATUS}" = "UPGRADE" ]; then
if [ "${_OS_DIST}" = "Debian" ] || [ "${_OS_DIST}" = "Devuan" ]; then
_sshd_install_src
_sshd_armour
fi
fi
fi
###
### DNS cache server
###
if [ "${_STATUS}" = "INIT" ] || [ "${_STATUS}" = "UPGRADE" ]; then
if [ "${_ALLOW_HEAVY_REBUILDS}" = "YES" ]; then
_dns_unbound_install_upgrade
fi
fi
###
### Install Percona server
###
_db_server_install
###
### Finalize initial Percona server and tools setup
###
_init_sql_root_credentials
_sql_root_credentials_update
_mytop_install
_myquick_install_upgrade
###
### Install other services
###
if [ "${_ALLOW_HEAVY_REBUILDS}" = "YES" ]; then
_nginx_install_upgrade
_nginx_initd_check
_nginx_mime_check_fix
_redis_install_upgrade
_lshell_install_upgrade
_magick_install_upgrade
_php_install_deps
_php_libs_fix
_php_if_versions_cleanup_cnf
if [ "${_STATUS}" = "UPGRADE" ]; then
_php_ioncube_check_if_update
_php_check_if_rebuild
fi
_php_install_upgrade
_php_config_check_update
_php_upgrade_all
_if_install_php_newrelic
_newrelic_check_fix
fi
_smtp_check
_xdrago_install_upgrade
###
### Download system-wide Drush versions
###
_drush_system_install_update
###
### Install or upgrade Aegir Master Instance
###
if [ "${_ALLOW_HEAVY_REBUILDS}" = "YES" ]; then
_aegir_master_install_upgrade
_aegir_bin_extra_check_fix
_nginx_wildcard_ssl_install
_nginx_config_update_fix
_aegir_master_display_login_link
fi
###
### Optional add-on services
###
if [ "${_STATUS}" = "INIT" ] || [ "${_STATUS}" = "UPGRADE" ]; then
if [ "${_ALLOW_HEAVY_REBUILDS}" = "YES" ]; then
_if_install_ftpd
_if_install_vnstat
_if_install_wkhtmltox
_if_install_git_src
_if_install_ffmpeg
_if_install_bzr
_if_install_solr_jetty
_if_install_adminer
_if_install_chive
_if_install_sqlbuddy
_if_install_collectd
_if_install_hhvm
_if_install_webmin
_if_install_bind
_if_install_ruby
_if_install_node
_sftp_ftps_modern_fix
fi
fi
###
### Install or upgrade csf/lfd monitoring
###
_csf_lfd_install_upgrade
###
### Update rsyslog configuration
###
_rsyslog_config_update
###
### Install or uninstall AppArmor after barracuda install and upgrade
###
if [ "${_STATUS}" = "INIT" ] || [ "${_STATUS}" = "UPGRADE" ]; then
[ ! -e "/root/.allow.apparmor.cnf" ] && touch /root/.allow.apparmor.cnf
[ -e "/root/.deny.apparmor.cnf" ] && rm -f /root/.allow.apparmor.cnf
if [ ! -e "/root/.run-to-daedalus.cnf" ] \
&& [ ! -e "/root/.run-to-chimaera.cnf" ] \
&& [ ! -e "/root/.run-to-beowulf.cnf" ]; then
if [ "${_OS_CODE}" != "stretch" ] && [ "${_OS_CODE}" != "jessie" ]; then
_if_install_apparmor
fi
fi
fi
###
### Update barracuda log, tools and system settings
###
_pam_umask_check_fix
_pam_many_check_fix
_avatars_check_fix
_sysctl_update
_initd_update
_apticron_update
_barracuda_log_update
_find_server_city
###
### Complete system checks and cleanup
###
_complete
exit 0
###----------------------------------------###
###
### Barracuda Aegir Installer
### Copyright (C) 2010-2024 Omega8.cc
### [email protected] www.omega8.cc
###
###----------------------------------------###