317 Commits

Author SHA1 Message Date
269998a2af Main, reset branch to master after merge 2021-03-19 14:59:56 +01:00
Bram Prieshof
4c13b77990 Merge pull request 'ReWriten Postfix module to support OpenDKIM' (#14)
Reviewed-on: https://git.ictmaatwerk.com/VPS-scripts/Web-V2/pulls/14
2021-03-19 14:44:59 +01:00
Bram Prieshof
9bf9db560a Merge branch 'master' into PostfixTesting 2021-03-19 14:44:09 +01:00
31c7ba85c8 Mod:Postfix Updated msg's 2021-03-18 16:04:53 +01:00
f755e27fb4 Mod:Postfix Fixed oopsie 2021-03-18 14:57:42 +01:00
22df00dd80 Mod:Postfix added blacklist check reminder 2021-03-18 14:46:00 +01:00
0dd431a8d5 Mod:Postfix updated instructions 2021-03-18 14:34:31 +01:00
73bf0aa0f4 Mod:Postfix Made DKIM selector variable
This so multiple servers useing Web-V2 can send from the same domain
Now using odksec for host selector var
and odkdomsec for domain selector var
2021-03-12 14:44:40 +01:00
f28b08792c Scrtipt:Compat Cleanup and basic validation 2021-03-11 15:43:42 +01:00
4af278b6f0 Main:PhpUp added remove script if cur php is kept 2021-03-04 11:07:27 +01:00
b15f8a33ed Script:Compat fix for getting option list
Forceing "Normal install mode (Whiptail) "
since this script requires it.
For This sctipt only, since it was unable to get correct module list
2021-02-26 12:51:12 +01:00
d85678e560 Script:Compat fixed/added var 2021-02-26 12:31:56 +01:00
0c62faa0aa Main, fixed checking wrong var in version check 2021-02-26 12:29:05 +01:00
5a70278103 Main, Updated version detection 2021-02-26 12:26:45 +01:00
1423d72e53 Added rough versioning system 2021-02-25 11:34:42 +01:00
638a8c1525 Main:* fix for CMSHooks, Mod:Postfix fix openDKIM
Main:Inst Fixed failing to store storing EnabledAons/aonoption

Main:AddCMS renamed option to EnOption to avoid resusing variable

Mod:Postfix Fixed OpenDKIM usermod
2021-02-11 15:18:17 +01:00
064ceafe08 Main:AddCMS removed var ignphpcms
Remove var 'ignphpcms' because it is no longer unused
2021-02-11 13:37:36 +01:00
81b7e93678 Main:All Added per CMS config for sub-modules
If CMS is installed and a sub-module requires to be configured per CMS,
this is handeled by new 'CMSHook-(pre)conf.sh'
this has been added to Dev Docs

Updated postfix sub-module to use new CMSHook
Added 'itype' var for detection of install script type
Now also storeing  'Allways on modules' in installer as EnabledAons
2021-02-10 15:23:22 +01:00
282851f1ed Main:AppendCMS Renamed bck-util cms-handeler
Renamed bck-util cms-handeler to CMSHook-conf for future compatibility
2021-02-10 12:02:39 +01:00
cbba8b1d1b Mod:Postfix fixed opendkim group for postfix 2021-02-05 21:17:22 +01:00
af951799b5 Mod:Postfix added perl-Getopt for centos 2021-02-05 21:08:36 +01:00
84cda6333f Mod:Postfix bugfixes 2021-02-05 20:58:24 +01:00
402a4b68e5 Mod:Postfix Fixed typo 2021-02-05 20:35:04 +01:00
98c5dec4d9 Mod:Postfix add global option to Seds & fixed cfg 2021-02-05 19:58:48 +01:00
923cefbda4 Merge branch 'PostfixTesting' of https://git.ictmaatwerk.com/VPS-scripts/Web-V2 into PostfixTesting 2021-02-05 18:45:17 +01:00
4ff12369d6 Mod:Postfix fixed PHP cfg Update & motd warn msgs 2021-02-05 18:45:05 +01:00
46042d3ca9 Mod:Postfix fixed PHP cfg Update & motd warn msgs 2021-02-05 18:39:35 +01:00
616f0a2162 Mod:Postfix Fixed ODK Sock for deb & Clean CMSHOOK 2021-02-05 18:05:23 +01:00
10838eb815 Mod:Postfix updated CMSHook and fixed sed (again) 2021-02-05 17:33:26 +01:00
c60b57d41b Mod:Postfix Fixed incorrect links & dkim conf dir
Updated location of OpenDKIM config files to default /etc/opendkim.d
from /etc/opendkim
Updated config file to reflect filename hanges in repo
2021-02-05 17:23:40 +01:00
2988258ffd Mod:Postfix Updated Config.sh
fixed mkdir, various typos and existing CMS/site detection
2021-02-05 17:12:34 +01:00
7e6be6bf72 Updated Inst:AppendCMS Mod:Postfix
Inst:AppendCMS added var store when adding CMS
Mod:Postfix Added fix to conf.sh
2021-02-05 16:54:06 +01:00
9c36d12d52 added CMSHook for postfix module and updated conf
CMSHook wil be inplemented so CMS releated Module configuration,
this wil be loaded when using appendCMS and the main intaller
2021-02-04 15:25:57 +01:00
Bram Prieshof
5a711db696 Fixed oopsie 2021-02-01 21:45:07 +01:00
8dfef7c493 Added OpenDKIM to Postfix module 2021-01-29 18:23:16 +01:00
03ff10e36d Fixed config for FC CMS 2021-01-27 12:50:05 +01:00
71f62088d8 Fixed incorrect fetching of FC server conf 2021-01-27 12:39:43 +01:00
bd4e431215 Added FrontController CMS 2021-01-27 12:19:07 +01:00
39da2f54d7 Cleanup EL8 Output 2021-01-27 11:41:28 +01:00
8f9a9e7c95 Updated detection of centos to accept all EL8 2021-01-27 11:29:57 +01:00
f0e0eef8bc enabled http proxy apahce module by default 2021-01-08 15:30:30 +01:00
d123670a71 fixed typos in config for monit 2021-01-08 15:11:02 +01:00
afffd9f74d Added monit to backend CMS 2021-01-08 14:26:33 +01:00
8cafe06982 Reset branch in installer after merge 2020-12-18 15:31:36 +01:00
Bram Prieshof
eee605d34d Merge pull request 'PHP 8 intergration readiness' (#11) from PHP8-Testing into master
Reviewed-on: https://git.ictmaatwerk.com/VPS-scripts/Web-V2/pulls/11
2020-12-18 15:30:17 +01:00
22ca4d3464 updated phpupdater for apache 2020-12-18 14:35:13 +01:00
d889f248e6 Prepared php updater for EL 2020-12-17 15:14:18 +01:00
9115a36148 fixed oopsie 2020-12-16 14:35:54 +01:00
a24e075714 Fixed typo, after inital update for php module
Fixes: #10
2020-12-16 14:27:31 +01:00
c5d70cc455 Updated php module to support mutiple php versions 2020-12-16 13:25:11 +01:00
e570e4b88c Added tmp folder to php basedir's 2020-12-16 10:52:41 +01:00
Bram Prieshof
1f006a056c Set branch in installer to master after merge from centos-testing 2020-12-10 14:40:37 +01:00
Bram Prieshof
2501e3ff3d Merge 'Centos Testing' to 'master' 2020-12-10 14:39:15 +01:00
a87850f6d0 Fixed nginx-nonPHP CMS 2020-12-10 13:45:20 +01:00
ba80b923d0 Added nano to pkg list 2020-12-10 13:09:49 +01:00
74d76cdf15 Fixed use of incorect var for OS detection 2020-12-10 11:30:08 +01:00
9e9211c475 Fixed Fail2Ban for centos 2020-12-09 21:35:01 +01:00
d6cebfefb2 Fixed oopsie 2020-12-09 18:35:17 +01:00
2170468a30 Fixed accidentally removed linux for F2B centos 2020-12-09 18:35:03 +01:00
377c3e6e50 Added bugfix to apache for centos 2020-12-09 18:04:48 +01:00
92b487345e Cleanup apache 2020-12-09 17:26:38 +01:00
fe742ec534 Fixed oopsie 2020-12-09 15:29:02 +01:00
95f2a19422 Updated apache module to use vars 2020-12-09 15:13:23 +01:00
2a6de08f75 Fixed fail2ban and replaced cent8 with el8 2020-12-09 13:29:25 +01:00
b112be5aeb Added tar to Installer-Requirements 2020-12-09 12:21:17 +01:00
7e65bec375 new pkgmanager var also added to installer 2020-12-09 11:33:42 +01:00
1e09184895 Added more vars for pkgmanager
PKGUC: Clear and update repo cache
PKGUP: Running updates
2020-12-09 11:32:45 +01:00
3179abbb6c Fixed backend uploads 2020-12-04 19:04:27 +01:00
74f12decdf Adapted nextcloud init to support redis on Centos 2020-12-04 18:13:30 +01:00
bcb714db44 added bzip2 for nextcloud 2020-12-04 17:38:00 +01:00
93184de8eb Fixed oopsie in Selinux webdir 2020-12-04 17:22:53 +01:00
06a7814d98 Updated SeLinux for web folder once again 2020-12-04 17:04:53 +01:00
aebf9c97e4 Fixed oopsie 2020-12-04 16:05:19 +01:00
f3b2d3cfb5 updated wp init script
Replaced wp with /usr/local/bin/wp,
because centos sudo failed to detect wp command
2020-12-04 15:56:05 +01:00
38d7b021de Fixed php pkg list and SeLinux 2020-12-04 15:52:41 +01:00
ae6a1f7433 Updated nextcloud pkg list 2020-12-04 14:10:21 +01:00
752f777697 Fixed oopsie 2020-12-04 13:54:58 +01:00
bc511b4c73 Updated password generator for mysql db creation 2020-12-04 12:53:04 +01:00
574e61b085 Updated Redis module for Centos compatibility 2020-12-04 11:10:57 +01:00
be8d75bcab Replaced references php With vars
Done because differences between distros is quite big,
and this was the beter solution then using alot of if statements

List of changes:
* Replaced service names php"$phpver"-fpm with $phpFPMService
* Replaced PHPver in package list with phpPkgName
* Replaced full php config path with $phpMainConf
* Replaced php pool path with $phpPoolDir
2020-12-03 17:10:47 +01:00
7fb0470f44 Made motd msg work in Centos,
updated motd display to first check if file exists
2020-12-03 14:07:35 +01:00
eb83d11538 Fixed Selinx www folder 2020-12-03 13:36:55 +01:00
18439cc934 Fixed non starting services 2020-12-03 13:12:12 +01:00
17353040b6 Fixed typo 2020-12-03 12:26:40 +01:00
c49a284e5e Fixed ufw no starting on boot 2020-12-03 12:05:37 +01:00
a9f57d3513 Fixed UFW defaults for Centos
Fixed selinux ssh port
2020-12-03 11:28:41 +01:00
859033a213 Fixed nginx pkg list for CentOS 2020-12-02 15:59:34 +01:00
2cbaa6ce86 Fixed incorect Variable generic preconf 2020-12-02 15:53:15 +01:00
f51b50debb added debug msg to preconfig 2020-12-02 15:25:45 +01:00
061d97d5a0 Initial centos test/modifications 2020-12-02 14:54:22 +01:00
Bram Prieshof
d7fcf5e55c Update 'Scripts/SMI.sh' 2020-12-02 13:42:23 +01:00
59a256c590 Fixed bug in "Set sitename" y/n question 2020-11-27 12:47:33 +01:00
c3839afdc4 Set keyboard layout to us + Added bash-completion 2020-11-27 12:31:19 +01:00
38b1e8560f Enabled Debian 10 for validation and testing 2020-11-26 15:13:11 +01:00
4c25b3456f Added Apend scripts to documentation 2020-11-26 14:21:45 +01:00
18ea88f6dc Added cron to pkg list 2020-11-26 13:48:58 +01:00
3c7683684a update Wordpress salt use printf instead of ed 2020-11-25 15:46:00 +01:00
0ab3c8bc44 added sudo to main PKG list 2020-11-25 14:33:57 +01:00
64ce1701be Enabled Ubuntu 20.04 for validation and testing 2020-10-28 11:56:09 +01:00
aeb20247ab Migrated to VPS-scripts 2020-10-16 10:30:29 +02:00
be2cf222d9 fixed apache output 2020-10-15 14:29:21 +02:00
8eb67bb10f Fixed CMS motd 2020-10-15 13:33:14 +02:00
8ad35db685 updated postfix module and fixed CMS motd 2020-10-15 12:20:23 +02:00
b475a7f365 Seperated Postfix into submodule 2020-10-14 15:04:50 +02:00
0cb3113ede Output cleanup for whiptail 2020-10-09 15:09:58 +02:00
abe8aefb10 Fixed oopsie 2020-10-09 14:19:02 +02:00
de53e32441 fixed missing www Question whiptail menu 2020-10-09 14:15:43 +02:00
79916b0fce fixed oopsie 2020-10-09 13:40:25 +02:00
39510bbd1f Output cleanup normal and bug fixes 2020-10-09 12:18:48 +02:00
976fcdf83d Ssl scipt only when ssl failed +cleanup ssl script 2020-10-08 14:24:21 +02:00
a7cef49e4b Cleanup after failed ssl request 2020-10-08 14:19:52 +02:00
89456991df Added failed-ssl fallback 2020-10-08 12:39:19 +02:00
921cf142b8 Updated To-Do 2020-10-07 12:06:21 +02:00
a9e25cbe40 Fixed enableSSL 2020-10-02 17:12:38 +02:00
6550adcdec Allowed +1 occurrence in most sed commands 2020-10-02 16:28:34 +02:00
a512a0bc5f Include ACME.sh Module 2020-10-02 14:49:22 +02:00
1d7bc1e387 Replaced certbot with ACME.sh 2020-10-02 14:35:54 +02:00
b.waal
f3701924f0 Prepared for ACME.sh 2020-10-02 14:18:14 +02:00
b.waal
6d9faf6ecd Prepared for ACME.sh 2020-10-02 14:18:11 +02:00
b.waal
1c4ad0880e Prepared for ACME.sh 2020-10-02 14:18:08 +02:00
b.waal
ed4e0b51e9 Prepared for ACME.sh 2020-10-02 14:18:03 +02:00
b.waal
7d00f38378 Prepared for ACME.sh 2020-10-02 14:18:00 +02:00
b.waal
208df41550 Prepared for ACME.sh 2020-10-02 14:17:57 +02:00
b.waal
0d8cd7c98c Update 'Scripts/SMI.sh' 2020-10-02 11:18:20 +02:00
b.waal
250f731215 Update 'README.md' 2020-10-02 11:13:15 +02:00
b.waal
29e78ceacb Whiptail alignment 2020-10-02 11:12:27 +02:00
6fd151096a Replaced wget in favor of curl 2020-10-01 12:04:06 +02:00
4642319096 Init intergation of multi OS support, updated docs 2020-09-30 15:43:43 +02:00
Bram Prieshof
531088000a added wget as requirement 2020-09-25 14:29:10 +02:00
Bram Prieshof
2af62be7e1 Update 'CMS/wordpress/wordpress-init.sh' 2020-09-25 14:00:43 +02:00
Bram Prieshof
a154d5a3d5 Update 'CMS/wordpress/wordpress-init.sh' 2020-09-25 13:03:20 +02:00
98f511d504 updated SMI 2020-09-25 11:03:55 +02:00
89d974c6fd Set os specific pkg lists 2020-09-25 10:56:01 +02:00
a4815095b7 Migration form apt.list to generic.pkg.list 2020-09-25 10:37:00 +02:00
1599216685 Fixed output of new repo scipt 2020-09-24 13:01:29 +02:00
84faba5a9f fixed oopsie 2020-09-24 12:51:34 +02:00
9e9487c597 Updated methode of adding repo's 2020-09-24 12:13:05 +02:00
adbb03e62f fixed typo apache config-script 2020-09-11 14:10:47 +02:00
03773054de added php update tool for apache 2020-09-11 13:54:08 +02:00
0b11896d0b fixed typo 2020-09-11 13:39:22 +02:00
bf2368a7f3 Fixed oopsie 2020-09-11 13:27:32 +02:00
52906fea36 added database redir from frond-end (apache) 2020-09-10 15:34:47 +02:00
Bram Prieshof
0b643f9e62 Update 'TO-DO_Wanted-Features.md' 2020-09-10 15:28:25 +02:00
653548ee5e added database redir from frond-end 2020-09-10 14:39:45 +02:00
Bram Prieshof
c784751332 moved phpPHPver-apcu to general php 2020-09-10 13:37:47 +02:00
Bram Prieshof
031d3c705b moved phpPHPver-apcu to general php 2020-09-10 13:36:28 +02:00
c8b4c7fc18 Added branchtype to allow for tags 2020-09-09 14:22:15 +02:00
7d4eb9d953 Updating TO-DO lists 2020-09-04 16:20:48 +02:00
Bram Prieshof
1ccbe3e61a Clean fail2ban jail folder before creating own jails 2020-09-04 14:52:29 +02:00
Bram Prieshof
4e4a39b3a4 Fixed oopsie 2020-09-04 13:48:33 +02:00
Bram Prieshof
593e286e48 Updated ssl for AppendCMS 2020-09-04 13:35:13 +02:00
9f681d67b6 Merge branch 'master' of https://git.ictmaatwerk.com/bprieshof/UBU-Web-V2 2020-09-04 13:30:58 +02:00
27782ff2a3 Fixed oopsie 2020-09-04 13:30:38 +02:00
Bram Prieshof
226ba390ee Update 'installer.sh' 2020-09-04 13:18:44 +02:00
Bram Prieshof
5e718e8cae Made EnableSSL compatible with nginx_nonphp 2020-09-04 13:12:20 +02:00
52925d476a Fixed menu list for append scripts 2020-09-04 13:05:32 +02:00
Bram Prieshof
0e6c8e27aa added if statement to disable f2b jail for fail2ban 2020-09-04 11:58:26 +02:00
824ff17ee3 Disabled Backend CMS and Phpmya for nginx_nonphp 2020-09-04 11:48:50 +02:00
Bram Prieshof
d612a5a0ef Fixed oopsie 2020-09-04 11:12:11 +02:00
a31b1b60e2 Fixed oopsie 2020-09-03 15:12:36 +02:00
c950ddbf34 Renamed nginx-nonphp to nginx_nonphp 2020-09-03 15:03:04 +02:00
7f6c006d2c Added nginx without PHP-FPM 2020-09-03 14:56:21 +02:00
Bram Prieshof
b591875112 Update 'CoreModules/nginx/config/nginx/nginx-default.conf' 2020-09-03 14:34:44 +02:00
4826e53ee8 Fixed issues regading nginx repo migration 2020-09-03 14:19:36 +02:00
4db54257bc Migrated nginx from ppa to NGINX Own repo 2020-09-03 14:06:27 +02:00
14d066a6f9 Added init sctipt removal feature 2020-09-03 13:18:14 +02:00
59bc06569b merge of Dev branch for apache with Main branche 2020-09-03 11:45:13 +02:00
205c8b19e8 Merge remote-tracking branch 'dev/master' 2020-09-03 11:36:40 +02:00
51de4a6a7e Fixed toggles for nginx 2020-09-03 09:16:50 +00:00
61ce0c464a Update 'Scripts/toggles/toggle-Netdata_NGINX.sh' 2020-09-03 09:15:48 +00:00
Bram Prieshof
4c757329a3 Update 'TO-DO_FIX-CHECK.md' 2020-09-02 13:51:28 +02:00
Bram Prieshof
178c1e0c3a Update 'TO-DO_FIX-CHECK.md' 2020-09-02 13:51:13 +02:00
ec40338c97 Update 'Scripts/toggles/toggle-PhpMyAdmin_APACHE.sh' 2020-09-02 11:26:24 +00:00
187dc9b247 Update 'Scripts/toggles/toggle-PhpMyAdmin_NGINX.sh' 2020-09-02 11:24:29 +00:00
c36a3f64ba Add 'Scripts/toggles/toggle-PhpMyAdmin_APACHE.sh' 2020-09-02 11:19:56 +00:00
48d20f5850 Update 'CoreModules/apache/conf.sh' 2020-09-02 11:11:44 +00:00
8a5d7d12cf Update 'CoreModules/apache/conf.sh' 2020-09-02 11:07:24 +00:00
caa7904489 Update 'installer.sh' 2020-09-02 10:50:21 +00:00
15d0e3edf9 Update 'CoreModules/apache/ssl-handler.sh' 2020-09-02 10:48:40 +00:00
37e38ae4d1 Update 'CoreModules/nginx/ssl-handler.sh' 2020-09-02 10:48:14 +00:00
cf8e5fb927 Added Backend Config 2020-09-02 10:15:28 +00:00
a4d2b61342 Add 'CMS/Backend/apache-siteBackend-unconfigured ' 2020-09-02 10:05:50 +00:00
57c8345be2 Update 'CMS/Backend/apache-conf.sh' 2020-09-02 09:57:41 +00:00
91b0127b93 Update 'CMS/Backend/apache-conf.sh' 2020-09-02 09:57:19 +00:00
d048ef66a1 apache config for backend 2020-09-02 09:54:24 +00:00
2efec900ec Update 'ModulesMenu.list' 2020-08-28 13:03:27 +00:00
169c075770 fixed apache nextcloud w-k/dav 2020-08-28 12:11:27 +02:00
6b0e9345da Upated nextcloud apt list 2020-08-28 11:49:02 +02:00
d10dc31713 fixed oopsie 2020-08-28 11:39:26 +02:00
40e23498b2 Added nextcloud for apache 2020-08-28 11:36:59 +02:00
700509c151 Update 'Scripts/EnableSSL.sh' 2020-08-26 11:58:06 +00:00
2e217b095b Update 'Scripts/EnableSSL.sh' 2020-08-26 11:53:15 +00:00
dc3a46ce90 Update 'Scripts/EnableSSL.sh' 2020-08-26 11:51:30 +00:00
4e4416b47e Add 'CMS/wordpress/apache-conf.sh' 2020-08-26 11:36:51 +00:00
b.waal
90c21c9cec Update 'TO-DO_FIX-CHECK.md' 2020-08-26 13:25:16 +02:00
b.waal
c5f472e229 Update 'TO-DO_FIX-CHECK.md' 2020-08-26 13:25:08 +02:00
90de9435eb Added apache config for WP 2020-08-26 11:16:46 +00:00
0914c86f28 fixed log location 2020-08-26 11:06:31 +00:00
989069fe32 Set custom config to be loaded last to avoid getting overwriten 2020-08-26 09:46:45 +00:00
542040b501 Added security params 2020-08-26 09:45:29 +00:00
2f66fba1bc fixed typo 2020-08-26 09:18:29 +00:00
3ada5835ef Fixed oopsie 2020-08-26 09:14:50 +00:00
e0ed283af9 integrated ssl-handler 2020-08-26 08:50:58 +00:00
21dfae66a9 Add 'CoreModules/apache/ssl-handler.sh' 2020-08-26 08:45:35 +00:00
85f4ec3de2 Add 'CoreModules/apache/appendCMS-conf.sh' 2020-08-21 13:22:08 +00:00
1e22471cc1 added cache all 2020-08-21 13:13:15 +00:00
4f2b57169c Update 'CoreModules/apache/config/apache2/site_CatchAll' 2020-08-21 13:09:37 +00:00
85d770b8db added apache CatchAll 2020-08-21 13:09:20 +00:00
7f6c43d587 fixed typo 2020-08-21 12:28:07 +00:00
d6d6110892 fixed oopsie 2020-08-21 12:11:27 +00:00
dde2802060 Added custom default index page 2020-08-21 12:06:13 +00:00
e9d03d5393 Update 'CoreModules/apache/conf.sh' 2020-08-21 12:02:41 +00:00
0d761fa7d0 Fixed oopsie 2020-08-21 11:54:54 +00:00
268cd4a375 Update 'CoreModules/apache/preconf.sh' 2020-08-21 11:51:49 +00:00
7b180c94e7 added al ciphers 2020-08-21 11:46:15 +00:00
16608b85f0 Update 'CoreModules/apache/conf.sh' 2020-08-21 11:41:42 +00:00
d7e7ecf841 added initial apache configuration/setup 2020-08-20 15:28:07 +02:00
c532f01a8d moved php-fpm to own module 2020-08-20 11:23:18 +02:00
ac1567f50d added php-fpm 2020-08-20 11:03:19 +02:00
524e733a22 Updated repo to local server 2020-08-20 08:37:33 +00:00
Bram Prieshof
7f4d5c6994 added backup util for aditional CMS 2020-08-19 14:19:27 +02:00
Bram Prieshof
cca882a5fe Fixed ssl 2020-08-19 12:08:08 +02:00
b.waal
1f7c9a5cd3 Spell check 2020-08-19 11:55:31 +02:00
Bram Prieshof
f186b89ac5 fixed oversight 2020-08-19 11:47:56 +02:00
Bram Prieshof
648881b362 fixed oversight 2020-08-19 11:47:25 +02:00
Bram Prieshof
476de8e5ee Update 'TO-DO_Wanted-Features.md' 2020-08-19 11:40:00 +02:00
Bram Prieshof
28372d9109 inported wp initaltsation commands for AIOM 2020-08-19 11:30:04 +02:00
Bram Prieshof
e07d0ea7b5 fixed oopsie 2020-08-14 15:09:01 +02:00
b.waal
7ca6d9c175 Spell check 2020-08-14 15:05:04 +02:00
Bram Prieshof
652b69ec37 Fixed oopsie 2020-08-14 14:52:18 +02:00
Bram Prieshof
59e5354179 fixed oopsie 2020-08-14 14:32:19 +02:00
Bram Prieshof
4da29963e7 Add 'PhpUpdater.sh' 2020-08-14 14:03:17 +02:00
Bram Prieshof
32f3d75a7d Add 'CoreModules/nginx/phpupdate-handeler.sh' 2020-08-14 13:54:38 +02:00
Bram Prieshof
4d7dfbbfc2 Update 'TO-DO_Wanted-Features.md' 2020-08-13 14:10:41 +02:00
9fc7e8722e fixed msg for end of installation 2020-08-13 12:51:00 +02:00
Bram Prieshof
213f120677 Fixed oopsie 2020-08-12 16:34:01 +02:00
Bram Prieshof
d4724363b8 Fixed oopsie 2020-08-12 16:33:32 +02:00
eda751c0bf Fixed Backend SSL 2020-08-12 16:15:51 +02:00
7282836297 set certbot to certonly and fixed TLSv1.3 2020-08-12 14:31:04 +02:00
6e2dc8faf7 Fixed ssl oopsie 2020-08-12 12:37:36 +02:00
5f27c5cba1 Updated SSL settings and installation methode 2020-08-07 16:21:58 +02:00
b.waal
208a7eca53 Added daily backend disable cronjob 2020-08-07 14:30:37 +02:00
Bram Prieshof
7b565280f8 Fixed oopsie 2020-08-07 11:02:15 +02:00
6f1c8d0277 Fixed oopsie 2020-08-06 14:37:56 +02:00
9557b22941 Added php app Jails for F2B 2020-08-06 14:15:14 +02:00
Bram Prieshof
e5afabbf0a Added filters for Inhouse php application 2020-08-06 14:05:33 +02:00
Bram Prieshof
ef2cb1fdcd Add 'config/fail2ban/Filters/phpapp-UA.local' 2020-08-06 14:05:00 +02:00
Bram Prieshof
c748b319fe Update 'Scripts/toggles/toggle-Netdata_NGINX.sh' 2020-08-06 12:56:29 +02:00
Bram Prieshof
b3b08a3439 Update 'Scripts/toggles/toggle-Netdata_NGINX.sh' 2020-08-06 12:55:51 +02:00
Bram Prieshof
dfe551210d Update 'Scripts/toggles/toggle-PhpMyAdmin_NGINX.sh' 2020-08-06 12:51:31 +02:00
b.waal
3087ac7ca7 Fixed oopsie and added msg's 2020-08-05 15:28:31 +02:00
b.waal
8b85abd30f Fixed oopsie and added msg's 2020-08-05 15:26:42 +02:00
b.waal
d85e242360 Fixed oopsie and added msg's 2020-08-05 15:24:48 +02:00
Bram Prieshof
2c619b9a44 touch nexcloud log to fix F2B crashing after install 2020-08-05 15:15:37 +02:00
978ff48e07 updated f2b jails and auto reloading f2b on instal 2020-07-31 14:33:36 +02:00
640cc1cd1a Fixed oopsie 2020-07-31 13:16:17 +02:00
d531b27b0b fixed displaying setup notify at end of setup 2020-07-31 12:08:50 +02:00
1171e84177 inital fail2ban addition 2020-07-31 11:54:42 +02:00
3b8c214dec Fixed oopsie's 2020-07-30 15:22:26 +02:00
8d10e8b853 Updated motd's in the installer,
they wil also be displayed at the end of installation
2020-07-30 14:47:54 +02:00
f24076bb43 Nginx per-site log and Wordpress init script using 2020-07-30 14:16:33 +02:00
Bram Prieshof
9cce3cc75a Added WP-CLI 2020-07-30 11:06:59 +02:00
Bram Prieshof
1dc82a1de7 Added log folder 2020-07-24 13:46:42 +02:00
Bram Prieshof
84196daa2d Added log location and authlog file 2020-07-24 13:24:20 +02:00
b.waal
7efef13984 Fixed oopsie! 2020-07-24 11:56:40 +02:00
Bram Prieshof
6010c8ce8c Added System-Check disable feature 2020-07-24 11:56:29 +02:00
Bram Prieshof
a1ead32d46 Fixed oopsie 2020-07-24 11:12:47 +02:00
Bram Prieshof
4850f29b2b Added System-Check 2020-07-24 11:05:32 +02:00
Bram Prieshof
5a9e8e796a Update 'TO-DO_FIX-CHECK.md' 2020-07-24 10:33:52 +02:00
B.vandeWaal
54221dcfb2 Updated PHP-Pool's 2020-07-23 14:04:18 +02:00
Bram Prieshof
31c7589f42 Update 'TO-DO_Wanted-Features.md' 2020-07-23 13:45:24 +02:00
Bram Prieshof
7748499beb Fixed oopsie
Fixed error with Legacy options menu
2020-07-23 10:59:58 +02:00
Bram Prieshof
721b191471 Update 'TO-DO_Wanted-Features.md' 2020-07-23 10:43:59 +02:00
31585ab88d Renamed To-Do lists to fix windows git being unable to clone 2020-07-22 16:03:25 +02:00
200292da97 Nginx config will now use SiteName as its conf name, and fixed nextcloud init so it will use the php-pool user 2020-07-22 16:01:40 +02:00
a3be7f3e18 Added Custom php pools to all available CMS's 2020-07-17 15:52:34 +02:00
d246815e90 Fixed oopsie 2020-07-17 14:45:18 +02:00
56f744a161 Fixed oopsie 2020-07-17 14:31:41 +02:00
66de5c677e Added php-FPM pool for backend services 2020-07-17 14:18:23 +02:00
Bram Prieshof
cb8b0fc014 Added sitename 2020-07-16 14:11:16 +02:00
Bram Prieshof
0361e9f1bb Add 'TO-DO\FIX-CHECK' 2020-07-16 14:06:56 +02:00
Bram Prieshof
f29e10ff17 Added sitename 2020-07-16 12:52:46 +02:00
Bram Prieshof
d5a471ed1f Hostname Validation added 2020-07-15 13:30:40 +02:00
Bram Prieshof
dff348abbe Update 'TO-DO\Wanted-Features.md' 2020-07-10 14:59:26 +02:00
Bram Prieshof
ecdf83c648 Update 'TO-DO\Wanted-Features.md' 2020-07-10 13:29:18 +02:00
Bram Prieshof
8f69a59726 Added PHP modules for nextcloud 19 2020-07-09 14:58:21 +02:00
b.waal
5277331e46 Fixed captitals causing errors 2020-07-09 14:31:33 +02:00
b.waal
4553590060 Fixed captitals causing errors 2020-07-09 14:31:28 +02:00
Bram Prieshof
d5822eba69 Add 'TO-DO\Wanted-Features.md' 2020-06-17 11:18:21 +02:00
Bram Prieshof
c8a5cf7e67 Added Backup-Util as Always-on module 2020-06-12 11:33:09 +02:00
Bram Prieshof
b12c0a3057 Update 'CMS/nextcloud/nginx-conf.sh' 2020-06-12 11:10:43 +02:00
Bram Prieshof
5ab7179d0d Added Backup-Util 2020-06-12 10:28:11 +02:00
b.waal
0b57edae92 Added reload voor Postfix 2020-05-01 14:13:36 +02:00
Bram Prieshof
7d6cdcbc9f Update 'installer.sh' 2020-05-01 14:05:42 +02:00
Bram Prieshof
04b67f6553 upped fastcgi_timeout to 300s 2020-05-01 12:31:30 +02:00
Bram Prieshof
28e84d2553 Fixed postfix insert 2020-05-01 12:16:07 +02:00
Bram Prieshof
3006586ab2 Disabled apt recommended packages and enabled options menu 2020-05-01 12:09:48 +02:00
b.waal
e54eeadaee Updated to use NL language, disabled first run wizard 2020-05-01 12:07:05 +02:00
b.waal
c1412bf888 Added Redis 2020-05-01 11:32:40 +02:00
Bram Prieshof
0cd496306a updated locat 2020-05-01 11:29:39 +02:00
b.waal
df05133afd Add 'SubModules/redis/conf.sh' 2020-05-01 11:29:35 +02:00
b.waal
04ba481f7a Add 'SubModules/redis/apt.list' 2020-05-01 11:28:29 +02:00
b.waal
318aee6642 Add 'SubModules/redis/preconf.sh' 2020-05-01 11:27:23 +02:00
Bram Prieshof
59444e1029 Update 'CoreModules/generic/conf.sh' 2020-05-01 11:05:33 +02:00
b.waal
a73d12c9ca Added nload 2020-05-01 10:49:03 +02:00
Bram Prieshof
77bbfb7f92 Update 'CMS/nextcloud/nextcloud-init.sh' 2020-04-30 15:13:57 +02:00
Bram Prieshof
44d8bc23f7 Update 'CMS/nextcloud/nextcloud-init.sh' 2020-04-30 15:09:10 +02:00
Bram Prieshof
3c4f028637 Update 'CMS/nextcloud/nginx-conf.sh' 2020-04-30 14:39:49 +02:00
Bram Prieshof
c40d43ccee Add 'CMS/nextcloud/nginx-apt.list' 2020-04-30 14:38:47 +02:00
Bram Prieshof
a01bac4063 Update 'CoreModules/generic/preconf.sh' 2020-04-30 14:17:47 +02:00
b.waal
361acdd98b Removed gnupg2 from main installer 2020-04-30 14:14:34 +02:00
b.waal
2c1d471594 Added requirement for installer 2020-04-30 13:54:24 +02:00
b.waal
c5dddce793 Cleaned Var's 2020-04-30 13:50:57 +02:00
b.waal
e9f68034cd Updated to use the internal APT/Resource mirror 2020-04-30 13:45:54 +02:00
b.waal
ac1381641b Updated to use the internal APT/Resource mirror 2020-04-30 13:42:58 +02:00
Bram Prieshof
d89ab20c2d set default_type to application/octet-stream 2020-04-30 13:38:50 +02:00
b.waal
197ebd70cd Added No-Update flag for PPA 2020-04-30 12:29:19 +02:00
152 changed files with 3068 additions and 1020 deletions

View File

@@ -1,33 +1,47 @@
#!/bin/bash
###############################
# @author: Bram Prieshof #
# @author: Branco van de Waal #
###############################
itype=AddCMS
ScriptCompat=2
##-----------------##
# Fetching Vars #
##-----------------##
if [ ! -f "/etc/ICTM/selopts.list" ] || [ ! -f "/etc/ICTM/mainvar.list" ] ; then echo 'This system is not yet setup, please run the main installer first' && exit ; fi
source /etc/ICTM/selopts.list
source /etc/ICTM/mainvar.list
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/ModulesMenu.list)
if [ -z ${CompatVer} ] || [ "$CompatVer" -lt "$ScriptCompat" ]; then echo "Web-V2 is outdated, Please run the Compat-V*.sh updater from the repo, Current version= $CompatVer" && exit ; fi
if [ -z $shortdist ] ; then source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/MicroOSDetect.sh) ; fi
if [ $webserv != nginx_nonphp ]; then
if [ ! -f "/etc/ICTM/phpvar.list" ] ; then bash <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/GeneratePhplist.sh) ; fi
source /etc/ICTM/phpvar.list
fi
if [ $webserv = apache ]; then
if [ ! -f "/etc/ICTM/apachevar.list" ] ; then bash <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/GenerateApacheList.sh) ; fi
source /etc/ICTM/apachevar.list
fi
rm /tmp/pkg.list > $OUTPUT 2>&1
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/ModulesMenu.list)
#Setting Menulist to webserver
if [[ $webserv = "apache" ]]; then
#Apache Menulist
CMSL=("${ApacheCMSL[@]}")
options=("${ApacheOptions[@]}")
fi
if [[ $webserv = "nginx" ]]; then
#Nginx Menulist
CMSL=("${NginxCMSL[@]}")
options=("${NginxOptions[@]}")
fi
declare -n CMSL="$webserv"CMSL
declare -n options="$webserv"Options
##----------------##
# Static-Vars #
##----------------##
ignphpcms=1
#Options var setup for enabled sub-modules
EnOption="${SelectedOptions[@],,}" && EnOption="${EnOption// /}" && EnOption="${EnOption//:/ }" && EnOption="${EnOption//'"'}"
EnOption="$EnOption""${EnabledAons[@]}"
##---------------##
# Functions #
@@ -80,6 +94,19 @@ if [ $IMODE = n ]; then
domain=$(whiptail --nocancel --inputbox " Enter the domain without WWW " 11 82 --title "Config" 3>&1 1>&2 2>&3)
[[ -d "/var/www/"$domain"/html" ]] && msg " This domain already exists on this server, Exiting" 8 78 && exit;
if (whiptail --title "Config" --yesno " Does www.${domain} exist in DNS" 8 78); then domainwww=1; else domainwww=0; fi
if (whiptail --title "Set sitename?" --yesno "Set sitename to ${domain//./_} ?" 8 78); then
sitename=${domain//./_}
else
while true; do
sitename=$(whiptail --nocancel --inputbox "Enter sitename, Must NOT contain special characters, except: _" 8 78 --title "Sitename" 3>&1 1>&2 2>&3)
if [[ $sitename == *['!'@#\$%^\&*()+,.]* ]] || [ -z "$sitename" ]
then
whiptail --msgbox " Site can't be empty, or contain a special character except for: _" 11 78
else
break
fi
done
fi
if (whiptail --title "Config" --yesno " Enable SSL on installation?" 11 78); then sslenable=1; else sslenable=0; fi
PasswordQuest
CMS=$(whiptail --title "What CMS should be installed?" --radiolist "Features" 11 118 5 "${CMSL[@]}" 3>&1 1>&2 2>&3)
@@ -101,6 +128,23 @@ if [ $IMODE = l ]; then
* ) echo "Choose yes of no.";;
esac
done
read -p "Set sitename to ${domain//./_}? (y/n)" choice
case "$choice" in
y*|Y* ) sitename=${domain//./_};;
n*|N* ) echo "";
while true; do
echo "Please enter sitename, Must NOT contain special characters, except: _";read sitename
if [[ $sitename == *['!'@#\$%^\&*()+,.]* ]] || [ -z "$sitename" ]
then
echo "Site can't be empty, or contain a special character except for: _"
else
break
fi
done
;;
* ) echo "invalid";;
esac
while true; do
read -p "Enable SSL on installation? -> yes/no?" yn
case $yn in
@@ -122,22 +166,37 @@ if [ $IMODE = l ]; then
done
fi
#Cleaning options from menu
#Cleaning CMS from menu
CMS="${CMS//:}" && CMS="${CMS,,}"
##-----------------##
# Storeing vars #
##-----------------##
touch /etc/ICTM/sites/"$sitename"
##-----------##
# AptList #
##-----------##
msg " Generating apt list for CMS"
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/branch/"$branch"/CMS/"$CMS"/apt.list >>/tmp/apt.list; then
curl "$repo"/raw/branch/"$branch"/CMS/"$CMS"/apt.list >>/tmp/apt.list
printf " " >>/tmp/apt.list
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/"$branchtype"/"$branch"/CMS/"$CMS"/generic.pkg.list; then
curl -s "$repo"/raw/"$branchtype"/"$branch"/CMS/"$CMS"/generic.pkg.list >>/tmp/pkg.list
printf " " >>/tmp/pkg.list
fi
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/"$branchtype"/"$branch"/CMS/"$CMS"/"$PKGLIST".pkg.list; then
curl -s "$repo"/raw/"$branchtype"/"$branch"/CMS/"$CMS"/"$PKGLIST".pkg.list >>/tmp/pkg.list
printf " " >>/tmp/pkg.list
fi
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/branch/"$branch"/CMS/"$CMS"/"$webserv"-apt.list; then
curl "$repo"/raw/branch/"$branch"/CMS/"$CMS"/"$webserv"-apt.list >>/tmp/apt.list
printf " " >>/tmp/apt.list
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/"$branchtype"/"$branch"/CMS/"$CMS"/"$webserv"-generic.pkg.list; then
curl -s "$repo"/raw/"$branchtype"/"$branch"/CMS/"$CMS"/"$webserv"-generic.pkg.list >>/tmp/pkg.list
printf " " >>/tmp/pkg.list
fi
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/"$branchtype"/"$branch"/CMS/"$CMS"/"$webserv"-"$PKGLIST".pkg.list; then
curl -s "$repo"/raw/"$branchtype"/"$branch"/CMS/"$CMS"/"$webserv"-"$PKGLIST".pkg.list >>/tmp/pkg.list
printf " " >>/tmp/pkg.list
fi
@@ -145,55 +204,129 @@ fi
# Preconf #
##-----------##
echo "Running preconf for Webserv"
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/branch/"$branch"/CoreModules/"$webserv"/appendCMS-preconf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/CoreModules/"$webserv"/appendCMS-preconf.sh)
msg " Running preconf for Webserv"
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/"$branchtype"/"$branch"/CoreModules/"$webserv"/appendCMS-preconf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/"$webserv"/appendCMS-preconf.sh)
fi
echo "Running preconf for CMS"
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/branch/"$branch"/CMS/"$CMS"/preconf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/CMS/"$CMS"/preconf.sh)
msg " Running preconf for CMS"
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/"$branchtype"/"$branch"/CMS/"$CMS"/preconf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/"$CMS"/preconf.sh)
fi
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/branch/"$branch"/CMS/"$CMS"/"$webserv"-preconf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/CMS/"$CMS"/"$webserv"-preconf.sh)
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/"$branchtype"/"$branch"/CMS/"$CMS"/"$webserv"-preconf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/"$CMS"/"$webserv"-preconf.sh)
fi
#Preconfiguring module For CMS
for val1 in ${EnOption[*]}; do
modListed=$(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/extModules.list|grep "$val1")
#Checking
if test -z "$modListed"
then
#Fetching from local repo
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/"$branchtype"/"$branch"/SubModules/"$val1"/CMSHook-preconf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/"$val1"/CMSHook-preconf.sh)
fi
else
#Fetching from remote repo
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$modListed"CMSHook-preconf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$modListed"CMSHook-preconf.sh)
fi
fi
done
##-------------##
# Installer #
##-------------##
$PKGM update
sed -i 's/PHPver/'$phpver'/g' /tmp/apt.list
cat /tmp/apt.list | xargs $PKGI
$PKGUC
sed -i 's/PHPprefix/'$phpPkgName'/g' /tmp/pkg.list
cat /tmp/pkg.list | xargs $PKGI
##---------------##
# Configuring #
##---------------##
echo "Running conf for Webserv"
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/branch/"$branch"/CoreModules/"$webserv"/appendCMS-conf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/CoreModules/"$webserv"/appendCMS-conf.sh)
msg " Running conf for Webserv"
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/"$branchtype"/"$branch"/CoreModules/"$webserv"/appendCMS-conf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/"$webserv"/appendCMS-conf.sh)
fi
echo "Setting up SSL"
if [ $sslenable = 1 ]; then
if [ $domainwww = 1 ]; then
certbot --"$webserv" -n -d "$domain" -d "www.$domain" -m "$email" --hsts --redirect --no-eff-email --agree-tos
elif [ $domainwww = 0 ]; then
certbot --"$webserv" -n -d "$domain" -m "$email" --hsts --redirect --no-eff-email --agree-tos
msg " Setting up SSL"
if [ $webserv = nginx_nonphp ]; then
certwebserv=nginx
else
certwebserv=$webserv
fi
site_ext=ssl
if [ $domainwww = 1 ]; then
/opt/acmesh/acme.sh --config-home '/etc/acmesh/data' --issue --"$certwebserv" --ocsp --keylength 'ec-384' -d "$domain" -d "www.$domain" > $OUTPUT 2>&1
certsatus=$?
elif [ $domainwww = 0 ]; then
/opt/acmesh/acme.sh --config-home '/etc/acmesh/data' --issue --"$certwebserv" --ocsp --keylength 'ec-384' -d "$domain" > $OUTPUT 2>&1
certsatus=$?
fi
if test $certsatus -eq 0
then
site_ext="ssl"
else
site_ext="nossl"
rm -rf /etc/acmesh/certs/$domain*
fi
unset certsatus
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/"$branchtype"/"$branch"/CoreModules/"$webserv"/ssl-handler.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/"$webserv"/ssl-handler.sh)
fi
elif [ $sslenable = 0 ]; then
site_ext=nossl
fi
wget -q -t7 "$repo"/raw/branch/"$branch"/Scripts/EnableSSL.sh -O ~/activateSSL-$domain.sh
sed -i -e 's/DOMAINname/'$domain'/' -e 's/CONFname/'$domain'/' -e 's/DomainWWW/'$domainwww'/' -e 's/Email/'$email'/' -e 's/WebServer/'$webserv'/' ~/activateSSL-$domain.sh
echo "Running conf for CMS"
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/branch/"$branch"/CMS/"$CMS"/conf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/CMS/"$CMS"/conf.sh)
if [ $site_ext = nossl ]; then
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/EnableSSL.sh -o ~/activateSSL-$domain.sh
sed -i -e 's/DOMAINname/'$domain'/' -e 's/CONFname/'$sitename'/' -e 's/DomainWWW/'$domainwww'/' -e 's/Email/'$email'/' -e 's/WebServer/'$webserv'/' ~/activateSSL-$domain.sh
fi
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/branch/"$branch"/CMS/"$CMS"/"$webserv"-conf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/CMS/"$CMS"/"$webserv"-conf.sh)
fi
msg " Running conf for CMS"
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/"$branchtype"/"$branch"/CMS/"$CMS"/conf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/"$CMS"/conf.sh)
fi
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/"$branchtype"/"$branch"/CMS/"$CMS"/"$webserv"-conf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/"$CMS"/"$webserv"-conf.sh)
fi
#Configuring Module for CMS
for val1 in ${EnOption[*]}; do
modListed=$(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/extModules.list|grep "$val1")
#Checking
if test -z "$modListed"
then
#Fetching from local repo
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/"$branchtype"/"$branch"/SubModules/"$val1"/CMSHook-conf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/"$val1"/CMSHook-conf.sh)
fi
else
#Fetching from remote repo
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$modListed"CMSHook-conf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$modListed"CMSHook-conf.sh)
fi
fi
done
##------------##
# Services #
##------------##
systemctl reload fail2ban
##-------##
# Done #
##-------##
msg " Added CMS!"
if stat --printf='' /etc/update-motd.d/51* 2>/dev/null; then for f in /etc/update-motd.d/51*; do bash $f; done; fi

