From d76d58d195faf4a0212748e1e6cca058ea3819af Mon Sep 17 00:00:00 2001 From: frju365 Date: Wed, 17 Jun 2020 21:58:43 +0200 Subject: [PATCH 1/4] Update change_url --- scripts/change_url | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/change_url b/scripts/change_url index f359091..730e7af 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -69,6 +69,7 @@ fi #================================================= ynh_script_progression --message="Updating nginx web server configuration..." --time --weight=1 +final_path=/var/www/$app nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf # Change the path in the nginx config file From 4a8d93391e5c012fe2c8fc58f6c2753c73949fa6 Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Thu, 18 Jun 2020 12:58:17 +0200 Subject: [PATCH 2/4] Correction for change_url (#23) * Update change_url * fix bug with path * remove backup when active trap Co-authored-by: frju365 --- scripts/change_url | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 730e7af..f71eefc 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -29,23 +29,6 @@ ynh_script_progression --message="Loading installation settings..." --time --wei # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --time --weight=1 - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. - ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" - - # restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED #================================================= @@ -71,6 +54,7 @@ ynh_script_progression --message="Updating nginx web server configuration..." -- final_path=/var/www/$app nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf +final_path=/var/www/$app # Change the path in the nginx config file if [ $change_path -eq 1 ] @@ -99,7 +83,7 @@ if [ $change_domain -eq 1 ]; then ynh_delete_file_checksum --file="$nginx_conf_path" mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf # Store file checksum for the new config file location - #ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" + ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi #================================================= From c6f5a20121304d5b340259d6d8f6586e4560c37a Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 25 Oct 2020 11:04:46 +0100 Subject: [PATCH 3/4] Update nginx.conf to protect against path traversal issue --- conf/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index a7ea00a..67f10fb 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,5 +1,5 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; -location __PATH__ { +location __PATH__/ { # Path to source alias __FINALPATH__/www/ ; From 3df967c680ede212bf233b2aa2a188585b4dceaa Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 4 Nov 2020 13:26:24 +0100 Subject: [PATCH 4/4] Fix weird diff --- scripts/change_url | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/change_url b/scripts/change_url index 2d1d427..8121108 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -52,7 +52,6 @@ fi #================================================= ynh_script_progression --message="Updating NGINX web server configuration..." --weight=5 -final_path=/var/www/$app nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf final_path=/var/www/$app