diff --git a/README.md b/README.md index caa3c5f..8ed6203 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Lightweight multi-account webmail - Autocompletion of e-mail addresses. -**Shipped version:** 1.16.0~ynh4 +**Shipped version:** 1.17.0~ynh1 **Demo:** https://mail.rainloop.net/ diff --git a/README_fr.md b/README_fr.md index a62bb57..da44a65 100644 --- a/README_fr.md +++ b/README_fr.md @@ -35,7 +35,7 @@ Lightweight multi-account webmail - Autocompletion of e-mail addresses. -**Version incluse :** 1.16.0~ynh4 +**Version incluse :** 1.17.0~ynh1 **Démo :** https://mail.rainloop.net/ diff --git a/conf/app.src b/conf/app.src index 345039c..1a0b011 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/RainLoop/rainloop-webmail/releases/download/v1.16.0/rainloop-community-1.16.0.zip -SOURCE_SUM=db949c4363b048a02eaa0f06a26a8386979b8734198c2939ee1e8cc54362ca67 +SOURCE_URL=https://github.com/RainLoop/rainloop-webmail/releases/download/v1.17.0/rainloop-legacy-1.17.0.zip +SOURCE_SUM=782dcabacadab5d7176f7701dd23319a040b2cfbf974fac6df068600cf69c50a SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=false diff --git a/manifest.json b/manifest.json index 19651f5..e6ad9a0 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Lightweight multi-account webmail", "fr": "Webmail léger multi-comptes" }, - "version": "1.16.0~ynh4", + "version": "1.17.0~ynh1", "url": "https://www.rainloop.net/", "upstream": { "license": "AGPL-3.0-or-later", @@ -20,12 +20,12 @@ "name": "scith, Djip007, polytan02" }, "requirements": { - "yunohost": ">= 4.3.0" + "yunohost": ">= 11.0.9" }, "multi_instance": true, "services": [ "nginx", - "php7.3-fpm", + "php7.4-fpm", "mysql" ], "arguments": { diff --git a/scripts/_common.sh b/scripts/_common.sh index 1066592..a34ae03 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,7 +4,7 @@ # PERSONAL HELPERS #================================================= -YNH_PHP_VERSION="7.3" +YNH_PHP_VERSION="7.4" pkg_dependencies="php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-dom" diff --git a/scripts/install b/scripts/install index 4bba9f4..8ad274c 100644 --- a/scripts/install +++ b/scripts/install @@ -87,22 +87,6 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path/app" -ynh_script_progression --message="Patching CVE-2022-29360 code vulnerability..." --weight=1 -# Deploy CVE-2022-29360 patch -version=$(ynh_app_upstream_version) -# FIXME because we need to apply the patch manually with --binary flag -# while we should be able to simply use the patching feature of ynh_setup_source -ynh_add_config --template="../sources/patches/app-CVE-2022-29360.patch.template" --destination="../sources/patches/FIXMEapp-CVE-2022-29360.patch" -patch --silent --binary $final_path/app/rainloop/v/$version/app/libraries/MailSo/Base/HtmlUtils.php < ../sources/patches/FIXMEapp-CVE-2022-29360.patch - -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=2 - -# Create a dedicated NGINX config -ynh_add_nginx_config - #================================================= # PHP-FPM CONFIGURATION #================================================= @@ -112,6 +96,14 @@ ynh_script_progression --message="Configuring PHP-FPM..." --weight=2 ynh_add_fpm_config phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Configuring NGINX web server..." --weight=2 + +# Create a dedicated NGINX config +ynh_add_nginx_config + #================================================= # SPECIFIC SETUP #================================================= diff --git a/scripts/restore b/scripts/restore index b4fb151..1394828 100644 --- a/scripts/restore +++ b/scripts/restore @@ -13,6 +13,10 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= +ynh_clean_setup () { + #### Remove this function if there's nothing to clean before calling the remove script. + true +} # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -39,12 +43,6 @@ test ! -d $final_path || ynh_die --message="There is already a directory: $final #================================================= # STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -73,6 +71,14 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql +#================================================= +# REINSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Reinstalling dependencies..." --weight=1 + +# Define and install dependencies +ynh_install_app_dependencies $pkg_dependencies + #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= @@ -81,12 +87,11 @@ ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weig ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= -# REINSTALL DEPENDENCIES +# RESTORE THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=1 +ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1 -# Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE FAIL2BAN CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 4db3a40..ee9102c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -112,23 +112,6 @@ then ynh_setup_source --dest_dir="$final_path/app" fi -ynh_script_progression --message="Patching CVE-2022-29360 code vulnerability..." --weight=1 -ynh_print_warn --message="You should stop using Rainloop, its upstream code is not maintained anymore" -# Deploy CVE-2022-29360 patch -version=$(ynh_app_upstream_version) -# FIXME because we need to apply the patch manually with --binary flag -# while we should be able to simply use the patching feature of ynh_setup_source -ynh_add_config --template="../sources/patches/app-CVE-2022-29360.patch.template" --destination="../sources/patches/FIXMEapp-CVE-2022-29360.patch" -patched="$(patch --silent --binary --forward $final_path/app/rainloop/v/$version/app/libraries/MailSo/Base/HtmlUtils.php <../sources/patches/FIXMEapp-CVE-2022-29360.patch)" || echo "${patched}" | grep "Reversed (or previously applied) patch detected! Skipping patch." -q || (echo "$patched" && false); - -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 - -# Create a dedicated NGINX config -ynh_add_nginx_config - #================================================= # UPGRADE DEPENDENCIES #================================================= @@ -144,6 +127,14 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 # Create a dedicated PHP-FPM config ynh_add_fpm_config +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 + +# Create a dedicated NGINX config +ynh_add_nginx_config + #================================================= # SPECIFIC UPGRADE #================================================= @@ -151,8 +142,8 @@ ynh_add_fpm_config #================================================= ynh_script_progression --message="Upgrading Rainloop configuration..." --weight=2 -# Upgrade time_offset value for fail2ban -# FIXME Temporary fix for rainloop, waiting for https://github.com/YunoHost/yunohost/pull/752 to be released. +# Upgrade time_offset value for Fail2Ban +# FIXME Temporary fix for Rainloop, waiting for https://github.com/YunoHost/yunohost/pull/752 to be released. # ynh_replace_string --match_string="^time_offset = .*" --replace_string="time_offset = $(date +%:::z)" --target_file="$final_path/app/data/_data_/_default_/configs/application.ini" timezone="$(date +%:::z)" ynh_replace_string --match_string="^time_offset = .*" --replace_string="time_offset = ${timezone//-/\\-}" --target_file="$final_path/app/data/_data_/_default_/configs/application.ini" diff --git a/sources/patches/app-CVE-2022-29360.patch.template b/sources/patches/app-CVE-2022-29360.patch.template deleted file mode 100644 index 79fceee..0000000 --- a/sources/patches/app-CVE-2022-29360.patch.template +++ /dev/null @@ -1,23 +0,0 @@ -diff --git a/rainloop/v/__VERSION__/app/libraries/MailSo/Base/HtmlUtils.php b/rainloop/v/__VERSION__/app/libraries/MailSo/Base/HtmlUtils.new -index 2177627..f1e014e 100644 ---- a/rainloop/v/__VERSION__/app/libraries/MailSo/Base/HtmlUtils.php -+++ b/rainloop/v/__VERSION__/app/libraries/MailSo/Base/HtmlUtils.new -@@ -239,7 +239,8 @@ class HtmlUtils - $oWrapHtml->setAttribute($sKey, $sValue); - } - -- $oWrapDom = $oDom->createElement('div', '___xxx___'); -+ $rand_str = base64_encode(random_bytes(32)); -+ $oWrapDom = $oDom->createElement('div', $rand_str); - $oWrapDom->setAttribute('data-x-div-type', 'body'); - foreach ($aBodylAttrs as $sKey => $sValue) - { -@@ -250,7 +251,7 @@ class HtmlUtils - - $sWrp = $oDom->saveHTML($oWrapHtml); - -- $sResult = \str_replace('___xxx___', $sResult, $sWrp); -+ $sResult = \str_replace($rand_str, $sResult, $sWrp); - } - - $sResult = \str_replace(\MailSo\Base\HtmlUtils::$KOS, ':', $sResult);