View File

@@ -1,29 +1,38 @@
#!/bin/bash
###############################
# @author: Bram Prieshof #
# @author: Branco van de Waal #
###############################
itype=AddMod
ScriptCompat=2
##-----------------##
# Fetching Vars #
##-----------------##
if [ ! -f "/etc/ICTM/selopts.list" ] || [ ! -f "/etc/ICTM/mainvar.list" ] ; then echo 'This system is not yet setup, please run the main installer first' && exit ; fi
##-----------------##
# Fetching Vars #
##-----------------##
source /etc/ICTM/selopts.list
source /etc/ICTM/mainvar.list
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/ModulesMenu.list)
if [ -z ${CompatVer} ] || [ "$CompatVer" -lt "$ScriptCompat" ]; then echo "Web-V2 is outdated, Please run the Compat-V*.sh updater from the repo, Current version= $CompatVer" && exit ; fi
if [ -z $shortdist ] ; then source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/MicroOSDetect.sh) ; fi
if [ $webserv != nginx_nonphp ]; then
if [ ! -f "/etc/ICTM/phpvar.list" ] ; then bash <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/GeneratePhplist.sh) ; fi
source /etc/ICTM/phpvar.list
fi
if [ $webserv = apache ]; then
if [ ! -f "/etc/ICTM/apachevar.list" ] ; then bash <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/GenerateApacheList.sh) ; fi
source /etc/ICTM/apachevar.list
fi
rm /tmp/pkg.list
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/ModulesMenu.list)
#Setting Menulist to webserver
if [[ $webserv = "apache" ]]; then
#Apache Menulist
CMSL=("${ApacheCMSL[@]}")
options=("${ApacheOptions[@]}")
fi
if [[ $webserv = "nginx" ]]; then
#Nginx Menulist
CMSL=("${NginxCMSL[@]}")
options=("${NginxOptions[@]}")
fi
declare -n CMSL="$webserv"CMSL
declare -n options="$webserv"Options
#Filtering already installed modules
for target in "${SelectedOptions[@]}"; do
@@ -92,7 +101,7 @@ fi
if [ $IMODE = n ]; then
PasswordQuest
option=$(whiptail --title "Title" --checklist "Features" 11 110 5 "${options[@]}" 3>&1 1>&2 2>&3)
option=$(whiptail --title "Config" --checklist "Features" 11 110 5 "${options[@]}" 3>&1 1>&2 2>&3)
[[ "$?" = 1 ]] && msg " Quiting installer" 8 78 && exit;
fi
@@ -155,31 +164,46 @@ option="$option""$aonoption"
##-----------##
echo "Generating apt list for Options"
msg " Generating apt list for Options"
for val1 in ${option[*]}; do
echo "$val1" #TMP
modListed=$(wget -t7 -qO - "$repo"/raw/branch/master/extModules.list|grep "$val1")
modListed=$(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/extModules.list|grep "$val1")
#Checking
if test -z "$modListed"
then
#Fetching from local repo
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/branch/"$branch"/SubModules/"$val1"/apt.list; then
curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/SubModules/"$val1"/apt.list >>/tmp/apt.list
printf " " >>/tmp/apt.list
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/"$branchtype"/"$branch"/SubModules/"$val1"/generic.pkg.list; then
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/"$val1"/generic.pkg.list >>/tmp/pkg.list
printf " " >>/tmp/pkg.list
fi
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/branch/"$branch"/SubModules/"$val1"/"$webserv"-apt.list; then
curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/SubModules/"$val1"/"$webserv"-apt.list >>/tmp/apt.list
printf " " >>/tmp/apt.list
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/"$branchtype"/"$branch"/SubModules/"$val1"/"$webserv"-generic.pkg.list; then
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/"$val1"/"$webserv"-generic.pkg.list >>/tmp/pkg.list
printf " " >>/tmp/pkg.list
fi
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/"$branchtype"/"$branch"/SubModules/"$val1"/"$PKGLIST".pkg.list; then
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/"$val1"/"$PKGLIST".pkg.list >>/tmp/pkg.list
printf " " >>/tmp/pkg.list
fi
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/"$branchtype"/"$branch"/SubModules/"$val1"/"$webserv"-"$PKGLIST".pkg.list; then
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/"$val1"/"$webserv"-"$PKGLIST".pkg.list >>/tmp/pkg.list
printf " " >>/tmp/pkg.list
fi
else
#Fetching from remote repo
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$modListed"apt.list; then
curl --retry 7 --retry-delay 5 -s "$modListed"apt.list >>/tmp/apt.list
printf " " >>/tmp/apt.list
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$modListed"generic.pkg.list; then
curl --retry 7 --retry-delay 5 -s "$modListed"generic.pkg.list >>/tmp/pkg.list
printf " " >>/tmp/pkg.list
fi
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$modListed""$webserv"-apt.list; then
curl "$modListed""$webserv"-apt.list >>/tmp/apt.list
printf " " >>/tmp/apt.list
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$modListed""$webserv"-generic.pkg.list; then
curl "$modListed""$webserv"-generic.pkg.list >>/tmp/pkg.list
printf " " >>/tmp/pkg.list
fi
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$modListed""$PKGLIST".pkg.list; then
curl --retry 7 --retry-delay 5 -s "$modListed""$PKGLIST".pkg.list >>/tmp/pkg.list
printf " " >>/tmp/pkg.list
fi
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$modListed""$webserv"-"$PKGLIST".pkg.list; then
curl "$modListed""$webserv"-"$PKGLIST".pkg.list >>/tmp/pkg.list
printf " " >>/tmp/pkg.list
fi
fi
done
@@ -189,19 +213,19 @@ done
# Preconf #
##-----------##
echo "Running preconf for Options"
msg " Running preconf for Options"
for val1 in ${option[*]}; do
echo "$val1" #TMP
modListed=$(wget -t7 -qO - "$repo"/raw/branch/master/extModules.list|grep "$val1")
msg "Pre-configuring $val1"
modListed=$(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/extModules.list|grep "$val1")
#Checking
if test -z "$modListed"
then
#Fetching from local repo
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/branch/"$branch"/SubModules/"$val1"/preconf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/SubModules/"$val1"/preconf.sh)
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/"$branchtype"/"$branch"/SubModules/"$val1"/preconf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/"$val1"/preconf.sh)
fi
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/branch/"$branch"/SubModules/"$val1"/"$webserv"-preconf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/SubModules/"$val1"/"$webserv"-preconf.sh)
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/"$branchtype"/"$branch"/SubModules/"$val1"/"$webserv"-preconf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/"$val1"/"$webserv"-preconf.sh)
fi
else
#Fetching from remote repo
@@ -219,28 +243,28 @@ done
# Installer #
##-------------##
$PKGM update
sed -i 's/PHPver/'$phpver'/g' /tmp/apt.list
cat /tmp/apt.list | xargs $PKGI
$PKGUC
sed -i 's/PHPprefix/'$phpPkgName'/g' /tmp/pkg.list
cat /tmp/pkg.list | xargs $PKGI
##---------------##
# Configuring #
##---------------##
echo "Running conf for Options"
msg " Running conf for Options"
for val1 in ${option[*]}; do
echo "$val1" #TMP
modListed=$(wget -t7 -qO - "$repo"/raw/branch/master/extModules.list|grep "$val1")
msg "Configuring $val1"
modListed=$(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/extModules.list|grep "$val1")
#Checking
if test -z "$modListed"
then
#Fetching from local repo
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/branch/"$branch"/SubModules/"$val1"/conf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/SubModules/"$val1"/conf.sh)
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/"$branchtype"/"$branch"/SubModules/"$val1"/conf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/"$val1"/conf.sh)
fi
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/branch/"$branch"/SubModules/"$val1"/"$webserv"-conf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/SubModules/"$val1"/"$webserv"-conf.sh)
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/"$branchtype"/"$branch"/SubModules/"$val1"/"$webserv"-conf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/SubModules/"$val1"/"$webserv"-conf.sh)
fi
else
#Fetching from remote repo
@@ -252,3 +276,11 @@ for val1 in ${option[*]}; do
fi
fi
done
##-------##
# Done #
##-------##
msg " Added Module!"
if stat --printf='' /etc/update-motd.d/51* 2>/dev/null; then for f in /etc/update-motd.d/51*; do bash $f; done; fi

