From 5e316cc8ac1569d11e38c820e87ac7d94377423f Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Tue, 11 Jun 2024 21:58:43 +0200 Subject: [PATCH 01/10] Fix install script version check --- install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install b/install index a5860c7..14f9095 100755 --- a/install +++ b/install @@ -932,7 +932,7 @@ else wo_lib_echo "WordOps (wo) upgrade to $wo_version_new was successful!" wo_lib_echo "Changelog is available on https://github.com/WordOps/WordOps/releases/tag/$wo_version_new" echo - if "v3.21" in "$wo_version_new"; then + if [[ "$wo_version_new" == *"v3.21"* ]]; then wo_lib_echo "To upgrade Nginx package and configuration for HTTP/3 QUIC, use the following command" wo_lib_echo_info "wo stack migrate --nginx" fi From 74b95c6ba0e141919e650d01c7243951919864d5 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Tue, 11 Jun 2024 22:03:54 +0200 Subject: [PATCH 02/10] Fix install script version check --- install | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/install b/install index 14f9095..6333c9f 100755 --- a/install +++ b/install @@ -932,7 +932,8 @@ else wo_lib_echo "WordOps (wo) upgrade to $wo_version_new was successful!" wo_lib_echo "Changelog is available on https://github.com/WordOps/WordOps/releases/tag/$wo_version_new" echo - if [[ "$wo_version_new" == *"v3.21"* ]]; then + version_to_check="v3.21" + if echo "$wo_version_new" | grep -q "$version_to_check"; then wo_lib_echo "To upgrade Nginx package and configuration for HTTP/3 QUIC, use the following command" wo_lib_echo_info "wo stack migrate --nginx" fi From 2de0d56a443bfd0676d4c1e5763c40eb808730e1 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Tue, 11 Jun 2024 22:24:34 +0200 Subject: [PATCH 03/10] Add $host variable for fastcgi_params et proxy_params --- wo/cli/plugins/stack_pref.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/wo/cli/plugins/stack_pref.py b/wo/cli/plugins/stack_pref.py index 4d37d01..64d692c 100644 --- a/wo/cli/plugins/stack_pref.py +++ b/wo/cli/plugins/stack_pref.py @@ -149,6 +149,19 @@ def post_pref(self, apt_packages, packages, upgrade=False): encoding='utf-8', mode='a') as wo_nginx: wo_nginx.write('fastcgi_param \tSCRIPT_FILENAME ' '\t$request_filename;\n') + if not WOFileUtils.grep(self, '/etc/nginx/fastcgi_params', + 'HTTP_HOST'): + WOFileUtils.textappend(self, '/etc/nginx/fastcgi_params', + '# Fix for HTTP/3 QUIC HTTP_HOST\n' + 'fastcgi_param \tHTTP_HOST \t$host;\n') + if not WOFileUtils.grep(self, '/etc/nginx/proxy_params', + 'X-Forwarded-Host'): + WOFileUtils.textappend(self, '/etc/nginx/proxy_params', + 'proxy_set_header \tX-Forwarded-Host \t$host;\n') + if not WOFileUtils.grep(self, '/etc/nginx/proxy_params', + 'X-Forwarded-Port'): + WOFileUtils.textappend(self, '/etc/nginx/proxy_params', + 'proxy_set_header \tX-Forwarded-Port \t$server_port;\n') try: data = dict(php="9000", debug="9001", php7="9070", debug7="9170", From f6af66210015b6b783cff3458bc37aaff73425bd Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Tue, 11 Jun 2024 22:27:33 +0200 Subject: [PATCH 04/10] Properly indent proxy_params --- wo/cli/plugins/stack_pref.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wo/cli/plugins/stack_pref.py b/wo/cli/plugins/stack_pref.py index 64d692c..30cf1d8 100644 --- a/wo/cli/plugins/stack_pref.py +++ b/wo/cli/plugins/stack_pref.py @@ -157,11 +157,11 @@ def post_pref(self, apt_packages, packages, upgrade=False): if not WOFileUtils.grep(self, '/etc/nginx/proxy_params', 'X-Forwarded-Host'): WOFileUtils.textappend(self, '/etc/nginx/proxy_params', - 'proxy_set_header \tX-Forwarded-Host \t$host;\n') + 'proxy_set_header X-Forwarded-Host $host;\n') if not WOFileUtils.grep(self, '/etc/nginx/proxy_params', 'X-Forwarded-Port'): WOFileUtils.textappend(self, '/etc/nginx/proxy_params', - 'proxy_set_header \tX-Forwarded-Port \t$server_port;\n') + 'proxy_set_header X-Forwarded-Port $server_port;\n') try: data = dict(php="9000", debug="9001", php7="9070", debug7="9170", From 60835841c927b95547d5c495fc9522529abc0507 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Tue, 11 Jun 2024 22:37:16 +0200 Subject: [PATCH 05/10] Add "$http3" variable to logs --- wo/cli/templates/nginx-core.mustache | 4 ++-- wo/cli/templates/wo-plus.mustache | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wo/cli/templates/nginx-core.mustache b/wo/cli/templates/nginx-core.mustache index c7b6686..2ff85ac 100644 --- a/wo/cli/templates/nginx-core.mustache +++ b/wo/cli/templates/nginx-core.mustache @@ -94,8 +94,8 @@ http { # Log format Settings log_format rt_cache '$remote_addr $upstream_response_time $upstream_cache_status [$time_local] ' - '$http_host "$request" $status $body_bytes_sent ' - '"$http_referer" "$http_user_agent" "$server_protocol"'; + '$host "$request" $status $body_bytes_sent ' + '"$http_referer" "$http_user_agent" "$server_protocol" "$http3"'; ## # Virtual Host Configs diff --git a/wo/cli/templates/wo-plus.mustache b/wo/cli/templates/wo-plus.mustache index 7dfbb9a..872efdb 100644 --- a/wo/cli/templates/wo-plus.mustache +++ b/wo/cli/templates/wo-plus.mustache @@ -48,8 +48,8 @@ error_log /var/log/nginx/error.log; # Log format Settings log_format rt_cache '$remote_addr $upstream_response_time $upstream_cache_status [$time_local] ' -'$http_host "$request" $status $body_bytes_sent ' -'"$http_referer" "$http_user_agent" "$request_body"'; +'$host "$request" $status $body_bytes_sent ' +'"$http_referer" "$http_user_agent" "$request_body" "$http3"'; ## # Gzip Settings From c746767ec00011305653d867b1e83d7d857394c3 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Tue, 11 Jun 2024 22:49:53 +0200 Subject: [PATCH 06/10] Bump release to v3.21.2 --- CHANGELOG.md | 10 ++++++++++ install | 2 +- setup.py | 2 +- wo/cli/plugins/stack_pref.py | 4 ++-- wo/core/variables.py | 2 +- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b145e2f..079be38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### v3.22.0 - [Unreleased] +### v3.21.2 - 2024-06-11 + +#### Added + +- "$http3" variable in access_logs + +#### Fixed + +- $host variable for fastcgi_params et proxy_params + ### v3.21.1 - 2024-06-11 #### Fixed diff --git a/install b/install index 6333c9f..ba22a1a 100755 --- a/install +++ b/install @@ -9,7 +9,7 @@ # ------------------------------------------------------------------------- # wget -qO wo wops.cc && sudo -E bash wo # ------------------------------------------------------------------------- -# Version 3.21.1 - 2024-06-11 +# Version 3.21.2 - 2024-06-11 # ------------------------------------------------------------------------- # CONTENTS diff --git a/setup.py b/setup.py index e5543af..7543236 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ if os.geteuid() == 0: os.makedirs('/var/lib/wo/tmp/') setup(name='wordops', - version='3.21.1', + version='3.21.2', description='An essential toolset that eases server administration', long_description=LONG, long_description_content_type='text/markdown', diff --git a/wo/cli/plugins/stack_pref.py b/wo/cli/plugins/stack_pref.py index 30cf1d8..cfe7e6c 100644 --- a/wo/cli/plugins/stack_pref.py +++ b/wo/cli/plugins/stack_pref.py @@ -258,7 +258,7 @@ def post_pref(self, apt_packages, packages, upgrade=False): "$upstream_response_time " "$srcache_fetch_status " "[$time_local] '\n" - "'$http_host \"$request\" $status" + "'$host \"$request\" $status" " $body_bytes_sent '\n" "'\"$http_referer\" " "\"$http_user_agent\"';\n") @@ -897,7 +897,7 @@ def post_pref(self, apt_packages, packages, upgrade=False): "# Log format Settings\n" "log_format rt_cache_redis '$remote_addr " "$upstream_response_time $srcache_fetch_status " - "[$time_local] '\n '$http_host \"$request\" " + "[$time_local] '\n '$host \"$request\" " "$status $body_bytes_sent '\n'\"$http_referer\" " "\"$http_user_agent\"';\n") # set redis.conf parameter diff --git a/wo/core/variables.py b/wo/core/variables.py index 7c7e86a..183f2cc 100644 --- a/wo/core/variables.py +++ b/wo/core/variables.py @@ -15,7 +15,7 @@ class WOVar(): """Intialization of core variables""" # WordOps version - wo_version = "3.21.1" + wo_version = "3.21.2" # WordOps packages versions wo_adminer = "4.8.1" wo_phpmyadmin = "5.2.0" From ff5d39211a42cb9c5887655628eb875067b9f5f4 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Tue, 11 Jun 2024 22:53:06 +0200 Subject: [PATCH 07/10] Fix fastcgi_params indentation --- wo/cli/plugins/stack_pref.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wo/cli/plugins/stack_pref.py b/wo/cli/plugins/stack_pref.py index cfe7e6c..624c9be 100644 --- a/wo/cli/plugins/stack_pref.py +++ b/wo/cli/plugins/stack_pref.py @@ -153,7 +153,7 @@ def post_pref(self, apt_packages, packages, upgrade=False): 'HTTP_HOST'): WOFileUtils.textappend(self, '/etc/nginx/fastcgi_params', '# Fix for HTTP/3 QUIC HTTP_HOST\n' - 'fastcgi_param \tHTTP_HOST \t$host;\n') + 'fastcgi_param\tHTTP_HOST\t$host;\n') if not WOFileUtils.grep(self, '/etc/nginx/proxy_params', 'X-Forwarded-Host'): WOFileUtils.textappend(self, '/etc/nginx/proxy_params', From 00b3f99e5d9f372071d95764225eef5057e8c3c2 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Tue, 11 Jun 2024 23:18:27 +0200 Subject: [PATCH 08/10] Another fix for wildcard certificates --- wo/cli/plugins/stack_migrate.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/wo/cli/plugins/stack_migrate.py b/wo/cli/plugins/stack_migrate.py index 91b32fe..355b3dd 100644 --- a/wo/cli/plugins/stack_migrate.py +++ b/wo/cli/plugins/stack_migrate.py @@ -11,6 +11,7 @@ from wo.core.shellexec import WOShellExec from wo.core.variables import WOVar from wo.cli.plugins.sitedb import (getAllsites) from wo.core.template import WOTemplate +from wo.core.domainvalidate import WODomain class WOStackMigrateController(CementBaseController): @@ -118,13 +119,23 @@ class WOStackMigrateController(CementBaseController): for site in allsites: if not site: pass - if (os.path.exists(f'/var/www/{site.sitename}/conf/nginx/ssl.conf') and - not os.path.islink(f'/var/www/{site.sitename}/conf/nginx/ssl.conf')): - data = dict(ssl_live_path=WOVar.wo_ssl_live, - domain=site.sitename, quic=True) - WOTemplate.deploy( - self, f'/var/www/{site.sitename}/conf/nginx/ssl.conf', - 'ssl.mustache', data, overwrite=True) + if os.path.exists(f'/var/www/{site.sitename}/conf/nginx/ssl.conf'): + if not os.path.islink(f'/var/www/{site.sitename}/conf/nginx/ssl.conf'): + data = dict(ssl_live_path=WOVar.wo_ssl_live, + domain=site.sitename, quic=True) + WOTemplate.deploy( + self, f'/var/www/{site.sitename}/conf/nginx/ssl.conf', + 'ssl.mustache', data, overwrite=True) + else: + (wo_domain_type, wo_root_domain) = WODomain.getlevel( + self, site.sitename) + if (site.sitename != wo_root_domain and + os.path.exists(f'/etc/letsencrypt/shared/{wo_root_domain}.conf')): + data = dict(ssl_live_path=WOVar.wo_ssl_live, + domain=wo_root_domain, quic=True) + WOTemplate.deploy( + self, f'/etc/letsencrypt/shared/{wo_root_domain}.conf', + 'ssl.mustache', data, overwrite=True) post_pref(self, WOVar.wo_nginx, []) @expose(hide=True) From f8c5da48575cd3ca256c829beb5c098da98bfb5c Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Tue, 11 Jun 2024 23:36:01 +0200 Subject: [PATCH 09/10] Fix unused variable --- wo/cli/plugins/stack_migrate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wo/cli/plugins/stack_migrate.py b/wo/cli/plugins/stack_migrate.py index 355b3dd..1054f58 100644 --- a/wo/cli/plugins/stack_migrate.py +++ b/wo/cli/plugins/stack_migrate.py @@ -127,7 +127,7 @@ class WOStackMigrateController(CementBaseController): self, f'/var/www/{site.sitename}/conf/nginx/ssl.conf', 'ssl.mustache', data, overwrite=True) else: - (wo_domain_type, wo_root_domain) = WODomain.getlevel( + (_, wo_root_domain) = WODomain.getlevel( self, site.sitename) if (site.sitename != wo_root_domain and os.path.exists(f'/etc/letsencrypt/shared/{wo_root_domain}.conf')): From 30d8c435bde26a2d697b1e7287d19ad148e31414 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Tue, 11 Jun 2024 23:53:23 +0200 Subject: [PATCH 10/10] Fix mariadb repo migration --- install | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/install b/install index ba22a1a..01e8d9c 100755 --- a/install +++ b/install @@ -263,8 +263,15 @@ wo_update_repo() { echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $wo_linux_codename main" >/etc/apt/sources.list.d/php.list fi # properly define mariadb repository + repo_file="/etc/apt/sources.list.d/wo-repo.list" if grep -q mariadb /etc/apt/sources.list.d/wo-repo.list; then - mariadb_repo=$(grep mariadb /etc/apt/sources.list.d/wo-repo.list | awk -F\ '{ print $3 }') + repo_number=$(grep -c "mariadb" "$repo_file") + if [ "$repo_number" -gt 1 ]; then + get_urls=$(grep "mariadb" "$repo_file" | awk '{print $3}') + mariadb_repo=$(echo "$get_urls" | sort -t '/' -k 6,6 -V | tail -n 1) + else + mariadb_repo=$(grep mariadb /etc/apt/sources.list.d/wo-repo.list | awk '{print $3}') + fi echo "deb [signed-by=/etc/apt/keyrings/mariadb-keyring.pgp] $mariadb_repo $wo_linux_codename main" >/etc/apt/sources.list.d/mariadb.list fi # properly define redis repository