View File

@@ -0,0 +1,28 @@
[Backend]
user = Backend
group = Backend
listen = /var/run/php/phpPHPver-fpm-Backend.sock
listen.owner = www-data
listen.group = www-data
php_admin_value[disable_functions] = exec,passthru,shell_exec,system
php_admin_value[opcache.enable] = 0
php_admin_value[max_input_vars] = 5000
php_admin_value[upload_max_filesize] = 256M
php_admin_value[post_max_size] = 16M
php_admin_value[max_input_time] = 15
php_admin_value[cgi.fix_pathinfo] = 0
php_admin_value[allow_url_fopen] = Off
php_admin_value[file_uploads] = On
php_admin_value[open_basedir] = /var/log/PhpMyAdmin:/usr/share/phpmyadmin:/var/lib/phpmyadmin:/etc/phpmyadmin:/tmp
php_admin_value[session.use_strict_mode] = 1
php_admin_value[session.cookie_httponly] = 1
;HTTPSONLY php_admin_value[session.cookie_samesite] = Strict
;HTTPSONLY php_admin_value[session.cookie_secure] = 1
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
chdir = /

View File

@@ -0,0 +1,4 @@
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/Backend/apache-siteBackend-unconfigured -o /tmp/apache-siteconf
sed -i -e 's/PHPver/'$phpver'/g' -e 's/DOMAINname/'$hostname'/g' /tmp/apache-siteconf
sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r /tmp/apache-siteconf' -e '/#ConfHere/c\' "$apacheConfDir"/sites-available/Backend_"$siteBackend_ext".conf
systemctl reload $apacheService

View File

@@ -0,0 +1,35 @@
#beginConf
ErrorLog ${APACHE_LOG_DIR}/Backend_error.log
#CustomLog ${APACHE_LOG_DIR}/Backend_custom.log combined
DirectoryIndex index.php index.html index.htm
DocumentRoot /var/www/html
Alias /backend/database /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
#enables/disables PHPMyadmin
deny from all
Require all granted
Options FollowSymLinks
DirectoryIndex index.php
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php/phpPHPver-fpm-Backend.sock|fcgi://localhost"
</FilesMatch>
</Directory>
<Location /backend/monit>
RewriteEngine on
RewriteRule /backend/monit /backend/monit/$1 [R]
</Location>
<Location /backend/monit/>
#enables/disables monit-websocket
deny from all
ProxyPass unix:/var/run/monit/monit.sock|http://127.0.0.1/
ProxyPassReverse unix:/var/run/monit/monit.sock|http://127.0.0.1/
</Location>
#endConf

15
CMS/Backend/conf.sh Normal file
View File

@@ -0,0 +1,15 @@
#Backend PHP Pool
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/Backend/Fpm-Pool.conf-unconfigured -o "$phpPoolDir"/Backend.conf
sed -i 's/PHPver/'$phpver'/' "$phpPoolDir"/Backend.conf
groupadd Backend
useradd -g Backend Backend
#PHPMyAdmin configuration
touch /var/log/PhpMyAdmin/PhpMyAdmin_auth.log
chown Backend:Backend -R /usr/share/phpmyadmin
chown Backend:Backend -R /var/lib/phpmyadmin/tmp
chown Backend:Backend -R /var/log/PhpMyAdmin
systemctl reload "$phpFPMService"
#Auto disable backends at night
echo "0 0 * * * root bash /opt/toggle/toggle-Netdata.sh -d > /dev/null 2>&1" >> /etc/cron.d/autodisablebackend
echo "0 0 * * * root bash /opt/toggle/toggle-PhpMyAdmin.sh -d > /dev/null 2>&1" >> /etc/cron.d/autodisablebackend
echo "0 0 * * * root bash /opt/toggle/toggle-MonitWebui.sh -d > /dev/null 2>&1" >> /etc/cron.d/autodisablebackend

View File

@@ -1,4 +1,4 @@
wget -q -t7 "$repo"/raw/branch/"$branch"/CMS/Backend/nginx-siteBackend-unconfigured -O /tmp/nginx-backendconf
sed -i -e 's/PHPver/'$phpver'/' -e 's/DOMAINname/'$hostname'/' /tmp/nginx-backendconf
sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r /tmp/nginx-backendconf' -e '/#ConfHere/c\' /etc/nginx/sites-enabled/Backend
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/Backend/nginx-siteBackend-unconfigured -o /tmp/nginx-backendconf
sed -i -e 's/PHPver/'$phpver'/g' -e 's/DOMAINname/'$hostname'/g' /tmp/nginx-backendconf
sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r /tmp/nginx-backendconf' -e '/#ConfHere/c\' /etc/nginx/sites-available/Backend_"$siteBackend_ext"
systemctl reload nginx

View File

@@ -1,4 +1,8 @@
#beginConf
#access_log /var/log/nginx/Backend-access.log;
error_log /var/log/nginx/Backend-error.log;
location = /backend/netdata {
return 301 /backend/netdata/;
}
@@ -25,11 +29,16 @@ location = /backend/netdata {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/phpPHPver-fpm.sock;
fastcgi_pass unix:/var/run/php/phpPHPver-fpm-Backend.sock;
fastcgi_index index.php;
}
}
location /backend/monit/ {
deny all; #enables/disables monit-websocket
proxy_pass http://unix:/var/run/monit/monit.sock:/;
}
location ~ /\.ht {
deny all;
}

View File

@@ -0,0 +1,43 @@
[SITEname]
user = SITEname
group = SITEname
listen = /var/run/php/phpPHPver-fpm-SITEname.sock
listen.owner = www-data
listen.group = www-data
php_admin_value[disable_functions] = exec,passthru,shell_exec,system
php_admin_value[error_log] = /var/log/php-fpm/error-SITEname.log
; OPCACHE SETTINGS
php_admin_value[opcache.memory_consumption] = 256
php_admin_value[opcache.enable] = 0
php_admin_value[opcache.interned_strings_buffer] = 32
php_admin_value[opcache.max_accelerated_files] = 50000
php_admin_value[opcache.max_wasted_percentage] = 5
php_admin_value[opcache.revalidate_freq] = 0
php_admin_value[opcache.validate_timestamps] = 1
; PERFORMANCE LIMITS
php_admin_value[max_input_vars] = 100
php_admin_value[upload_max_filesize] = 32M
php_admin_value[post_max_size] = 32M
php_admin_value[max_input_time] = 15
php_admin_value[max_execution_time] = 150
; SECURITY
php_admin_value[cgi.fix_pathinfo] = 1
php_admin_value[allow_url_fopen] = On
php_admin_value[file_uploads] = On
php_admin_value[open_basedir] = /var/www/DOMAINname
;php_admin_value[open_basedir] = /var/www/DOMAINname:/tmp
php_admin_value[session.use_strict_mode] = 1
php_admin_value[session.cookie_httponly] = 1
;HTTPSONLY php_admin_value[session.cookie_samesite] = Strict
;HTTPSONLY php_admin_value[session.cookie_secure] = 1
pm = dynamic
pm.max_children = 11
pm.start_servers = 3
pm.min_spare_servers = 3
pm.max_spare_servers = 11
chdir = /

View File

@@ -0,0 +1,30 @@
#beginConf
#access_log /var/log/nginx/SITEname-access.log;
error_log /var/log/nginx/SITEname-error.log;
index index.php index.html;
root /var/www/DOMAINname/public;
gzip on;
gzip_proxied any;
gzip_types text/plain text/css text/xml text/javascript application/javascript application/x-javascript image/svg image/svg+xml application/xml image/x-icon;
gzip_comp_level 2;
gzip_disable "msie6";
gzip_buffers 16 8k;
#include snippets/ngx-backendredir.conf;
location / {
try_files $uri $uri/ $uri.html /index.php$is_args$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/phpPHPver-fpm-SITEname.sock;
}
location ~ /\.ht {
deny all;
}
#endConf

View File

@@ -0,0 +1,40 @@
#Creating DB
db_suffix=`expr $(ls -l /var/www | grep -c ^d) - 1`
db_name="fc_$db_suffix"
db_user="fc_$db_suffix"
db_pass=$(tr -dc 'A-Za-z0-9!#%()*+,-.:;<=>?@[]^_{|}~' </dev/urandom | head -c 30 ; echo)
#Storing DB Credentials
echo "Database Name $db_name" > ~/DB_"$sitename"
echo "Database Username $db_user" >> ~/DB_"$sitename"
echo "Database Password $db_pass" >> ~/DB_"$sitename"
#Setting up Database
mysql -u root -p"$password" -e "CREATE DATABASE "$db_name" DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;" > $OUTPUT 2>&1
mysql -u root -p"$password" -e "CREATE USER '"$db_user"'@'localhost' IDENTIFIED BY '"$db_pass"';" > $OUTPUT 2>&1
mysql -u root -p"$password" -e "GRANT ALL ON "$db_name".* TO '"$db_user"'@'localhost';" > $OUTPUT 2>&1
mysql -u root -p"$password" -e "FLUSH PRIVILEGES;" > $OUTPUT 2>&1
#Creating webfolder
mkdir -p /var/www/"$domain"/public
#Ceating content
echo "<html><head></head><body>$webserv has been succsefully installed by the Wizard<br>Ready for FontControler installation</body></html>" > /var/www/$domain/public/index.html
#Setup PHP Pool
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/frontcontroller/Fpm-Pool.conf-unconfigured -o "$phpPoolDir"/"$sitename".conf
sed -i -e 's/PHPver/'$phpver'/g' -e 's/SITEname/'$sitename'/g' -e 's/DOMAINname/'$domain'/' "$phpPoolDir"/$sitename.conf
groupadd "$sitename"
useradd -g "$sitename" "$sitename"
systemctl reload $phpFPMService
#Setting Permsissions
chown "$sitename":"$sitename" -R /var/www/"$domain"/
if [ "$shortdist" = "el8" ]; then
#Setting SeLiux perms for centos
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/$domain/(/.*)?" > $OUTPUT 2>&1
restorecon -r /var/www/ > $OUTPUT 2>&1
fi

View File

@@ -0,0 +1,5 @@
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/frontcontroller/Nginx-unconfigured -o /tmp/nginx-siteconf
sed -i -e 's/PHPver/'$phpver'/g' -e 's/DOMAINname/'$domain'/g' -e 's/SITEname/'$sitename'/g' /tmp/nginx-siteconf
sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r /tmp/nginx-siteconf' -e '/#ConfHere/c\' /etc/nginx/sites-available/"$sitename"_"$site_ext"
systemctl reload nginx

View File

@@ -0,0 +1,31 @@
#beginConf
ErrorLog ${APACHE_LOG_DIR}/SITEname_error.log
#CustomLog ${APACHE_LOG_DIR}/SITEname_custom.log combined
DirectoryIndex index.php index.html index.htm
DocumentRoot /var/www/DOMAINname/html
Redirect 301 /.well-known/carddav /remote.php/dav
Redirect 301 /.well-known/caldav /remote.php/dav
<Directory /var/www/DOMAINname/html>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
Satisfy Any
<IfModule mod_dav.c>
Dav off
</IfModule>
</Directory>
<Directory "/var/www/DOMAINname/html/data/">
Require all denied
</Directory>
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php/phpPHPver-fpm-SITEname.sock|fcgi://localhost"
</FilesMatch>
#endConf

View File

@@ -0,0 +1,45 @@
[SITEname]
user = SITEname
group = SITEname
listen = /var/run/php/phpPHPver-fpm-SITEname.sock
listen.owner = www-data
listen.group = www-data
php_admin_value[disable_functions] = exec,passthru,system
php_admin_value[error_log] = /var/log/php-fpm/error-SITEname.log
; OPCACHE SETTINGS
php_admin_value[opcache.memory_consumption] = 256
php_admin_value[opcache.enable] = 0
php_admin_value[opcache.interned_strings_buffer] = 32
php_admin_value[opcache.max_accelerated_files] = 50000
php_admin_value[opcache.max_wasted_percentage] = 5
php_admin_value[opcache.revalidate_freq] = 0
php_admin_value[opcache.validate_timestamps] = 1
; PERFORMANCE LIMITS
php_admin_value[max_input_vars] = 1000
php_admin_value[upload_max_filesize] = 1G
php_admin_value[post_max_size] = 1G
php_admin_value[max_input_time] = 60
php_admin_value[memory_limit] = 512M
; SECURITY
php_admin_value[cgi.fix_pathinfo] = 0
php_admin_value[allow_url_fopen] = Off
php_admin_value[file_uploads] = on
php_admin_value[open_basedir] = /var/www/DOMAINname/html:/var/run/php/phpPHPver-fpm-SITEname.sock:/var/lib/redis/redis.sock:/proc/meminfo:/proc/cpuinfo:/dev/urandom:/tmp
php_admin_value[session.use_strict_mode] = 1
php_admin_value[session.cookie_httponly] = 1
;HTTPSONLY php_admin_value[session.cookie_samesite] = Strict
;HTTPSONLY php_admin_value[session.cookie_secure] = 1
pm = dynamic
pm.max_children = 30
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 5
chdir = /
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp

View File

@@ -1,5 +1,5 @@
#!/bin/sh
red='\e[1;31m%s\e[0m\n'
printf "\n"
printf $red "Please run nextcloud-init.sh after the first nextcloud login"
printf $red "Please run bash ~/NextcloudInit-SITEname.sh after the first nextcloud login"
printf "\n"

View File

@@ -1,15 +1,18 @@
#beginConf
#access_log /var/log/nginx/SITEname-access.log;
error_log /var/log/nginx/SITEname-error.log;
root /var/www/DOMAINname/html;
# Set max upload size
client_max_body_size 1G;
add_header Referrer-Policy "no-referrer" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Download-Options "noopen" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Permitted-Cross-Domain-Policies "none" always;
add_header X-Robots-Tag "none" always;
add_header X-XSS-Protection "1; mode=block" always;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_hide_header X-Powered-By;
fastcgi_buffers 64 4K;
gzip on;
@@ -53,7 +56,7 @@ location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|u
fastcgi_param HTTPS on;
fastcgi_param modHeadersAvailable true;
fastcgi_param front_controller_active true;
fastcgi_pass unix:/var/run/php/phpPHPver-fpm.sock;
fastcgi_pass unix:/var/run/php/phpPHPver-fpm-SITEname.sock;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
@@ -67,12 +70,9 @@ location ~ \.(?:css|js|woff2?|svg|gif|map)$ {
try_files $uri /index.php$request_uri;
add_header Cache-Control "public, max-age=15778463";
add_header Referrer-Policy "no-referrer" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Download-Options "noopen" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Permitted-Cross-Domain-Policies "none" always;
add_header X-Robots-Tag "none" always;
add_header X-XSS-Protection "1; mode=block" always;
access_log off;
}

View File

@@ -0,0 +1,11 @@
#Apache
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/nextcloud/Apache-unconfigured -o /tmp/apache-siteconf
sed -i -e 's/PHPver/'$phpver'/g' -e 's/DOMAINname/'$domain'/g' -e 's/SITEname/'$sitename'/g' /tmp/apache-siteconf
sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r /tmp/apache-siteconf' -e '/#ConfHere/c\' "$apacheConfDir"/sites-available/"$sitename"_"$site_ext".conf
chown "$sitename":"$sitename" -R /var/www/"$domain"/html
#PHP
sed -i -e '/cgi.fix_pathinfo/c\php_admin_value[cgi.fix_pathinfo] = 1' "$phpPoolDir"/$sitename.conf
sed -i -e '/security.limit_extensions/c\php_admin_value[security.limit_extensions] = .php' "$phpPoolDir"/$sitename.conf
systemctl reload $apacheService $phpFPMService

View File

@@ -1 +0,0 @@
libmagickcore-6.q16-3-extra libxml2 openssl zlib1g libpng-dev

View File

@@ -0,0 +1 @@
libmagickcore-6.q16-3-extra zlib1g libpng-dev

61
CMS/nextcloud/conf.sh Normal file
View File

@@ -0,0 +1,61 @@
#PHP Pool
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/nextcloud/Fpm-Pool.conf-unconfigured -o "$phpPoolDir"/"$sitename".conf
sed -i -e 's/PHPver/'$phpver'/g' -e 's/SITEname/'$sitename'/g' -e 's/DOMAINname/'$domain'/g' "$phpPoolDir"/$sitename.conf
groupadd "$sitename"
useradd -g "$sitename" "$sitename"
mkdir -p /var/www/"$domain"/html/data
#Getting Nextcloud
curl --retry 7 --retry-delay 5 -s http://mirror.nxdi.nl/resources/nextcloud/latest.tar.bz2 -o /tmp/nextcloud.tar.bz2
tar jxf /tmp/nextcloud.tar.bz2 -C /tmp
cp -a /tmp/nextcloud/. /var/www/"$domain"/html
touch /var/www/"$domain"/html/data/nextcloud.log > $OUTPUT 2>&1
#Creating DB
db_suffix=`expr $(ls -l /var/www | grep -c ^d) - 1`
db_name="nextcloud_$db_suffix"
db_user="nextcloud_$db_suffix"
db_pass=$(tr -dc 'A-Za-z0-9!#%()*+,-.:;<=>?@[]^_{|}~' </dev/urandom | head -c 30 ; echo)
mysql -u root -p"$password" -e "CREATE DATABASE "$db_name" DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;" > $OUTPUT 2>&1
mysql -u root -p"$password" -e "CREATE USER '"$db_user"'@'localhost' IDENTIFIED BY '"$db_pass"';" > $OUTPUT 2>&1
mysql -u root -p"$password" -e "GRANT ALL ON "$db_name".* TO '"$db_user"'@'localhost';" > $OUTPUT 2>&1
mysql -u root -p"$password" -e "FLUSH PRIVILEGES;" > $OUTPUT 2>&1
#Configuring Nextcloud
cat <<EOF > /var/www/$domain/html/config/autoconfig.php
<?php
\$AUTOCONFIG = array(
"dbtype" => "mysql",
"dbname" => "${db_name}",
"dbuser" => "${db_user}",
"dbpass" => "${db_pass}",
"dbhost" => "127.0.0.1",
"dbtableprefix" => "",
"simpleSignUpLink.shown" => false,
"directory" => "/var/www/$domain/html/data",
);
EOF
#Setting Permsissions
chown "$sitename":"$sitename" -R /var/www/"$domain"/html
if [ "$shortdist" = "el8" ]; then
#Setting SeLiux perms for centos
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/$domain/html(/.*)?" > $OUTPUT 2>&1
restorecon -r /var/www/ > $OUTPUT 2>&1
fi
#Makeing nextcloud Finalize script and setting login Notice
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/nextcloud/nextcloud-init.sh -o ~/NextcloudInit-"$sitename".sh
sed -i -e 's/DOMAINname/'$domain'/' -e 's/SITEname/'$sitename'/' ~/NextcloudInit-"$sitename".sh
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/nextcloud/MotdNextCloud -o /etc/update-motd.d/51-nextnotice-"${sitename//_}"
sed -i -e 's/SITEname/'$sitename'/' /etc/update-motd.d/51-nextnotice-"${sitename//_}"
chmod +x /etc/update-motd.d/51-nextnotice-"${sitename//_}"
#fail2ban
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/config/fail2ban/Jails/nextcloud_unconfigured -o /etc/fail2ban/jail.d/"$sitename"-nextcloud.local
sed -i 's/DOMain/'$domain'/' /etc/fail2ban/jail.d/"$sitename"-nextcloud.local
systemctl reload "$phpFPMService"

View File

@@ -0,0 +1 @@
ImageMagick-libs zlib libpng

View File

@@ -0,0 +1 @@
libxml2 openssl PHPprefix-bcmath PHPprefix-gmp bzip2

View File

@@ -1,4 +1,34 @@
sudo -u www-data php /var/www/DOMAINname/html/occ db:convert-filecache-bigint
sudo -u www-data php /var/www/DOMAINname/html/occ db:add-missing-indices
echo "*/5 * * * * www-data php -f /var/www/DOMAINname/html/cron.php > /dev/null 2>&1" >> /etc/crontab
rm -f /etc/update-motd.d/50-nextnotice
sudo -u SITEname php /var/www/DOMAINname/html/occ db:convert-filecache-bigint
sudo -u SITEname php /var/www/DOMAINname/html/occ db:add-missing-indices
sudo -u SITEname php /var/www/DOMAINname/html/occ app:disable firstrunwizard
sudo -u SITEname php /var/www/DOMAINname/html/occ config:system:set default_language --value=nl
sudo -u SITEname php /var/www/DOMAINname/html/occ config:system:set default_locale --value=nl
sudo -u SITEname php /var/www/DOMAINname/html/occ config:system:set skeletondirectory --value=
sudo -u SITEname php /var/www/DOMAINname/html/occ config:system:set memcache.local --value='\OC\Memcache\APCu'
if [ "$(systemctl is-active redis-server)" = "active" ] || [ "$(systemctl is-active redis)" = "active" ]; then
sudo -u SITEname php /var/www/DOMAINname/html/occ config:system:set memcache.distributed --value='\OC\Memcache\Redis'
sudo -u SITEname php /var/www/DOMAINname/html/occ config:system:set memcache.locking --value='\OC\Memcache\Redis'
sudo -u SITEname php /var/www/DOMAINname/html/occ config:system:set redis host --value=localhost
sudo -u SITEname php /var/www/DOMAINname/html/occ config:system:set redis port --value=6379
else
echo "Redis running on this system"
fi
echo "*/5 * * * * SITEname php -f /var/www/DOMAINname/html/cron.php > /dev/null 2>&1" >> /etc/crontab
sn2=SITEname
rm -f /etc/update-motd.d/51-nextnotice-${sn2//_}
#Remove script
while true; do
read -p "Remove this script -> yes/no?" yn
case $yn in
[Nn]* )
break;;
[Yy]* )
rm -- "$0"
break;;
* )echo "Choose yes or no.";;
esac
done

View File

@@ -1,60 +1,15 @@
#Nextcloud major release version
nxtVer=18
#Configuring nginx
wget -q -t7 "$repo"/raw/branch/"$branch"/CMS/nextcloud/Nginx-unconfigured -O /tmp/nginx-siteconf
sed -i -e 's/PHPver/'$phpver'/g' -e 's/DOMAINname/'$domain'/' /tmp/nginx-siteconf
sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r /tmp/nginx-siteconf' -e '/#ConfHere/c\' /etc/nginx/sites-enabled/"$domain"
if [ $sslenable = 0 ]; then
sed -i -e '/fastcgi_param HTTPS/c\# fastcgi_param HTTPS' /etc/nginx/sites-enabled/"$domain"
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/nextcloud/Nginx-unconfigured -o /tmp/nginx-siteconf
sed -i -e 's/PHPver/'$phpver'/g' -e 's/DOMAINname/'$domain'/g' -e 's/SITEname/'$sitename'/g' /tmp/nginx-siteconf
sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r /tmp/nginx-siteconf' -e '/#ConfHere/c\' /etc/nginx/sites-available/"$sitename"_"$site_ext"
if [ $site_ext = nossl ]; then
sed -i -e '/fastcgi_param HTTPS/c\# fastcgi_param HTTPS' /etc/nginx/sites-available/"$sitename"_nossl
fi
mkdir -p /var/www/"$domain"/html
#Configuring PHP
if [ -z ${ignphpcms+x} ]; then ignphpcms=0;fi
if [ $ignphpcms != 1 ]; then
sed -i '/upload_max_filesize/c\upload_max_filesize = 1G' /etc/php/"$phpver"/fpm/php.ini
sed -i '/post_max_size/c\post_max_size = 1G' /etc/php/"$phpver"/fpm/php.ini
sed -i '/memory_limit/c\memory_limit = 512M' /etc/php/"$phpver"/fpm/php.ini
fi
#Getting Nextcloud
wget -t7 https://download.nextcloud.com/server/releases/latest-"$nxtVer".tar.bz2 -O /tmp/nextcloud.tar.bz2
tar jxf /tmp/nextcloud.tar.bz2 -C /tmp
cp -a /tmp/nextcloud/. /var/www/"$domain"/html
#Creating DB
db_suffix=`expr $(ls -l /var/www | grep -c ^d)`
db_name="nextcloud_$db_suffix"
db_user="nextcloud_$db_suffix"
db_pass=$(date +%s|sha256sum|base64|head -c 32)
mysql -u root -p"$password" -e "CREATE DATABASE "$db_name" DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;" > $OUTPUT 2>&1
mysql -u root -p"$password" -e "CREATE USER '"$db_user"'@'localhost' IDENTIFIED BY '"$db_pass"';" > $OUTPUT 2>&1
mysql -u root -p"$password" -e "GRANT ALL ON "$db_name".* TO '"$db_user"'@'localhost';" > $OUTPUT 2>&1
mysql -u root -p"$password" -e "FLUSH PRIVILEGES;" > $OUTPUT 2>&1
#Configuring Nextcloud
cat <<EOF > /var/www/$domain/html/config/autoconfig.php
<?php
\$AUTOCONFIG = array(
"dbtype" => "mysql",
"dbname" => "${db_name}",
"dbuser" => "${db_user}",
"dbpass" => "${db_pass}",
"dbhost" => "localhost",
"dbtableprefix" => "",
"simpleSignUpLink.shown" => false,
"directory" => "/var/www/$domain/html/data",
);
EOF
chown www-data:www-data -R /var/www/"$domain"/html
systemctl reload nginx php$phpver-fpm
systemctl reload nginx
#Makeing nextcloud Finalize script and setting login Notice
wget -q -t7 "$repo"/raw/branch/"$branch"/CMS/nextcloud/nextcloud-init.sh -O ~/nextcloud-init.sh
sed -i -e 's/DOMAINname/'$domain'/' ~/nextcloud-init.sh
wget -q -t7 "$repo"/raw/branch/"$branch"/CMS/nextcloud/MotdNextCloud -O /etc/update-motd.d/50-nextnotice
chmod +x /etc/update-motd.d/50-nextnotice

View File

@@ -0,0 +1,22 @@
#beginConf
ErrorLog ${APACHE_LOG_DIR}/SITEname_error.log
#CustomLog ${APACHE_LOG_DIR}/SITEname_custom.log combined
DirectoryIndex index.php index.html index.htm
DocumentRoot /var/www/DOMAINname/html
#Include snippets/apa-backendredir.conf
<Directory /var/www/DOMAINname/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php/phpPHPver-fpm-SITEname.sock|fcgi://localhost"
</FilesMatch>
#endConf

View File

@@ -0,0 +1,39 @@
[SITEname]
user = SITEname
group = SITEname
listen = /var/run/php/phpPHPver-fpm-SITEname.sock
listen.owner = www-data
listen.group = www-data
php_admin_value[disable_functions] = exec,passthru,shell_exec,system
php_admin_value[error_log] = /var/log/php-fpm/error-SITEname.log
; OPCACHE SETTINGS
php_admin_value[opcache.memory_consumption] = 256
php_admin_value[opcache.enable] = 0
php_admin_value[opcache.interned_strings_buffer] = 32
php_admin_value[opcache.max_accelerated_files] = 50000
php_admin_value[opcache.max_wasted_percentage] = 5
php_admin_value[opcache.revalidate_freq] = 0
php_admin_value[opcache.validate_timestamps] = 1
; PERFORMANCE LIMITS
php_admin_value[max_input_vars] = 100
php_admin_value[upload_max_filesize] = 64
php_admin_value[post_max_size] = 1
php_admin_value[max_input_time] = 15
; SECURITY
php_admin_value[cgi.fix_pathinfo] = 0
php_admin_value[allow_url_fopen] = Off
php_admin_value[file_uploads] = Off
php_admin_value[open_basedir] = /var/www/DOMAINname/html:/tmp
php_admin_value[session.use_strict_mode] = 1
php_admin_value[session.cookie_httponly] = 1
;HTTPSONLY php_admin_value[session.cookie_samesite] = Strict
;HTTPSONLY php_admin_value[session.cookie_secure] = 1
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
chdir = /

View File

@@ -1,4 +1,8 @@
#beginConf
#access_log /var/log/nginx/SITEname-access.log;
error_log /var/log/nginx/SITEname-error.log;
index index.php index.html index.htm index.nginx-debian.html;
root /var/www/DOMAINname/html;
gzip on;
@@ -7,6 +11,8 @@
gzip_comp_level 2;
gzip_disable "msie6";
gzip_buffers 16 8k;
#include snippets/ngx-backendredir.conf;
location / {
#try_files $uri $uri/ =404;
@@ -16,7 +22,7 @@
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/phpPHPver-fpm.sock;
fastcgi_pass unix:/var/run/php/phpPHPver-fpm-SITEname.sock;
}
location ~ /\.ht {

View File

@@ -0,0 +1,27 @@
#beginConf
#access_log /var/log/nginx/SITEname-access.log;
error_log /var/log/nginx/SITEname-error.log;
index index.php index.html index.htm index.nginx-debian.html;
root /var/www/DOMAINname/html;
gzip on;
gzip_proxied any;
gzip_types text/plain text/css text/xml text/javascript application/javascript application/x-javascript image/svg image/svg+xml application/xml image/x-icon;
gzip_comp_level 2;
gzip_disable "msie6";
gzip_buffers 16 8k;
location / {
#try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php$is_args$args;
#try_files $uri $uri/ $uri.html $uri.php$is_args$query_string;
#'forPHP-FrondControler' try_files $uri $uri/ $uri.html /index.php$is_args$query_string;
}
location ~ /\.ht {
deny all;
}
#endConf

5
CMS/none/apache-conf.sh Normal file
View File

@@ -0,0 +1,5 @@
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/none/Apache-unconfigured -o /tmp/apache-siteconf
sed -i -e 's/PHPver/'$phpver'/g' -e 's/DOMAINname/'$domain'/g' -e 's/SITEname/'$sitename'/g' /tmp/apache-siteconf
sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r /tmp/apache-siteconf' -e '/#ConfHere/c\' "$apacheConfDir"/sites-available/"$sitename"_"$site_ext".conf
systemctl reload $apacheService

26
CMS/none/conf.sh Normal file
View File

@@ -0,0 +1,26 @@
#Creating webfolder
mkdir -p /var/www/"$domain"/html
#Ceating content
echo "<html><head></head><body>$webserv has been succsefully installed by the Wizard</body></html>" > /var/www/$domain/html/index.html
#Do not generate php pool when php is not installed
if [ $webserv != nginx_nonphp ]; then
#Setup PHP Pool
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/none/Fpm-Pool.conf-unconfigured -o "$phpPoolDir"/"$sitename".conf
sed -i -e 's/PHPver/'$phpver'/g' -e 's/SITEname/'$sitename'/g' -e 's/DOMAINname/'$domain'/' "$phpPoolDir"/$sitename.conf
groupadd "$sitename"
useradd -g "$sitename" "$sitename"
systemctl reload $phpFPMService
#Setting Permsissions
chown "$sitename":"$sitename" -R /var/www/"$domain"/html
fi
if [ "$shortdist" = "el8" ]; then
#Setting SeLiux perms for centos
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/$domain/html(/.*)?" > $OUTPUT 2>&1
restorecon -r /var/www/ > $OUTPUT 2>&1
fi

View File

@@ -1,7 +1,5 @@
wget -q -t7 "$repo"/raw/branch/"$branch"/CMS/none/Nginx-unconfigured -O /tmp/nginx-siteconf
sed -i -e 's/PHPver/'$phpver'/g' -e 's/DOMAINname/'$domain'/' /tmp/nginx-siteconf
sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r /tmp/nginx-siteconf' -e '/#ConfHere/c\' /etc/nginx/sites-enabled/"$domain"
mkdir -p /var/www/"$domain"/html
chown www-data:www-data -R /var/www/"$domain"/html
echo "<html><head></head><body>$webserv has been succsefully installed by the Wizard</body></html>" > /var/www/$domain/html/index.html
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/none/Nginx-unconfigured -o /tmp/nginx-siteconf
sed -i -e 's/PHPver/'$phpver'/g' -e 's/DOMAINname/'$domain'/g' -e 's/SITEname/'$sitename'/g' /tmp/nginx-siteconf
sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r /tmp/nginx-siteconf' -e '/#ConfHere/c\' /etc/nginx/sites-available/"$sitename"_"$site_ext"
systemctl reload nginx

View File

@@ -0,0 +1,5 @@
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/none/Nginx_nonphp-unconfigured -o /tmp/nginx-siteconf
sed -i -e 's/DOMAINname/'$domain'/g' -e 's/SITEname/'$sitename'/g' /tmp/nginx-siteconf
sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r /tmp/nginx-siteconf' -e '/#ConfHere/c\' /etc/nginx/sites-available/"$sitename"_"$site_ext"
systemctl reload nginx

View File

@@ -0,0 +1,37 @@
#beginConf
ErrorLog ${APACHE_LOG_DIR}/SITEname_error.log
#CustomLog ${APACHE_LOG_DIR}/SITEname_custom.log combined
DirectoryIndex index.php index.html index.htm
DocumentRoot /var/www/DOMAINname/html
#Include snippets/apa-backendredir.conf
<Directory /var/www/DOMAINname/html>
Options FollowSymLinks
AllowOverride Limit Options FileInfo
DirectoryIndex index.php
Order allow,deny
Allow from all
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
</Directory>
<Directory /var/www/DOMAINname/wp-content>
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php/phpPHPver-fpm-SITEname.sock|fcgi://localhost"
</FilesMatch>
#endConf

View File

@@ -0,0 +1,39 @@
[SITEname]
user = SITEname
group = SITEname
listen = /var/run/php/phpPHPver-fpm-SITEname.sock
listen.owner = www-data
listen.group = www-data
php_admin_value[error_log] = /var/log/php-fpm/error-SITEname.log
php_admin_value[disable_functions] = exec,passthru,shell_exec,system
; OPCACHE SETTINGS
php_admin_value[opcache.memory_consumption] = 256
php_admin_value[opcache.enable] = 0
php_admin_value[opcache.interned_strings_buffer] = 32
php_admin_value[opcache.max_accelerated_files] = 50000
php_admin_value[opcache.max_wasted_percentage] = 5
php_admin_value[opcache.revalidate_freq] = 0
php_admin_value[opcache.validate_timestamps] = 1
; PERFORMANCE LIMITS
php_admin_value[max_input_vars] = 5000
php_admin_value[upload_max_filesize] = 128M
php_admin_value[post_max_size] = 32M
php_admin_value[max_input_time] = 30
; SECURITY
php_admin_value[cgi.fix_pathinfo] = 0
php_admin_value[allow_url_fopen] = Off
php_admin_value[file_uploads] = on
php_admin_value[open_basedir] = /var/www/DOMAINname/html:/tmp
php_admin_value[session.use_strict_mode] = 1
php_admin_value[session.cookie_httponly] = 1
;HTTPSONLY php_admin_value[session.cookie_samesite] = Strict
;HTTPSONLY php_admin_value[session.cookie_secure] = 1
pm = dynamic
pm.max_children = 20
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
chdir = /

View File

@@ -0,0 +1,5 @@
#!/bin/sh
red='\e[1;31m%s\e[0m\n'
printf "\n"
printf $red "Please run bash ~/WordpressInit-SITEname.sh after the first wordpress login"
printf "\n"

View File

@@ -1,4 +1,8 @@
#beginConf
#access_log /var/log/nginx/SITEname-access.log;
error_log /var/log/nginx/SITEname-error.log;
root /var/www/DOMAINname/html;
index index.php index.htm index.html;
@@ -8,7 +12,8 @@ gzip_types text/plain text/css text/xml text/javascript application/javascript a
gzip_comp_level 2;
gzip_disable "msie6";
gzip_buffers 16 8k;
#include snippets/ngx-backendredir.conf;
location / {
try_files $uri $uri/ /index.php$is_args$args;
@@ -24,7 +29,7 @@ location ~* \.(css|gif|ico|jpeg|jpg|js|png|svg|webp|eot|otf|woff|woff2|ttf|ogg)$
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/phpPHPver-fpm.sock;
fastcgi_pass unix:/var/run/php/phpPHPver-fpm-SITEname.sock;
}
location ~ /\.ht {

View File

@@ -2,7 +2,7 @@
define('DB_NAME', 'DBName');
define('DB_USER', 'DBUser');
define('DB_PASSWORD', 'DBPass');
define('DB_HOST', 'localhost');
define('DB_HOST', '127.0.0.1');
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
#define( 'WP_SITEURL', '' );
@@ -25,8 +25,6 @@ define('FS_METHOD','direct');
#$table_prefix = 'DBName';
$table_prefix = 'wp';
WPsalty
define('WP_DEBUG', false);
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
@@ -39,4 +37,4 @@ if ( !defined('ABSPATH') )
#define('WP_REDIS_HOST', '127.0.0.1');
#define('WP_REDIS_PASSWORD', '<RedisPassword>');
#define('WP_REDIS_PORT', '6379');
require_once(ABSPATH . 'wp-settings.php');

View File

@@ -0,0 +1,6 @@
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/wordpress/Apache-unconfigured -o /tmp/apache-siteconf
sed -i -e 's/PHPver/'$phpver'/g' -e 's/DOMAINname/'$domain'/g' -e 's/SITEname/'$sitename'/g' /tmp/apache-siteconf
sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r /tmp/apache-siteconf' -e '/#ConfHere/c\' "$apacheConfDir"/sites-available/"$sitename"_"$site_ext".conf
chown "$sitename":"$sitename" -R /var/www/"$domain"/html
systemctl reload $apacheService $phpFPMService

View File

@@ -1,9 +1,16 @@
#WP-CLI
if [ ! -f /usr/local/bin/wp ]; then
curl --retry 7 --retry-delay 5 -s https://raw.githubusercontent.com/wp-cli/wp-cli/v2.4.0/utils/wp-completion.bash -o /etc/bash_completion.d/wp
curl --retry 7 --retry-delay 5 -s https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -o /usr/local/bin/wp
chmod +x /usr/local/bin/wp
fi
#Creating DB
db_suffix=`expr $(ls -l /var/www | grep -c ^d) - 1`
db_name="wp_$db_suffix"
db_user="wp_$db_suffix"
db_pass=$(date +%s|sha256sum|base64|head -c 32)
WPSalts=$(wget https://api.wordpress.org/secret-key/1.1/salt/ -q -O -)
db_pass=$(tr -dc 'A-Za-z0-9!#%()*+,-.:;<=>?@[]^_{|}~' </dev/urandom | head -c 30 ; echo)
WPSalts=$(curl --retry 7 --retry-delay 5 -s https://api.wordpress.org/secret-key/1.1/salt/)
#Setting up Database
mysql -u root -p"$password" -e "CREATE DATABASE "$db_name" DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;" > $OUTPUT 2>&1
@@ -15,14 +22,44 @@ mysql -u root -p"$password" -e "FLUSH PRIVILEGES;" > $OUTPUT 2>&1
mkdir -p /var/www/"$domain"/html
#Getting WordPress
wget -q -t7 https://wordpress.org/latest.tar.gz -O /tmp/wp.tar.gz
curl --retry 7 --retry-delay 5 -s http://mirror.nxdi.nl/resources/wordpress/latest.tar.gz -o /tmp/wp.tar.gz
tar -C /var/www/"$domain"/html -xzf /tmp/wp.tar.gz --strip 1
rm /var/www/"$domain"/html/wp-config-sample.php
#Configuring WordPress
wget -q -t7 "$repo"/raw/branch/"$branch"/CMS/wordpress/WordPress-unconfigured -O /var/www/"$domain"/html/wp-config.php
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/wordpress/WordPress-unconfigured -o /var/www/"$domain"/html/wp-config.php
sed -i -e 's/DBPass/'$db_pass'/' -e 's/DBUser/'$db_user'/' -e 's/DBName/'$db_name'/' -e 's/DOMAINname/'$domain'/' /var/www/"$domain"/html/wp-config.php
printf '%s\n' "g/WPsalty/d" a "$WPSalts" . w | ed -s /var/www/"$domain"/html/wp-config.php
printf '%s\n' "$WPSalts" >> /var/www/"$domain"/html/wp-config.php
printf '%s\n' "require_once(ABSPATH . 'wp-settings.php');" >> /var/www/"$domain"/html/wp-config.php
#PHP Pool
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/wordpress/Fpm-Pool.conf-unconfigured -o "$phpPoolDir"/"$sitename".conf
sed -i -e 's/PHPver/'$phpver'/g' -e 's/SITEname/'$sitename'/g' -e 's/DOMAINname/'$domain'/g' "$phpPoolDir"/$sitename.conf
groupadd "$sitename"
useradd -g "$sitename" "$sitename"
systemctl reload $phpFPMService
#fail2ban
if [ ! -f /etc/fail2ban/jail.d/wordpress-syslog.local ]; then
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/config/fail2ban/Jails/wordpress-syslog.jail -o /etc/fail2ban/jail.d/wordpress-syslog.local
if [ "$shortdist" = "el8" ]; then
sed -i '/logpath/c\logpath = /var/log/messages' /etc/fail2ban/jail.d/wordpress-syslog.local
fi
fi
#Setting Permsissions
chown www-data:www-data -R /var/www/"$domain"/html
chown "$sitename":"$sitename" -R /var/www/"$domain"/html
if [ "$shortdist" = "el8" ]; then
#Setting SeLiux perms for centos
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/$domain/html(/.*)?" > $OUTPUT 2>&1
restorecon -r /var/www/ > $OUTPUT 2>&1
fi
#Makeing wordpress Finalize script and setting login Notice
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/wordpress/wordpress-init.sh -o ~/WordpressInit-"$sitename".sh
sed -i -e 's/DOMAINname/'$domain'/' -e 's/SITEname/'$sitename'/' ~/WordpressInit-"$sitename".sh
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/wordpress/MotdWordpress -o /etc/update-motd.d/51-wpnotice-"${sitename//_}"
sed -i -e 's/SITEname/'$sitename'/' /etc/update-motd.d/51-wpnotice-"${sitename//_}"
chmod +x /etc/update-motd.d/51-wpnotice-"${sitename//_}"

View File

@@ -1,15 +1,7 @@
#Configuring PHP
if [ -z ${ignphpcms+x} ]; then ignphpcms=0;fi
if [ $ignphpcms != 1 ]; then
sed -i '/upload_max_filesize/c\upload_max_filesize = 1G' /etc/php/"$phpver"/fpm/php.ini
sed -i '/post_max_size/c\post_max_size = 512M' /etc/php/"$phpver"/fpm/php.ini
sed -i '/memory_limit/c\memory_limit = 512M' /etc/php/"$phpver"/fpm/php.ini
fi
#Configuring nginx
wget -q -t7 "$repo"/raw/branch/"$branch"/CMS/wordpress/Nginx-unconfigured -O /tmp/nginx-siteconf
sed -i -e 's/PHPver/'$phpver'/g' -e 's/DOMAINname/'$domain'/' /tmp/nginx-siteconf
sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r /tmp/nginx-siteconf' -e '/#ConfHere/c\' /etc/nginx/sites-enabled/"$domain"
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/wordpress/Nginx-unconfigured -o /tmp/nginx-siteconf
sed -i -e 's/PHPver/'$phpver'/g' -e 's/DOMAINname/'$domain'/g' -e 's/SITEname/'$sitename'/g' /tmp/nginx-siteconf
sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r /tmp/nginx-siteconf' -e '/#ConfHere/c\' /etc/nginx/sites-available/"$sitename"_"$site_ext"
#Reloading Services
systemctl reload nginx php$phpver-fpm
systemctl reload nginx $phpFPMService

View File

@@ -0,0 +1,23 @@
sudo -u SITEname /usr/local/bin/wp --path=/var/www/DOMAINname/html core update
sudo -u SITEname /usr/local/bin/wp --path=/var/www/DOMAINname/html theme update --all
sudo -u SITEname /usr/local/bin/wp --path=/var/www/DOMAINname/html plugin install wp-fail2ban --activate
sudo -u SITEname /usr/local/bin/wp --path=/var/www/DOMAINname/html plugin install all-in-one-wp-migration --activate
sudo -u SITEname /usr/local/bin/wp --path=/var/www/DOMAINname/html plugin install https://git.ictmaatwerk.com/downloads/wp/migrate.zip --activate
sudo -u SITEname /usr/local/bin/wp --path=/var/www/DOMAINname/html cron event run wp_update_plugins
sudo -u SITEname /usr/local/bin/wp --path=/var/www/DOMAINname/html plugin update --all
echo -e "\e[96m Please update all-in-one-wp-migration-unlimited plugin manually\e[39m"
sn2=SITEname
rm -f /etc/update-motd.d/51-wpnotice-${sn2//_}
#Remove script
while true; do
read -p "Remove this script -> yes/no?" yn
case $yn in
[Nn]* )
break;;
[Yy]* )
rm -- "$0"
break;;
* )echo "Choose yes or no.";;
esac
done

View File

@@ -0,0 +1,22 @@
##############
# Apache #
##############
if [ $domainwww = 1 ]; then
#non-ssl
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site-wwwredir >> "$apacheConfDir"/sites-available/"$sitename"_nossl.conf
echo "" >> "$apacheConfDir"/sites-available/"$sitename"_nossl.conf
#ssl
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site_ssl-wwwredir >> "$apacheConfDir"/sites-available/"$sitename"_ssl.conf
echo "" >> "$apacheConfDir"/sites-available/"$sitename"_ssl.conf
fi
#non-ssl
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site-unconfigured >> "$apacheConfDir"/sites-available/"$sitename"_nossl.conf
sed -i -e 's/DOMAINname/'$domain'/g' "$apacheConfDir"/sites-available/"$sitename"_nossl.conf
ln -s "$apacheConfDir"/sites-available/"$sitename"_nossl.conf "$apacheConfDir"/sites-enabled/010-"$sitename".conf
#ssl
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site_ssl-unconfigured >> "$apacheConfDir"/sites-available/"$sitename"_ssl.conf
sed -i -e 's/DOMAINname/'$domain'/g' "$apacheConfDir"/sites-available/"$sitename"_ssl.conf
systemctl reload $apacheService

View File

@@ -1 +0,0 @@
apache2 php-pear libapache2-mod-php phpPHPver-mysql phpPHPver-cgi phpPHPver-common phpPHPver-mbstring phpPHPver-curl phpPHPver-gd phpPHPver-intl phpPHPver-soap phpPHPver-xml phpPHPver-xmlrpc phpPHPver-zip python-certbot-apache

View File

@@ -0,0 +1 @@
apache2 libapache2-mod-fcgid

View File

@@ -0,0 +1,74 @@
systemctl stop $apacheService > $OUTPUT 2>&1
##############
# Apache #
##############
if [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ] ; then
a2dissite 000-default > $OUTPUT 2>&1
a2dismod mpm_prefork > $OUTPUT 2>&1
a2enmod actions fcgid alias proxy_fcgi proxy_http ssl headers http2 setenvif socache_shmcb rewrite > $OUTPUT 2>&1
mkdir -p "$apacheConfDir"/snippets/
monitconf=/etc/monit/monitrc
elif [ "$shortdist" = "el8" ]; then
echo 'IncludeOptional conf-enabled/*.conf' >>/etc/httpd/conf/httpd.conf
echo 'IncludeOptional sites-enabled/*.conf' >>/etc/httpd/conf/httpd.conf
sed -i -e '/User apache/c\User www-data' -e '/Group apache/c\Group www-data' /etc/httpd/conf/httpd.conf
sed -i 's/^/#/g' /etc/httpd/conf.d/welcome.conf
#Creating directories
mkdir -p /etc/httpd/{sites-available,sites-enabled,conf-enabled,conf-available,snippets}
#getting aditional apache config for centos
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/conf-httpd-custom.conf -o "$apacheConfDir"/conf-enabled/zzz-Httpd-custom.conf
monitconf=/etc/monitrc
fi
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/snippets-ssl.conf -o "$apacheConfDir"/snippets/apa-ssl.conf
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/snippets-backendredir.conf -o "$apacheConfDir"/snippets/apa-backendredir.conf
sed -i -e 's/HOSTname/'$hostname'/' "$apacheConfDir"/snippets/apa-backendredir.conf
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/conf-custom.conf -o "$apacheConfDir"/conf-enabled/zzz-custom.conf
#Catch all (ip and unconfigured domains)
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site_CatchAll -o "$apacheConfDir"/sites-available/CatchAll.conf
ln -s "$apacheConfDir"/sites-available/CatchAll.conf "$apacheConfDir"/sites-enabled/999-CatchAll.conf
if [ $domainwww = 1 ]; then
#non-ssl
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site-wwwredir >> "$apacheConfDir"/sites-available/"$sitename"_nossl.conf
echo "" >> "$apacheConfDir"/sites-available/"$sitename"_nossl.conf
#ssl
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site_ssl-wwwredir >> "$apacheConfDir"/sites-available/"$sitename"_ssl.conf
echo "" >> "$apacheConfDir"/sites-available/"$sitename"_ssl.conf
fi
#non-ssl
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site-unconfigured >> "$apacheConfDir"/sites-available/"$sitename"_nossl.conf
sed -i -e 's/DOMAINname/'$domain'/g' "$apacheConfDir"/sites-available/"$sitename"_nossl.conf
ln -s "$apacheConfDir"/sites-available/"$sitename"_nossl.conf "$apacheConfDir"/sites-enabled/010-"$sitename".conf
#ssl
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site_ssl-unconfigured >> "$apacheConfDir"/sites-available/"$sitename"_ssl.conf
sed -i -e 's/DOMAINname/'$domain'/g' "$apacheConfDir"/sites-available/"$sitename"_ssl.conf
#non-ssl-Backend
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site-unconfigured >> "$apacheConfDir"/sites-available/Backend_nossl.conf
sed -i -e 's/DOMAINname/'$hostname'/g' "$apacheConfDir"/sites-available/Backend_nossl.conf
ln -s "$apacheConfDir"/sites-available/Backend_nossl.conf "$apacheConfDir"/sites-enabled/010-Backend.conf
#ssl-Backend
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site_ssl-unconfigured >> "$apacheConfDir"/sites-available/Backend_ssl.conf
sed -i -e 's/DOMAINname/'$hostname'/g' "$apacheConfDir"/sites-available/Backend_ssl.conf
#BackendToggle
mkdir -p /opt/toggle
##Phpmyadmin
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/toggles/toggle-PhpMyAdmin_APACHE.sh -o /opt/toggle/toggle-PhpMyAdmin.sh
sed -i -e 's/APASRV/'$apacheService'/' -e 's#APADIR#'$apacheConfDir'#' /opt/toggle/toggle-PhpMyAdmin.sh
##monit
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/toggles/toggle-Monit_APACHE.sh -o /opt/toggle/toggle-MonitWebui.sh
sed -i -e 's#MONITCONF#'$monitconf'#' -e 's/APASRV/'$apacheService'/' -e 's#APADIR#'$apacheConfDir'#' /opt/toggle/toggle-MonitWebui.sh
unset monitconf
# custom Welcome page
echo "<html><head></head><body>$webserv is functioning normally</body></html>" > /var/www/html/index.html
systemctl start $apacheService > $OUTPUT 2>&1
systemctl enable $apacheService > $OUTPUT 2>&1

View File

@@ -0,0 +1,3 @@
SSLStaplingCache "shmcb:logs/ssl_stapling(32768)"
ServerTokens Prod
ServerSignature Off

View File

@@ -0,0 +1 @@
Define APACHE_LOG_DIR /var/log/httpd

View File

@@ -0,0 +1,6 @@
<VirtualHost *:80>
ServerName DOMAINname
#ConfHere
</VirtualHost>

View File

@@ -0,0 +1,4 @@
<VirtualHost *:80>
ServerName www.DOMAINname
Redirect permanent / http://DOMAINname/
</VirtualHost>

View File

@@ -0,0 +1,8 @@
<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName localhost
ServerAlias "*"
ErrorLog /dev/null
CustomLog /dev/null common
</VirtualHost>

View File

@@ -0,0 +1,15 @@
<VirtualHost *:80>
ServerName DOMAINname
Redirect permanent / https://DOMAINname/
</VirtualHost>
<VirtualHost *:443>
ServerName DOMAINname
SSLEngine on
SSLCertificateFile /etc/acmesh/certs/DOMAINname_ecc/fullchain.cer
SSLCertificateKeyFile /etc/acmesh/certs/DOMAINname_ecc/DOMAINname.key
Include snippets/apa-ssl.conf
#ConfHere
</VirtualHost>

View File

@@ -0,0 +1,13 @@
<VirtualHost *:80>
ServerName www.DOMAINname
Redirect permanent / https://DOMAINname/
</VirtualHost>
<VirtualHost *:443>
ServerName www.DOMAINname
SSLEngine on
SSLCertificateFile /etc/acmesh/certs/DOMAINname_ecc/fullchain.cer
SSLCertificateKeyFile /etc/acmesh/certs/DOMAINname_ecc/DOMAINname.key
Include snippets/apa-ssl.conf
Redirect permanent / https://DOMAINname/
</VirtualHost>

View File

@@ -0,0 +1 @@
Redirect 301 /database http://HOSTname/backend/database

View File

@@ -0,0 +1,8 @@
Protocols h2 http/1.1
Header always set Strict-Transport-Security "max-age=63072000"
SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
SSLHonorCipherOrder on
SSLOpenSSLConfCmd Curves secp384r1
SSLSessionTickets off
SSLUseStapling On

View File

@@ -0,0 +1 @@
httpd mod_fcgid mod_ssl

View File

@@ -0,0 +1,27 @@
if [ ! -f "/etc/ICTM/apachevar.list" ] ; then bash <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/GenerateApacheList.sh) ; fi
source /etc/ICTM/apachevar.list
for f in $apacheConfDir/sites-available/*; do
if [ $IMODE = n ] && [ $PhpPurge = 0 ]; then
if (whiptail --title "Update apache config ?" --yesno "Update php version in apache site: ${f##*/} ?" 8 78); then
sed -i "s/$phpver/$newphpver/" $f
fi
fi
if [ $IMODE = l ] && [ $PhpPurge = 0 ]; then
while true; do
read -p "Update php version in apache site: ${f##*/} ? -> yes/no?" yn
case $yn in
[Yy]* ) sed -i "s/$phpver/$newphpver/" $f
break;;
[Nn]* ) echo ""
break;;
* ) echo "Choose yes of no.";;
esac
done
fi
if [ $PhpPurge = 1 ]; then
sed -i "s/$phpver/$newphpver/" $f
fi
done
systemctl reload $apacheService

View File

@@ -0,0 +1,17 @@
if [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ] ; then
# Debian/Ubunbtu apache variables
apacheConfDir=/etc/apache2
apacheService=apache2
elif [ "$shortdist" = "el8" ]; then
# Centos Php variable
apacheConfDir=/etc/httpd
apacheService=httpd
fi
#Storing vars to config
for storeme in apacheService apacheConfDir; do
declare -p $storeme | cut -d ' ' -f 3- >> /etc/ICTM/apachevar.list
done
curl --retry 7 --retry-delay 5 -s https://git.ictmaatwerk.com/VPS-scripts/General/raw/branch/Main/Setup-Repo.sh |repo=apache osrel=$shortdist bash > $OUTPUT 2>&1 > $OUTPUT 2>&1

View File

@@ -0,0 +1 @@
aonoption="$aonoption php-fpm"

View File

@@ -0,0 +1,9 @@
rm "$apacheConfDir"/sites-enabled/010-"$sitename".conf
ln -s "$apacheConfDir"/sites-available/"$sitename"_"$site_ext".conf "$apacheConfDir"/sites-enabled/010-"$sitename".conf
if [ -n "$sslfr" ]; then
rm "$apacheConfDir"/sites-enabled/010-Backend.conf
ln -s "$apacheConfDir"/sites-available/Backend_"$siteBackend_ext".conf "$apacheConfDir"/sites-enabled/010-Backend.conf
fi
systemctl reload $apacheService

View File

@@ -1 +0,0 @@
mailutils htop ufw

View File

@@ -0,0 +1 @@
cron

View File

@@ -1,43 +1,63 @@
##-------------##
# Postfix #
##-------------##
sed -i 's/#inet_interfaces = all/inet_interfaces = loopback-only/g' /etc/postfix/main.cf
sed -i 's/mydestination/#mydestination/g' /etc/postfix/main.cf
sed -i 's/relayhost =/mydestination = '$hostname', localhost.'$hostname', '$hostname'/g' /etc/postfix/main.cf
cat <<EOF > /etc/aliases
# See man 5 aliases for format
postmaster: root
root: $email
EOF
newaliases
##------------##
# Fail2Ban #
##------------##
##Disabled
#sed -i 's/root@localhost/'$email'/g' /etc/fail2ban/jail.conf
#wget -q -t7 "$repo"/raw/branch/"$branch"/config/fail2ban/sshd.local -O /etc/fail2ban/jail.d/sshd.local
#if [[ $CMS == "Nextcloud" ]]; then
#wget -q -t7 "$repo"/raw/branch/"$branch"/config/fail2ban/nextcloud.conf -O /etc/fail2ban/filter.d/nextcloud.conf
#wget -q -t7 "$repo"/raw/branch/"$branch"/config/fail2ban/nextcloud.local -O /etc/fail2ban/jail.d/nextcloud.local
#fi
#if [[ $CMS == "Wordpress" ]]; then
#wget -q -t7 "$repo"/raw/branch/"$branch"/config/fail2ban/wordpress.conf -O /etc/fail2ban/filter.d/wordpress.conf
#wget -q -t7 "$repo"/raw/branch/"$branch"/config/fail2ban/wordpress.local -O /etc/fail2ban/jail.d/wordpress.local
#fi
##----------##
# Centos #
##----------##
if [ "$shortdist" = "el8" ]; then
#SeLinux
semanage port -a -t ssh_port_t -p tcp 4242
systemctl enable ufw > $OUTPUT 2>&1
#Motd
mkdir /etc/update-motd.d
echo 'if stat --printf="" /etc/update-motd.d/51* 2>/dev/null; then for f in /etc/update-motd.d/51*; do bash $f; done; fi' >> /etc/profile
fi
##-------##
# UFW #
##-------##
if [ "$shortdist" = "el8" ]; then
sed -i -e '/tuple/d' -e '/dapp/d' /usr/share/ufw/iptables/user.rules
sed -i -e '/tuple/d' -e '/dapp/d' /usr/share/ufw/iptables/user6.rules
echo "y" | ufw reset > $OUTPUT 2>&1
systemctl enable ufw > $OUTPUT 2>&1
fi
sed -i '/IPV6=/c\IPV6=yes' /etc/default/ufw
ufw default deny incoming > $OUTPUT 2>&1
ufw default allow outgoing > $OUTPUT 2>&1
ufw allow 80/tcp > $OUTPUT 2>&1
ufw allow 443/tcp > $OUTPUT 2>&1
ufw limit 4242/tcp > $OUTPUT 2>&1
echo "y" | ufw enable > $OUTPUT 2>&1
echo "y" | ufw enable > $OUTPUT 2>&1
##------------##
# Fail2Ban #
##------------##
#General config
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/config/fail2ban/jail.local -o /etc/fail2ban/jail.local
#Custom Fiters
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/config/fail2ban/Filters/nextcloud.filter -o /etc/fail2ban/filter.d/nextcloud.local
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/config/fail2ban/Filters/phpmyadmin-authlog.filter -o /etc/fail2ban/filter.d/phpmyadmin-authlog.local
curl --retry 7 --retry-delay 5 -s https://plugins.svn.wordpress.org/wp-fail2ban/trunk/filters.d/wordpress-hard.conf -o /etc/fail2ban/filter.d/wordpress-hard.local
curl --retry 7 --retry-delay 5 -s https://plugins.svn.wordpress.org/wp-fail2ban/trunk/filters.d/wordpress-soft.conf -o /etc/fail2ban/filter.d/wordpress-soft.local
if [ "$shortdist" = "el8" ]; then
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/config/fail2ban/action.d/ufw.conf -o /etc/fail2ban/action.d/ufw.conf
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/config/selinux/policies/fail2ban-allowhttpd.te -o /tmp/fail2ban-allowhttpd.te
checkmodule -M -m -o /tmp/fail2ban-allowhttpd.mod /tmp/fail2ban-allowhttpd.te
semodule_package -o /tmp/fail2ban-allowhttpd.pp -m /tmp/fail2ban-allowhttpd.mod
semodule -i /tmp/fail2ban-allowhttpd.pp
fi
#Start fail2ban service
systemctl start fail2ban
systemctl enable fail2ban
#General jails
rm /etc/fail2ban/jail.d/*
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/config/fail2ban/Jails/sshd.jail -o /etc/fail2ban/jail.d/sshd.local
if [ -z $disbackendcms ]; then
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/config/fail2ban/Jails/phpmyadmin.jail -o /etc/fail2ban/jail.d/phpmyadmin.local
fi

View File

@@ -0,0 +1 @@
cronie policycoreutils-python-utils

View File

@@ -0,0 +1 @@
nano htop ufw nload fail2ban sudo bash-completion

View File

@@ -1,26 +1,77 @@
if [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ] ; then
########################
# Debian/Ubunbtu #
########################
##--------------##
# Repositories #
##--------------##
curl --retry 7 --retry-delay 5 -s https://git.ictmaatwerk.com/VPS-scripts/General/raw/branch/Main/Setup-Repo.sh |repo=universe osrel=$shortdist bash > $OUTPUT 2>&1
##------------##
# System #
##------------##
sed -i -e '/XKBLAYOUT=/c\XKBLAYOUT=us' -e '/XKBVARIANT=/c\XKBVARIANT="intl"' /etc/default/keyboard > $OUTPUT 2>&1
##-------------##
# Updates #
##-------------##
debconf-set-selections <<< 'libssl1.1:amd64 libraries/restart-without-asking boolean true'
$PKGUC
$PKGUP
##-------------##
# Postfix #
##-------------##
#Checking if postfix exists on this system and if so it wil be removed to prevent config conflicts
if dpkg-query -Wf'${db:Status-abbrev}' postfix 2>/dev/null | grep -q '^i'; then apt purge -y postfix > $OUTPUT 2>&1; fi
elif [ "$shortdist" = "el8" ]; then
################
# Centos #
################
##--------------##
# Repositories #
##--------------##
curl --retry 7 --retry-delay 5 -s https://git.ictmaatwerk.com/VPS-scripts/General/raw/branch/Main/Setup-Repo.sh |repo=epel osrel=$shortdist bash > $OUTPUT 2>&1
##------------##
# System #
##------------##
localectl set-keymap us > $OUTPUT 2>&1
useradd -r -U -s /usr/sbin/nologin -d /var/www www-data > $OUTPUT 2>&1
systemctl disable firewalld --now > $OUTPUT 2>&1
##-------------##
# Postfix #
##-------------##
if dnf list installed postfix >/dev/null 2>&1; then dnf remove postfix -y; fi
fi
#################
# General #
#################
##-----------------------##
# Prerequisite packages #
##-----------------------##
$PKGI software-properties-common gnupg > $OUTPUT 2>&1
curl --retry 7 --retry-delay 5 -s https://git.ictmaatwerk.com/VPS-scripts/General/raw/branch/Main/Setup-Repo.sh |repo=init osrel=$shortdist bash > $OUTPUT 2>&1
##--------------##
# Repositories #
##--------------##
$PKGA universe -y > $OUTPUT 2>&1
$PKGA ppa:ondrej/php -y -n > $OUTPUT 2>&1
$PKGA ppa:certbot/certbot -y -n > $OUTPUT 2>&1
$PKGA ppa:chris-lea/redis-server -y -n > $OUTPUT 2>&1
##-------------##
# Updates #
##-------------##
debconf-set-selections <<< 'libssl1.1:amd64 libraries/restart-without-asking boolean true'
$PKGM update
$PKGM upgrade -y
curl --retry 7 --retry-delay 5 -s https://git.ictmaatwerk.com/VPS-scripts/General/raw/branch/Main/Setup-Repo.sh |repo=php osrel=$shortdist bash > $OUTPUT 2>&1
##------------##
@@ -28,9 +79,9 @@ $PKGM upgrade -y
##------------##
hostnamectl set-hostname $hostname
sed -i 's/;preserve_hostname: false/preserve_hostname: true/g' /etc/cloud/cloud.cfg
timedatectl set-timezone Europe/Amsterdam
sed -i -e '/Port 22/c\Port 4242' -e 's/PermitRootLogin yes/PermitRootLogin prohibit-password/g' /etc/ssh/sshd_config
sed -i 's/;preserve_hostname: false/preserve_hostname: true/g' /etc/cloud/cloud.cfg > $OUTPUT 2>&1
timedatectl set-timezone Europe/Amsterdam > $OUTPUT 2>&1
sed -i -e '/Port 22/c\Port 4242' -e 's/PermitRootLogin yes/PermitRootLogin prohibit-password/g' /etc/ssh/sshd_config > $OUTPUT 2>&1
##----------##
@@ -48,14 +99,3 @@ else
fi
echo "vm.swappiness=10" >> /etc/sysctl.conf
echo "vm.vfs_cache_pressure=50" >> /etc/sysctl.conf
##-------------##
# Postfix #
##-------------##
#Checking if postfix exists on this system and if so it wil be removed to prevent config conflicts
if dpkg-query -Wf'${db:Status-abbrev}' postfix 2>/dev/null | grep -q '^i'; then apt purge -y postfix > $OUTPUT 2>&1; fi
debconf-set-selections <<< "postfix postfix/mailname string $domain"
debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'"

View File

@@ -2,8 +2,21 @@
# Nginx #
#############
wget -q -t7 "$repo"/raw/branch/"$branch"/CoreModules/nginx/config/nginx/site-unconfigured -O /etc/nginx/sites-available/"$domain"
sed -i -e 's/DOMAINname/'$domain'/' /etc/nginx/sites-available/"$domain"
ln -s /etc/nginx/sites-available/"$domain" /etc/nginx/sites-enabled/
if [ $domainwww = 1 ]; then
#non-ssl
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/nginx/config/nginx/site-wwwredir >> /etc/nginx/sites-available/"$sitename"_nossl
echo "" >> /etc/nginx/sites-available/"$sitename"_nossl
#ssl
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/nginx/config/nginx/site_ssl-wwwredir >> /etc/nginx/sites-available/"$sitename"_ssl
echo "" >> /etc/nginx/sites-available/"$sitename"_ssl
fi
#non-ssl
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/nginx/config/nginx/site-unconfigured >> /etc/nginx/sites-available/"$sitename"_nossl
sed -i -e 's/DOMAINname/'$domain'/g' /etc/nginx/sites-available/"$sitename"_nossl
ln -s /etc/nginx/sites-available/"$sitename"_nossl /etc/nginx/sites-enabled/"$sitename"
#ssl
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/nginx/config/nginx/site_ssl-unconfigured >> /etc/nginx/sites-available/"$sitename"_ssl
sed -i -e 's/DOMAINname/'$domain'/g' /etc/nginx/sites-available/"$sitename"_ssl
systemctl reload nginx

View File

@@ -1 +0,0 @@
nginx phpPHPver-imagick php-pear phpPHPver-cli phpPHPver-fpm phpPHPver-mysql phpPHPver-cgi phpPHPver-common phpPHPver-mbstring phpPHPver-curl phpPHPver-gd phpPHPver-intl phpPHPver-soap phpPHPver-xml phpPHPver-xmlrpc phpPHPver-zip python-certbot-nginx

View File

@@ -0,0 +1 @@
apache2-utils

View File

@@ -1,47 +1,59 @@
systemctl stop php${phpver}-fpm nginx
systemctl stop nginx
#############
# Nginx #
#############
mkdir -p /etc/nginx/sites-available /etc/nginx/sites-enabled /etc/nginx/snippets /etc/nginx/modules-available /etc/nginx/modules-enabled /etc/nginx/snippets/
wget -q -t7 "$repo"/raw/branch/"$branch"/CoreModules/nginx/config/nginx/fastcgi.conf -O /etc/nginx/fastcgi.conf
wget -q -t7 "$repo"/raw/branch/"$branch"/CoreModules/nginx/config/nginx/fastcgi-php.conf -O /etc/nginx/snippets/fastcgi-php.conf
wget -q -t7 "$repo"/raw/branch/"$branch"/CoreModules/nginx/config/nginx/nginx-default.conf -O /etc/nginx/nginx.conf
mkdir -p /var/www/html /etc/nginx/sites-available /etc/nginx/sites-enabled /etc/nginx/snippets /etc/nginx/modules-available /etc/nginx/modules-enabled /etc/nginx/snippets/
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/nginx/config/nginx/fastcgi.conf -o /etc/nginx/fastcgi.conf
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/nginx/config/nginx/fastcgi-php.conf -o /etc/nginx/snippets/fastcgi-php.conf
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/nginx/config/nginx/snippets-ssl.conf -o /etc/nginx/snippets/ngx-ssl.conf
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/nginx/config/nginx/snippets-backendredir.conf -o /etc/nginx/snippets/ngx-backendredir.conf
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/nginx/config/nginx/nginx-default.conf -o /etc/nginx/nginx.conf
if [ $domainwww = 1 ]; then
wget -q -t7 -O - "$repo"/raw/branch/"$branch"/CoreModules/nginx/config/nginx/site-wwwredir >> /etc/nginx/sites-available/"$domain"
echo "" >> /etc/nginx/sites-available/"$domain"
#non-ssl
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/nginx/config/nginx/site-wwwredir >> /etc/nginx/sites-available/"$sitename"_nossl
echo "" >> /etc/nginx/sites-available/"$sitename"_nossl
#ssl
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/nginx/config/nginx/site_ssl-wwwredir >> /etc/nginx/sites-available/"$sitename"_ssl
echo "" >> /etc/nginx/sites-available/"$sitename"_ssl
fi
wget -q -t7 -O - "$repo"/raw/branch/"$branch"/CoreModules/nginx/config/nginx/site-unconfigured >> /etc/nginx/sites-available/"$domain"
sed -i -e 's/DOMAINname/'$domain'/' /etc/nginx/sites-available/"$domain"
ln -s /etc/nginx/sites-available/"$domain" /etc/nginx/sites-enabled/
#non-ssl
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/nginx/config/nginx/site-unconfigured >> /etc/nginx/sites-available/"$sitename"_nossl
sed -i -e 's/DOMAINname/'$domain'/g' /etc/nginx/sites-available/"$sitename"_nossl
ln -s /etc/nginx/sites-available/"$sitename"_nossl /etc/nginx/sites-enabled/"$sitename"
#ssl
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/nginx/config/nginx/site_ssl-unconfigured >> /etc/nginx/sites-available/"$sitename"_ssl
sed -i -e 's/DOMAINname/'$domain'/g' /etc/nginx/sites-available/"$sitename"_ssl
wget -q -t7 "$repo"/raw/branch/"$branch"/CoreModules/nginx/config/nginx/site-unconfigured -O /etc/nginx/sites-available/Backend
sed -i -e 's/DOMAINname/'$hostname'/' /etc/nginx/sites-available/Backend
ln -s /etc/nginx/sites-available/Backend /etc/nginx/sites-enabled/
#Backend
##non-ssl
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/nginx/config/nginx/site-unconfigured >> /etc/nginx/sites-available/Backend_nossl
sed -i -e 's/DOMAINname/'$hostname'/g' /etc/nginx/sites-available/Backend_nossl
ln -s /etc/nginx/sites-available/Backend_nossl /etc/nginx/sites-enabled/Backend
##ssl
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/nginx/config/nginx/site_ssl-unconfigured >> /etc/nginx/sites-available/Backend_ssl
sed -i -e 's/DOMAINname/'$hostname'/g' /etc/nginx/sites-available/Backend_ssl
#toggles
mkdir -p /opt/toggle
wget -q -t7 "$repo"/raw/branch/"$branch"/Scripts/toggles/toggle-Netdata_NGINX.sh -O /opt/toggle/toggle-Netdata.sh
wget -q -t7 "$repo"/raw/branch/"$branch"/Scripts/toggles/toggle-PhpMyAdmin_NGINX.sh -O /opt/toggle/toggle-PhpMyAdmin.sh
##phpmyadmin toggle
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/toggles/toggle-Netdata_NGINX.sh -o /opt/toggle/toggle-Netdata.sh
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/toggles/toggle-PhpMyAdmin_NGINX.sh -o /opt/toggle/toggle-PhpMyAdmin.sh
##monit toggle
if [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ] ; then
monitconf=/etc/monit/monitrc
elif [ "$shortdist" = "el8" ]; then
monitconf=/etc/monitrc
fi
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/toggles/toggle-Monit_NGINX.sh -o /opt/toggle/toggle-MonitWebui.sh
sed -i -e 's#MONITCONF#'$monitconf'#' /opt/toggle/toggle-MonitWebui.sh
unset monitconf
# custom Welcome page
echo "<html><head></head><body>$webserv is functioning normally</body></html>" > /var/www/html/index.html
###############
# PHP-FPM #
###############
echo "<html><head></head><body>$webserv is functioning normally</body></html>" > /usr/share/nginx/html/index.html
sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php/"$phpver"/fpm/php.ini
sed -i 's/;opcache.memory_consumption=128/opcache.memory_consumption=256/g' /etc/php/"$phpver"/fpm/php.ini
sed -i 's/;opcache.enable=1/opcache.enable=1/g' /etc/php/"$phpver"/fpm/php.ini
sed -i 's/;opcache.interned_strings_buffer=8/opcache.interned_strings_buffer=8/g' /etc/php/"$phpver"/fpm/php.ini
sed -i 's/;opcache.max_accelerated_files=10000/opcache.max_accelerated_files=50000/g' /etc/php/"$phpver"/fpm/php.ini
sed -i 's/;opcache.max_wasted_percentage=5/opcache.max_wasted_percentage=5/g' /etc/php/"$phpver"/fpm/php.ini
sed -i 's/;opcache.revalidate_freq=2/opcache.revalidate_freq=0/g' /etc/php/"$phpver"/fpm/php.ini
sed -i 's/; max_input_vars = 1000/max_input_vars = 10000/g' /etc/php/"$phpver"/fpm/php.ini
sed -i 's/upload_max_filesize = 2/upload_max_filesize = 128/g' /etc/php/"$phpver"/fpm/php.ini
sed -i 's/post_max_size = 8/post_max_size = 64/g' /etc/php/"$phpver"/fpm/php.ini
wget -q -t7 "$repo"/raw/branch/"$branch"/CoreModules/nginx/config/PHP-FPM/www.confg -O /etc/php/"$phpver"/fpm/pool.d/www.conf
sed -i 's/'rtag'/'"${phpver}"'/g' /etc/php/"$phpver"/fpm/pool.d/www.conf
systemctl start php${phpver}-fpm nginx
systemctl start nginx > $OUTPUT 2>&1
systemctl enable nginx > $OUTPUT 2>&1

View File

@@ -1,423 +0,0 @@
; Start a new pool named 'www'.
; the variable $pool can be used in any directive and will be replaced by the
; pool name ('www' here)
[www]
; Per pool prefix
; It only applies on the following directives:
; - 'access.log'
; - 'slowlog'
; - 'listen' (unixsocket)
; - 'chroot'
; - 'chdir'
; - 'php_values'
; - 'php_admin_values'
; When not set, the global prefix (or /usr) applies instead.
; Note: This directive can also be relative to the global prefix.
; Default Value: none
;prefix = /path/to/pools/$pool
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
user = www-data
group = www-data
; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on
; a specific port;
; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses
; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = /run/php/phprtag-fpm.sock
; Set listen(2) backlog.
; Default Value: 511 (-1 on FreeBSD and OpenBSD)
;listen.backlog = 511
; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user
; mode is set to 0660
listen.owner = www-data
listen.group = www-data
;listen.mode = 0660
; When POSIX Access Control Lists are supported you can set them using
; these options, value is a comma separated list of user/group names.
; When set, listen.owner and listen.group are ignored
;listen.acl_users =
;listen.acl_groups =
; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect.
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
; must be separated by a comma. If this value is left blank, connections will be
; accepted from any ip address.
; Default Value: any
;listen.allowed_clients = 127.0.0.1
; Specify the nice(2) priority to apply to the pool processes (only if set)
; The value can vary from -19 (highest priority) to 20 (lower priority)
; Note: - It will only work if the FPM master process is launched as root
; - The pool processes will inherit the master process priority
; unless it specified otherwise
; Default Value: no set
; process.priority = -19
; Set the process dumpable flag (PR_SET_DUMPABLE prctl) even if the process user
; or group is differrent than the master process user. It allows to create process
; core dump and ptrace the process for the pool user.
; Default Value: no
; process.dumpable = yes
; Choose how the process manager will control the number of child processes.
; Possible Values:
; static - a fixed number (pm.max_children) of child processes;
; dynamic - the number of child processes are set dynamically based on the
; following directives. With this process management, there will be
; always at least 1 children.
; pm.max_children - the maximum number of children that can
; be alive at the same time.
; pm.start_servers - the number of children created on startup.
; pm.min_spare_servers - the minimum number of children in 'idle'
; state (waiting to process). If the number
; of 'idle' processes is less than this
; number then some children will be created.
; pm.max_spare_servers - the maximum number of children in 'idle'
; state (waiting to process). If the number
; of 'idle' processes is greater than this
; number then some children will be killed.
; ondemand - no children are created at startup. Children will be forked when
; new requests will connect. The following parameter are used:
; pm.max_children - the maximum number of children that
; can be alive at the same time.
; pm.process_idle_timeout - The number of seconds after which
; an idle process will be killed.
; Note: This value is mandatory.
pm = dynamic
; The number of child processes to be created when pm is set to 'static' and the
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
; This value sets the limit on the number of simultaneous requests that will be
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
; CGI. The below defaults are based on a server without much resources. Don't
; forget to tweak pm.* to fit your needs.
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
; Note: This value is mandatory.
pm.max_children = 5
; The number of child processes created on startup.
; Note: Used only when pm is set to 'dynamic'
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
pm.start_servers = 2
; The desired minimum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.min_spare_servers = 1
; The desired maximum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.max_spare_servers = 3
; The number of seconds after which an idle process will be killed.
; Note: Used only when pm is set to 'ondemand'
; Default Value: 10s
;pm.process_idle_timeout = 10s;
; The number of requests each child process should execute before respawning.
; This can be useful to work around memory leaks in 3rd party libraries. For
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
; Default Value: 0
;pm.max_requests = 500
; The URI to view the FPM status page. If this value is not set, no URI will be
; recognized as a status page. It shows the following informations:
; pool - the name of the pool;
; process manager - static, dynamic or ondemand;
; start time - the date and time FPM has started;
; start since - number of seconds since FPM has started;
; accepted conn - the number of request accepted by the pool;
; listen queue - the number of request in the queue of pending
; connections (see backlog in listen(2));
; max listen queue - the maximum number of requests in the queue
; of pending connections since FPM has started;
; listen queue len - the size of the socket queue of pending connections;
; idle processes - the number of idle processes;
; active processes - the number of active processes;
; total processes - the number of idle + active processes;
; max active processes - the maximum number of active processes since FPM
; has started;
; max children reached - number of times, the process limit has been reached,
; when pm tries to start more children (works only for
; pm 'dynamic' and 'ondemand');
; Value are updated in real time.
; Example output:
; pool: www
; process manager: static
; start time: 01/Jul/2011:17:53:49 +0200
; start since: 62636
; accepted conn: 190460
; listen queue: 0
; max listen queue: 1
; listen queue len: 42
; idle processes: 4
; active processes: 11
; total processes: 15
; max active processes: 12
; max children reached: 0
;
; By default the status page output is formatted as text/plain. Passing either
; 'html', 'xml' or 'json' in the query string will return the corresponding
; output syntax. Example:
; http://www.foo.bar/status
; http://www.foo.bar/status?json
; http://www.foo.bar/status?html
; http://www.foo.bar/status?xml
;
; By default the status page only outputs short status. Passing 'full' in the
; query string will also return status for each pool process.
; Example:
; http://www.foo.bar/status?full
; http://www.foo.bar/status?json&full
; http://www.foo.bar/status?html&full
; http://www.foo.bar/status?xml&full
; The Full status returns for each process:
; pid - the PID of the process;
; state - the state of the process (Idle, Running, ...);
; start time - the date and time the process has started;
; start since - the number of seconds since the process has started;
; requests - the number of requests the process has served;
; request duration - the duration in µs of the requests;
; request method - the request method (GET, POST, ...);
; request URI - the request URI with the query string;
; content length - the content length of the request (only with POST);
; user - the user (PHP_AUTH_USER) (or '-' if not set);
; script - the main script called (or '-' if not set);
; last request cpu - the %cpu the last request consumed
; it's always 0 if the process is not in Idle state
; because CPU calculation is done when the request
; processing has terminated;
; last request memory - the max amount of memory the last request consumed
; it's always 0 if the process is not in Idle state
; because memory calculation is done when the request
; processing has terminated;
; If the process is in Idle state, then informations are related to the
; last request the process has served. Otherwise informations are related to
; the current request being served.
; Example output:
; ************************
; pid: 31330
; state: Running
; start time: 01/Jul/2011:17:53:49 +0200
; start since: 63087
; requests: 12808
; request duration: 1250261
; request method: GET
; request URI: /test_mem.php?N=10000
; content length: 0
; user: -
; script: /home/fat/web/docs/php/test_mem.php
; last request cpu: 0.00
; last request memory: 0
;
; Note: There is a real-time FPM status monitoring sample web page available
; It's available in: /usr/share/php/rtag/fpm/status.html
;
; Note: The value must start with a leading slash (/). The value can be
; anything, but it may not be a good idea to use the .php extension or it
; may conflict with a real PHP file.
; Default Value: not set
;pm.status_path = /status
; The ping URI to call the monitoring page of FPM. If this value is not set, no
; URI will be recognized as a ping page. This could be used to test from outside
; that FPM is alive and responding, or to
; - create a graph of FPM availability (rrd or such);
; - remove a server from a group if it is not responding (load balancing);
; - trigger alerts for the operating team (24/7).
; Note: The value must start with a leading slash (/). The value can be
; anything, but it may not be a good idea to use the .php extension or it
; may conflict with a real PHP file.
; Default Value: not set
;ping.path = /ping
; This directive may be used to customize the response of a ping request. The
; response is formatted as text/plain with a 200 response code.
; Default Value: pong
;ping.response = pong
; The access log file
; Default: not set
;access.log = log/$pool.access.log
; The access log format.
; The following syntax is allowed
; %%: the '%' character
; %C: %CPU used by the request
; it can accept the following format:
; - %{user}C for user CPU only
; - %{system}C for system CPU only
; - %{total}C for user + system CPU (default)
; %d: time taken to serve the request
; it can accept the following format:
; - %{seconds}d (default)
; - %{miliseconds}d
; - %{mili}d
; - %{microseconds}d
; - %{micro}d
; %e: an environment variable (same as $_ENV or $_SERVER)
; it must be associated with embraces to specify the name of the env
; variable. Some exemples:
; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e
; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e
; %f: script filename
; %l: content-length of the request (for POST request only)
; %m: request method
; %M: peak of memory allocated by PHP
; it can accept the following format:
; - %{bytes}M (default)
; - %{kilobytes}M
; - %{kilo}M
; - %{megabytes}M
; - %{mega}M
; %n: pool name
; %o: output header
; it must be associated with embraces to specify the name of the header:
; - %{Content-Type}o
; - %{X-Powered-By}o
; - %{Transfert-Encoding}o
; - ....
; %p: PID of the child that serviced the request
; %P: PID of the parent of the child that serviced the request
; %q: the query string
; %Q: the '?' character if query string exists
; %r: the request URI (without the query string, see %q and %Q)
; %R: remote IP address
; %s: status (response code)
; %t: server time the request was received
; it can accept a strftime(3) format:
; %d/%b/%Y:%H:%M:%S %z (default)
; The strftime(3) format must be encapsuled in a %{<strftime_format>}t tag
; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t
; %T: time the log has been written (the request has finished)
; it can accept a strftime(3) format:
; %d/%b/%Y:%H:%M:%S %z (default)
; The strftime(3) format must be encapsuled in a %{<strftime_format>}t tag
; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t
; %u: remote user
;
; Default: "%R - %u %t \"%m %r\" %s"
;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
; The log file for slow requests
; Default Value: not set
; Note: slowlog is mandatory if request_slowlog_timeout is set
;slowlog = log/$pool.log.slow
; The timeout for serving a single request after which a PHP backtrace will be
; dumped to the 'slowlog' file. A value of '0s' means 'off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0
;request_slowlog_timeout = 0
; Depth of slow log stack trace.
; Default Value: 20
;request_slowlog_trace_depth = 20
; The timeout for serving a single request after which the worker process will
; be killed. This option should be used when the 'max_execution_time' ini option
; does not stop script execution for some reason. A value of '0' means 'off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0
;request_terminate_timeout = 0
; Set open file descriptor rlimit.
; Default Value: system defined value
;rlimit_files = 1024
; Set max core size rlimit.
; Possible Values: 'unlimited' or an integer greater or equal to 0
; Default Value: system defined value
;rlimit_core = 0
; Chroot to this directory at the start. This value must be defined as an
; absolute path. When this value is not set, chroot is not used.
; Note: you can prefix with '$prefix' to chroot to the pool prefix or one
; of its subdirectories. If the pool prefix is not set, the global prefix
; will be used instead.
; Note: chrooting is a great security feature and should be used whenever
; possible. However, all PHP paths will be relative to the chroot
; (error_log, sessions.save_path, ...).
; Default Value: not set
;chroot =
; Chdir to this directory at the start.
; Note: relative path can be used.
; Default Value: current directory or / when chroot
;chdir = /var/www
; Redirect worker stdout and stderr into main error log. If not set, stdout and
; stderr will be redirected to /dev/null according to FastCGI specs.
; Note: on highloaded environement, this can cause some delay in the page
; process time (several ms).
; Default Value: no
;catch_workers_output = yes
; Clear environment in FPM workers
; Prevents arbitrary environment variables from reaching FPM worker processes
; by clearing the environment in workers before env vars specified in this
; pool configuration are added.
; Setting to "no" will make all environment variables available to PHP code
; via getenv(), $_ENV and $_SERVER.
; Default Value: yes
;clear_env = no
; Limits the extensions of the main script FPM will allow to parse. This can
; prevent configuration mistakes on the web server side. You should only limit
; FPM to .php extensions to prevent malicious users to use other extensions to
; execute php code.
; Note: set an empty value to allow all extensions.
; Default Value: .php
;security.limit_extensions = .php .php3 .php4 .php5 .php7
; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
; the current environment.
; Default Value: clean env
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
; Additional php.ini defines, specific to this pool of workers. These settings
; overwrite the values previously defined in the php.ini. The directives are the
; same as the PHP SAPI:
; php_value/php_flag - you can set classic ini defines which can
; be overwritten from PHP call 'ini_set'.
; php_admin_value/php_admin_flag - these directives won't be overwritten by
; PHP call 'ini_set'
; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
; Defining 'extension' will load the corresponding shared extension from
; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
; overwrite previously defined php.ini values, but will append the new value
; instead.
; Note: path INI options can be relative and will be expanded with the prefix
; (pool, global or /usr)
; Default Value: nothing is defined by default except the values in php.ini and
; specified at startup with the -d argument
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
;php_flag[display_errors] = off
;php_admin_value[error_log] = /var/log/fpm-php.www.log
;php_admin_flag[log_errors] = on
;php_admin_value[memory_limit] = 32M

View File

@@ -25,19 +25,10 @@ http {
server_names_hash_bucket_size 64;
include /etc/nginx/mime.types;
default_type text/html;
root /usr/share/nginx/html;
ssl_protocols TLSv1.3 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers EECDH+AESGCM:EDH+AESGCM;
ssl_session_cache shared:SSL:20m;
ssl_session_timeout 180m;
ssl_ecdh_curve secp384r1;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header X-Frame-Options sameorigin;
add_header X-Content-Type-Options nosniff;
add_header X-Xss-Protection "1; mode=block";
include /etc/nginx/mime.types;
default_type application/octet-stream;
#access_log /var/log/nginx/access.log;
access_log off;
@@ -50,6 +41,7 @@ http {
gzip_disable "msie6";
gzip_buffers 16 8k;
include /etc/nginx/snippets/ngx-ssl.conf;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

View File

@@ -0,0 +1,25 @@
server {
listen 80;
listen [::]:80;
server_name DOMAINname;
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name DOMAINname;
ssl_certificate /etc/acmesh/certs/DOMAINname_ecc/fullchain.cer;
ssl_certificate_key /etc/acmesh/certs/DOMAINname_ecc/DOMAINname.key;
ssl_trusted_certificate /etc/acmesh/certs/DOMAINname_ecc/fullchain.cer;
include snippets/ngx-ssl.conf;
#ConfHere
}

View File

@@ -0,0 +1,19 @@
server {
#www.domain > domain redirect
listen 80;
listen [::]:80;
server_name www.DOMAINname;
return 301 http://DOMAINname$request_uri;
}
server {
#SSL www.domain > domain redirect
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name www.DOMAINname;
ssl_certificate /etc/acmesh/certs/DOMAINname_ecc/fullchain.cer;
ssl_certificate_key /etc/acmesh/certs/DOMAINname_ecc/DOMAINname.key;
ssl_trusted_certificate /etc/acmesh/certs/DOMAINname_ecc/fullchain.cer;
include snippets/ngx-ssl.conf;
return 301 https://DOMAINname$request_uri;
}

View File

@@ -0,0 +1,3 @@
location /database {
return 301 http://$hostname/backend/database;
}

View File

@@ -0,0 +1,14 @@
resolver 8.8.8.8;
ssl_ecdh_curve secp384r1;
ssl_session_cache shared:le_nginx_SSL:1m;
ssl_session_timeout 1440m;
ssl_stapling on;
ssl_stapling_verify on;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384";
add_header X-Frame-Options sameorigin;
add_header X-Content-Type-Options nosniff;
add_header X-Xss-Protection "1; mode=block";
add_header Strict-Transport-Security "max-age=31536000" always;
ssl_dhparam /etc/acmesh/certs/ssl-dhparams.pem;

View File

@@ -0,0 +1 @@
httpd-tools

View File

@@ -0,0 +1 @@
nginx

View File

@@ -0,0 +1,24 @@
for f in /etc/nginx/sites-available/*; do
if [ $IMODE = n ] && [ $PhpPurge = 0 ]; then
if (whiptail --title "Update Nginx config ?" --yesno "Update php version in nginx site: ${f##*/} ?" 8 78); then
sed -i "s/$phpver/$newphpver/" $f
fi
fi
if [ $IMODE = l ] && [ $PhpPurge = 0 ]; then
while true; do
read -p "Update php version in nginx site: ${f##*/} ? -> yes/no?" yn
case $yn in
[Yy]* ) sed -i "s/$phpver/$newphpver/" $f
break;;
[Nn]* ) echo ""
break;;
* ) echo "Choose yes of no.";;
esac
done
fi
if [ $PhpPurge = 1 ]; then
sed -i "s/$phpver/$newphpver/" $f
fi
done
systemctl reload nginx

View File

@@ -1 +1 @@
$PKGA ppa:nginx/stable -y > $OUTPUT 2>&1
curl --retry 7 --retry-delay 5 -s https://git.ictmaatwerk.com/VPS-scripts/General/raw/branch/Main/Setup-Repo.sh |repo=nginx osrel=$shortdist bash > $OUTPUT 2>&1

View File

@@ -0,0 +1 @@
aonoption="$aonoption php-fpm"

View File

@@ -0,0 +1,9 @@
rm /etc/nginx/sites-enabled/"$sitename"
ln -s /etc/nginx/sites-available/"$sitename"_"$site_ext" /etc/nginx/sites-enabled/"$sitename"
if [ -n "$sslfr" ]; then
rm /etc/nginx/sites-enabled/Backend
ln -s /etc/nginx/sites-available/Backend_"$siteBackend_ext" /etc/nginx/sites-enabled/Backend
fi
systemctl reload nginx

View File

@@ -0,0 +1,22 @@
#############
# Nginx #
#############
if [ $domainwww = 1 ]; then
#non-ssl
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/nginx/config/nginx/site-wwwredir >> /etc/nginx/sites-available/"$sitename"_nossl
echo "" >> /etc/nginx/sites-available/"$sitename"_nossl
#ssl
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/nginx/config/nginx/site_ssl-wwwredir >> /etc/nginx/sites-available/"$sitename"_ssl
echo "" >> /etc/nginx/sites-available/"$sitename"_ssl
fi
#non-ssl
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/nginx/config/nginx/site-unconfigured >> /etc/nginx/sites-available/"$sitename"_nossl
sed -i -e 's/DOMAINname/'$domain'/g' /etc/nginx/sites-available/"$sitename"_nossl
ln -s /etc/nginx/sites-available/"$sitename"_nossl /etc/nginx/sites-enabled/"$sitename"
#ssl
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/nginx/config/nginx/site_ssl-unconfigured >> /etc/nginx/sites-available/"$sitename"_ssl
sed -i -e 's/DOMAINname/'$domain'/g' /etc/nginx/sites-available/"$sitename"_ssl
systemctl reload nginx

View File

@@ -0,0 +1 @@
apache2-utils

View File

@@ -0,0 +1,32 @@
systemctl stop nginx
#############
# Nginx #
#############
mkdir -p /var/www/html /etc/nginx/sites-available /etc/nginx/sites-enabled /etc/nginx/snippets /etc/nginx/modules-available /etc/nginx/modules-enabled /etc/nginx/snippets/
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/nginx/config/nginx/fastcgi.conf -o /etc/nginx/fastcgi.conf
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/nginx/config/nginx/snippets-ssl.conf -o /etc/nginx/snippets/ngx-ssl.conf
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/nginx/config/nginx/nginx-default.conf -o /etc/nginx/nginx.conf
if [ $domainwww = 1 ]; then
#non-ssl
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/nginx/config/nginx/site-wwwredir >> /etc/nginx/sites-available/"$sitename"_nossl
echo "" >> /etc/nginx/sites-available/"$sitename"_nossl
#ssl
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/nginx/config/nginx/site_ssl-wwwredir >> /etc/nginx/sites-available/"$sitename"_ssl
echo "" >> /etc/nginx/sites-available/"$sitename"_ssl
fi
#non-ssl
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/nginx/config/nginx/site-unconfigured >> /etc/nginx/sites-available/"$sitename"_nossl
sed -i -e 's/DOMAINname/'$domain'/g' /etc/nginx/sites-available/"$sitename"_nossl
ln -s /etc/nginx/sites-available/"$sitename"_nossl /etc/nginx/sites-enabled/"$sitename"
#ssl
curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/nginx/config/nginx/site_ssl-unconfigured >> /etc/nginx/sites-available/"$sitename"_ssl
sed -i -e 's/DOMAINname/'$domain'/g' /etc/nginx/sites-available/"$sitename"_ssl
# custom Welcome page
echo "<html><head></head><body>$webserv is functioning normally</body></html>" > /usr/share/nginx/html/index.html
systemctl start nginx > $OUTPUT 2>&1
systemctl enable nginx > $OUTPUT 2>&1

View File

@@ -0,0 +1 @@
httpd-tools

View File

@@ -0,0 +1 @@
nginx

View File

@@ -0,0 +1,5 @@
curl --retry 7 --retry-delay 5 -s https://git.ictmaatwerk.com/VPS-scripts/General/raw/branch/Main/Setup-Repo.sh |repo=nginx osrel=$shortdist bash > $OUTPUT 2>&1
#Disable PhpMyadmin and Backend cms
disbackendcms=1
PHPMyadmin=1

View File

@@ -0,0 +1,4 @@
rm /etc/nginx/sites-enabled/"$sitename"
ln -s /etc/nginx/sites-available/"$sitename"_"$site_ext" /etc/nginx/sites-enabled/"$sitename"
systemctl reload nginx

View File

@@ -3,10 +3,14 @@
* CMS/`<NewCmsName>`/
* conf.sh
* preconf.sh
* apt.list
* generic.pkg.list
* apt.pkg.list
* dnf.pkg.list
* `<Webserver>`-conf.sh
* `<Webserver>`-preconf.sh
* `<Webserver>`-apt.list
* `<Webserver>`-generic.pkg.list
* `<Webserver>`-apt.pkg.list
* `<Webserver>`-dnf.pkg.list
* `<Webserver>`-unconfigured
# File Explanation
@@ -14,10 +18,14 @@
| -------- | ------------ |
| preconf.sh | Pre config/apt install commands runs for all web servers |
| conf.sh | Configuration runs for all webservers |
| apt.list | packagelist for all webservers |
| generic.pkg.list | packagelist for this webserver and php for all distro's |
| apt.pkg.list | packagelist for this webserver and php for distro's that use apt |
| dnf.pkg.list | packagelist for this webserver and php for distro's that use dnf/yum |
| `<Webserver>`-preconf.sh | Pre config/apt install commands runs for specified webserver |
| `<Webserver>`-conf.sh | Configuration runs for specified webserver |
| `<Webserver>`-apt.list | packagelist for specified webserver |
| `<Webserver>`-generic.pkg.list | packagelist for specified webserver for all distro's|
| `<Webserver>`-apt.pkg.list | packagelist for specified webserver for distro's that use apt|
| `<Webserver>`-dnf.pkg.list | packagelist for specified webserver for distro's that use dnf/yum|
| `<Webserver>`-unconfigured | webserver(vhost) config |
@@ -26,7 +34,7 @@
## nginx-conf.sh
```
#Getting Nginx SiteConfig
wget -q -t7 "$repo"/raw/branch/"$branch"/CMS/<CMSName>/Nginx-unconfigured -O /tmp/nginx-siteconf
curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/CMS/<CMSName>/Nginx-unconfigured -o /tmp/nginx-siteconf
#Configuring Nginx SiteConfig
sed -i -e 's/PHPver/'$phpver'/g' -e 's/DOMAINname/'$domain'/' /tmp/nginx-siteconf
@@ -43,7 +51,7 @@ systemctl reload nginx
```
#Getting Nginx SiteConfig
wget -q -t7 "$repo"/raw/branch/"$branch"/CMS/<CMSName>/Nginx-unconfigured -O /tmp/nginx-siteconf
curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/CMS/<CMSName>/Nginx-unconfigured -o /tmp/nginx-siteconf
#Configuring Nginx SiteConfig
sed -i -e 's/PHPver/'$phpver'/g' -e 's/DOMAINname/'$domain'/' /tmp/nginx-siteconf

View File

@@ -1,30 +1,41 @@
# Module modes
A module can be external(in other/external git repo) or internal(Modules/<ModuleName>).
A module can be external(in other/external git repo) or internal(SubModules/<ModuleName>).
In both cases the file structure is expected as shown below
# List of possible Files and expected Structure
* conf.sh
* preconf.sh
* apt.list
* generic.pkg.list
* apt.pkg.list
* dnf.pkg.list
* `<webserver>`-conf.sh
* `<webserver>`-preconf.sh
* `<webserver>`-apt.list
* `<Webserver>`-generic.pkg.list
* `<Webserver>`-apt.pkg.list
* `<Webserver>`-dnf.pkg.list
* config/*
* CMSHook-preconf.sh
* CMSHook-conf.sh
## The internal module location
Modules/`<ModuleName>`
SubModules/`<ModuleName>`
# File Explanation
| File Name | Description |
| -------- | ------------ |
| preconf.sh | Pre config/apt install commands runs for all web servers |
| conf.sh| Configuration runs for all webservers |
| apt.list | packagelist for all webservers |
| generic.pkg.list | packagelist for this webserver and php for all distro's |
| apt.pkg.list | packagelist for this webserver and php for distro's that use apt |
| dnf.pkg.list | packagelist for this webserver and php for distro's that use dnf/yum |
| `<Webserver>`-preconf.sh | Pre config/apt install commands runs for specified webserver |
| `<Webserver>`-conf.sh | Configuration runs for specified webserver |
| `<Webserver>`-apt.list | packagelist for specified webserver |
| `<Webserver>`-generic.pkg.list | packagelist for specified webserver for all distro's|
| `<Webserver>`-apt.pkg.list | packagelist for specified webserver for distro's that use apt|
| `<Webserver>`-dnf.pkg.list | packagelist for specified webserver for distro's that use dnf/yum|
| config/* | Directory for config files |
| CMSHook-conf.sh | Will run as addtional preconf when CSM is installed|
| CMSHook-conf.sh | Will run after a CSM is installed|
# Defining in the menu
### Add the following to ModulesMenu.list

View File

@@ -2,7 +2,9 @@
* CoreModules/`<webserverName>`/
* conf.sh
* preconf.sh
* apt.list
* generic.pkg.list
* apt.pkg.list
* dnf.pkg.list
* appendCMS-conf.sh
* config/*
# File Explanation
@@ -10,7 +12,9 @@
| -------- | ------------ |
| preconf.sh | Pre config/apt install commands (ex: repo setup) |
| conf.sh | Configuration for webserver and php |
| apt.list | packagelist for this webserver and php |
| generic.pkg.list | packagelist for this webserver and php for all distro's |
| apt.pkg.list | packagelist for this webserver and php for distro's that use apt |
| dnf.pkg.list | packagelist for this webserver and php for distro's that use dnf/yum |
| appendCMS-conf.sh | Runs when a domain gets added after inital install by appendCMS.sh |
# Defining in the menu

View File

@@ -1,26 +1,37 @@
# Getting/using the Normal installer (installer.sh):
Using curl
```
#Get installer.sh from the repo and store it at: /tmp/installer.sh
curl https://git.ictmaatwerk.com/VPS-scripts/Web-V2/raw/branch/master/installer.sh -o /tmp/installer.sh
bash /tmp/installer.sh
```
Using wget
```
wget https://git.ictmaatwerk.com/VPS-scripts/Web-V2/raw/branch/master/installer.sh -O /tmp/installer.sh
bash /tmp/installer.sh
```
# Getting/using the Legacy installer (installer.sh):
Using curl
```
#Get installer.sh from the repo and store it at: /tmp/installer.sh
curl https://git.ictmaatwerk.com/VPS-scripts/Web-V2/raw/branch/master/installer.sh -o /tmp/installer.sh
bash /tmp/installer.sh -l 2>&1 | tee ~/output.log
```
```
Using wget
```
wget https://git.ictmaatwerk.com/VPS-scripts/Web-V2/raw/branch/master/installer.sh -O /tmp/installer.sh
bash /tmp/installer.sh -l 2>&1 | tee ~/output.log
```
# Adding a Domain (AppendCMS.sh):
The script wil get most information it need from stored config, only the new domain and the mysql root password need to be entered.
```
#Get the AppendCMS.sh from the repo and store it at: /tmp/AppendCMS.sh
bash /tmp/AppendCMS.sh
bash <(curl --retry 7 --retry-delay 5 -s https://git.ictmaatwerk.com/VPS-scripts/Web-V2/raw/branch/master/AppendCMS.sh)
```
# Adding a Module/Option (AppendModule.sh):
The script wil get most information it need from stored config
```
#Get the AppendCMS.sh from the repo and store it at: /tmp/AppendModule.sh
bash /tmp/AppendModule.sh
bash <(curl --retry 7 --retry-delay 5 -s https://git.ictmaatwerk.com/VPS-scripts/Web-V2/raw/branch/master/AppendModule.sh)
```

View File

@@ -1,7 +1,7 @@
site_name: Web-V2
theme: slate
repo_name: 'Git Repo'
repo_url: https://git.ictmaatwerk.com/bprieshof/UBU-Web-V2/src/branch/master
repo_url: https://git.ictmaatwerk.com/VPS-scripts/Web-V2/src/branch/master
nav:
- User: 'User-MainInfo.md'
- Development:

View File

@@ -5,6 +5,7 @@
if [ $IMODE = n ]; then
#WebServers
webservers=("Nginx:" "Will install NGINX Webserver." ON)
webservers+=("Nginx_nonphp:" "Will install NGINX Webserver without php-fpm." OFF)
webservers+=("Apache:" "Will install Apache Webserver." OFF)
##Nginx
@@ -12,32 +13,48 @@ webservers+=("Apache:" "Will install Apache Webserver." OFF)
nginxCMSL=("None:" "A plain webserver will be setup." OFF)
nginxCMSL+=("Wordpress:" "WordPress is a content management system based on PHP." OFF)
nginxCMSL+=("Nextcloud:" "Nextcloud is a suite of client-server software for creating and using file hosting services." OFF)
nginxCMSL+=("FrontController:" "Will prepair enviroment for frontcontroller." OFF)
#Options
nginxOptions=("Option 1:" "Option 1 Desription" OFF)
nginxOptions+=("Option 2:" "Option 2 Desription" OFF)
nginxOptions+=("Option 3:" "Option 3 Desription" OFF)
nginxOptions=("Redis:" "Redis caching" OFF)
nginxOptions+=("Postfix:" "Mail MTA" OFF)
##Nginx
#CMSList
nginx_nonphpCMSL=("None:" "A plain webserver will be setup." OFF)
#Options
nginx_nonphpOptions=("Redis:" "Redis caching" OFF)
nginx_nonphpOptions+=("Postfix:" "Mail MTA" OFF)
##Apache
#CMSList
apacheCMSL=("None:" "A plain webserver will be setup." OFF)
apacheCMSL+=("Wordpress:" "WordPress is a content management system based on PHP." OFF)
apacheCMSL+=("Nextcloud:" "Nextcloud is a suite of client-server software for creating and using file hosting services." OFF)
#Options
apacheOptions=("Option 1:" "Option 1 Desription" OFF)
apacheOptions+=("Option 2: " "Option 2 Desription" OFF)
apacheOptions=("Redis:" "Redis caching" OFF)
apacheOptions+=("Postfix:" "Mail MTA" OFF)
fi
if [ $IMODE = l ]; then
#WebServers
webservers=("Nginx" "Apache" "Quit")
webservers=("Nginx" "Nginx_nonphp" "Apache" "Quit")
##Nginx
#CMSList
nginxCMSL=("Wordpress" "Nextcloud" "None")
nginxCMSL=("None" "Wordpress" "Nextcloud" "FrontController")
#Options
nginxOptions=("Ngx Option 1:" "Ngx Option 2:" "Ngx Option 3:")
nginxOptions=("Redis:" "Postfix:")
##Nginx-nonphp
#CMSList
nginx_nonphpCMSL=("None")
#Options
nginx_nonphpOptions=("Redis:" "Postfix:")
##Apache
#CMSList
apacheCMSL=("Wordpress" "Nextcloud" "None")
apacheCMSL=("None" "Wordpress" "Nextcloud")
#Options
apacheOptions=("Apa Option 1:" "Apa Option 2:" "Apa Option 3:")
apacheOptions=("Redis:" "Postfix:")
fi

View File

@@ -1,2 +0,0 @@
### Apache config
set `IncludeOptional sites-enabled/*.conf` to `IncludeOptional sites-enabled/*`

133
PhpUpdater.sh Normal file
View File

@@ -0,0 +1,133 @@
#sysCheck
if [ ! -f "/etc/ICTM/selopts.list" ] || [ ! -f "/etc/ICTM/mainvar.list" ] ; then echo 'This system is not yet setup, please run the main installer first' && exit ; fi
rm /tmp/pkg.list
#Getting variables
source /etc/ICTM/mainvar.list
if [ -z $shortdist ] ; then source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/MicroOSDetect.sh) ; fi
if [ ! -f "/etc/ICTM/phpvar.list" ] ; then bash <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/GeneratePhplist.sh) ; fi
source /etc/ICTM/phpvar.list
if [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ] ; then
apt update
RepoVersion=`apt list |grep php | grep deb.sury.org| cut -f1 -d"-"| tail -1 |sed 's/php//'`
elif [ "$shortdist" = "el8" ]; then
dnf check-update --refresh
RepoVersion=`dnf list php* | awk '{print $1; }' | cut -f1 -d"-"| tail -1 |sed 's/php//' | sed 's/./&./1'`
fi
msg () {
if [ $IMODE = n ]; then
TERM=ansi whiptail --title "Info" --msgbox "$1" 8 52
fi
if [ $IMODE = l ]; then
echo "$1"
fi
}
msg "Current php version: $phpver"
if [ $IMODE = n ]; then
# Legacy/Main Menu
PKGD="debconf-apt-progress -- apt purge -y"
#Menu
if (whiptail --title "Set new php version?" --yesno "Install php version $RepoVersion ?" 8 78); then
newphpver=$RepoVersion
else
newphpver=$(whiptail --inputbox "Please enter the version to install" --title "Custom" 8 39 3>&1 1>&2 2>&3)
fi
fi
if [ $IMODE = l ]; then
# Legacy/Main Menu
PKGD="apt purge -y"
#Menu
while true; do
read -p "Set phpversion to version $RepoVersion ? -> yes/no?" yn
case $yn in
[Yy]* ) newphpver=$RepoVersion
break;;
[Nn]* ) echo "";
echo "Please enter php version to install:";read newphpver
break;;
* ) echo "Choose yes or no.";;
esac
done
fi
#Genereating vars for new php version
if [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ] ; then
# Debian/Ubunbtu Php variables
newphpPoolDir=/etc/php/${newphpver}/fpm/pool.d
newphpPkgName=php${newphpver}
newphpMainConf=/etc/php/${newphpver}/fpm/php.ini
newphpFPMService=php${newphpver}-fpm
PKGP=$PKGD
apt list --installed | less | grep php$phpver | cut -f1 -d"/" | sed "s/$phpPkgName/$newphpPkgName/" > /tmp/pkg.list
elif [ "$shortdist" = "el8" ]; then
# Centos Php variable
newphpPoolDir=/etc/opt/remi/php${newphpver//.}/php-fpm.d/
newphpPkgName=php${newphpver//.}-php
newphpMainConf=/etc/opt/remi/php${newphpver//.}/php.ini
newphpFPMService=php${newphpver//.}-php-fpm
PKGP="dnf remove -y"
dnf list --installed | sort | grep $phpPkgName | awk '{print $1;}' | cut -f1 -d"." | sed "s/$phpPkgName/$newphpPkgName/" > /tmp/pkg.list
fi
#Install
if [ ${newphpver//.} -ge 80 ] && [ ${newphpver//.} -lt 90 ]; then
sed -i -e "s/$newphpPkgName-xmlrpc//g" -e "s/$newphpPkgName-json//g" /tmp/pkg.list
fi
cat /tmp/pkg.list | xargs $PKGI
#Config
systemctl stop $newphpFPMService
cp $phpPoolDir/* $newphpPoolDir
if [ $IMODE = n ]; then
#Purge
if (whiptail --title "Set new php version?" --yesno "Remove php $phpver ?" 8 78); then
PhpPurge=1
$PKGP -y $phpPkgName*
else
PhpPurge=0
echo "$PKGP -y $phpPkgName*" > ~/remove-PHP-$phpver
fi
fi
if [ $IMODE = l ]; then
#Purge
while true; do
read -p "Remove php $phpver ? -> yes/no?" yn
case $yn in
[Yy]* ) PhpPurge=1 ; $PKGP $phpPkgName*
break;;
[Nn]* ) PhpPurge=0 ; echo ""
break;;
* ) echo "Choose yes or no.";;
esac
done
fi
for f in $newphpPoolDir/*; do
sed -i "s/$phpver/$newphpver/" $f
sed -i "s/${phpver//.}/${newphpver//.}/" $f
done
systemctl start $newphpFPMService
systemctl enable $newphpFPMService
sed -i "/phpver/c\phpver=\"$newphpver\"" /etc/ICTM/mainvar.list
mv /etc/ICTM/phpvar.list /etc/ICTM/phpvar"$phpver".list
for storeme in newphpPoolDir newphpPkgName newphpMainConf newphpFPMService; do
declare -p $storeme | cut -d ' ' -f 3- >> /etc/ICTM/phpvar.list
done
sed -i 's/new//' /etc/ICTM/phpvar.list
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/"$branchtype"/"$branch"/CoreModules/"$webserv"/phpupdate-handeler.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/"$webserv"/phpupdate-handeler.sh)
fi

View File

@@ -1,17 +1,41 @@
# Ubuntu-Web-V2
**Get Started with the graphical installer**:
# Web-V2
## Geting started
**Default/Graphical installer**:
Using curl
```
wget https://git.ictmaatwerk.com/bprieshof/UBU-Web-V2/raw/branch/master/installer.sh -O /tmp/installer.sh
curl https://git.ictmaatwerk.com/VPS-scripts/Web-V2/raw/branch/master/installer.sh -o /tmp/installer.sh
bash /tmp/installer.sh
```
**Legacy Installer for developing and debugging**:
Using wget
```
wget https://git.ictmaatwerk.com/bprieshof/UBU-Web-V2/raw/branch/master/installer.sh -O /tmp/installer.sh
wget https://git.ictmaatwerk.com/VPS-scripts/Web-V2/raw/branch/master/installer.sh -O /tmp/installer.sh
bash /tmp/installer.sh
```
**Legacy Installer for developing and debugging**:
Using curl
```
curl https://git.ictmaatwerk.com/VPS-scripts/Web-V2/raw/branch/master/installer.sh -o /tmp/installer.sh
bash /tmp/installer.sh -l 2>&1 | tee ~/output.log
```
Using wget
```
wget https://git.ictmaatwerk.com/VPS-scripts/Web-V2/raw/branch/master/installer.sh -O /tmp/installer.sh
bash /tmp/installer.sh -l 2>&1 | tee ~/output.log
```
## Adding extra CMS/Site after instalation
```
bash <(curl --retry 7 --retry-delay 5 -s https://git.ictmaatwerk.com/VPS-scripts/Web-V2/raw/branch/master/AppendCMS.sh)
```
#### This script uses the following repo's as dependencies:
## Adding extra Module after instalation
```
bash <(curl --retry 7 --retry-delay 5 -s https://git.ictmaatwerk.com/VPS-scripts/Web-V2/raw/branch/master/AppendModule.sh)
```
### This script uses the following repo's as dependencies:
```
* VPS-scripts/Unattended-Security-Updates
* VPS-scripts/Ubuntu-MySQL

View File

@@ -0,0 +1,23 @@
if [ ! -f "/etc/ICTM/selopts.list" ] || [ ! -f "/etc/ICTM/mainvar.list" ] ; then echo 'This system is not yet setup, please run the main installer first' && exit ; fi
#Getting information and vars
source /etc/ICTM/mainvar.list
#CompatUpdater Setup
UpdaterCompatTo=2
if [ -z ${CompatVer} ]; then CompatVer=1 ; fi
if [ "$CompatVer" -ge "$UpdaterCompatTo" ]; then echo "Web-V2 is update to-date,Update scipt version= $UpdaterCompatTo, Current version= $CompatVer" && exit ; fi
printf '%s' "Updating Web-V2..."
#NewCompat var
CompatVer=$UpdaterCompatTo
#Updating mod lists
aonoption="/MySQL/"
aonoption="$aonoption /Unattended-Security-Updates/"
aonoption="$aonoption /Backup-Util/"
aonoption="$aonoption /AcmeSH/"
echo 'EnabledAons=('$aonoption')' >> /etc/ICTM/selopts.list
declare -p CompatVer | cut -d ' ' -f 3- >> /etc/ICTM/mainvar.list
printf " [\033[0;32mok\033[0m]\n"

View File

@@ -1,29 +1,53 @@
#loading install vars
source /etc/ICTM/mainvar.list
#Setting Vars
confname=CONFname
sitename=CONFname
domain=DOMAINname
domainwww=DomainWWW
email=Email
webserv=WebServer
webservice=WebServer
#Correcting service name for Apache
if [ $webservice = apache ]; then
webservice=apache2
if [ $webservice = apache ]; then\
source /etc/ICTM/apachevar.list
webservice="$apacheService"
ext=.conf
fi
#Correcting service name for nginx_nonphp
if [ $webservice = nginx_nonphp ]; then
webservice=nginx
webserv=nginx
fi
#Backing-up and removing current config
sed -n '/#beginConf/,/#endConf/p' /etc/"$webservice"/sites-enabled/"$confname" > /tmp/"$confname"-config
sed -n -i '/#beginConf/{:a;N;/#endConf/!ba;N;s/.*\n/#ConfHere\n/};p' /etc/"$webservice"/sites-enabled/"$confname"
sed -n '/#beginConf/,/#endConf/p' /etc/"$webservice"/sites-available/"$sitename"_nossl"$ext" > /tmp/"$sitename"-config
sed -n -i '/#beginConf/{:a;N;/#endConf/!ba;N;s/.*\n/#ConfHere\n/};p' /etc/"$webservice"/sites-available/"$sitename"_nossl"$ext"
systemctl reload $webservice
#Enabling SSL
if [ $domainwww = 1 ]; then
certbot --"$webserv" -n -d "$domain" -d "www.$domain" -m "$email" --hsts --redirect --no-eff-email --agree-tos
/opt/acmesh/acme.sh --config-home '/etc/acmesh/data' --issue --"$webserv" --ocsp --keylength 'ec-384' -d "$domain" -d "www.$domain"
certsatus=$?
elif [ $domainwww = 0 ]; then
certbot --"$webserv" -n -d "$domain" -m "$email" --hsts --redirect --no-eff-email --agree-tos
fi
/opt/acmesh/acme.sh --config-home '/etc/acmesh/data' --issue --"$webserv" --ocsp --keylength 'ec-384' -d "$domain"
certsatus=$?
fi
if test $certsatus -eq 0
then
site_ext="ssl"
else
site_ext="nossl"
rm -rf /etc/acmesh/certs/$domain*
echo "LE failed, restoring configuration"
fi
unset certsatus
#Restoring config
sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e "/#ConfHere1/ r /tmp/"$confname"-config" -e '/#ConfHere/c\' /etc/"$webservice"/sites-enabled/"$confname"
sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e "/#ConfHere1/ r /tmp/"$sitename"-config" -e '/#ConfHere/c\' /etc/"$webservice"/sites-available/"$sitename"_"$site_ext""$ext"
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/"$webserv"/ssl-handler.sh)
systemctl reload $webservice
if [ $site_ext = ssl ]; then
rm -- "$0"
fi

View File

@@ -0,0 +1,19 @@
if [ ! -f "/etc/ICTM/mainvar.list" ] ; then echo 'This system is not yet setup, please run the main installer first' && exit ; fi
source /etc/ICTM/mainvar.list
if [ -z $shortdist ] ; then source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/MicroOSDetect.sh) ; fi
if [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ] ; then
# Debian/Ubunbtu apache variables
apacheConfDir=/etc/apache2
apacheService=apache2
elif [ "$shortdist" = "el8" ]; then
# Centos Php variable
apacheConfDir=/etc/httpd
apacheService=httpd
fi
#Storing vars to config
for storeme in apacheService apacheConfDir; do
declare -p $storeme | cut -d ' ' -f 3- >> /etc/ICTM/apachevar.list
done

Some files were not shown because too many files have changed in this diff Show More