From 0ebfa145b8ae7184cdc78638949013457803c39a Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 11 Jun 2018 23:40:23 +0200 Subject: [PATCH 1/7] Close port 465, open 587 during migration according to SMTP port change --- locales/en.json | 2 +- src/yunohost/data_migrations/0003_migrate_to_stretch.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/locales/en.json b/locales/en.json index e7bfd2ded..37160d403 100644 --- a/locales/en.json +++ b/locales/en.json @@ -235,7 +235,7 @@ "migration_0003_not_jessie": "The current debian distribution is not Jessie !", "migration_0003_system_not_fully_up_to_date": "Your system is not fully up to date. Please perform a regular upgrade before running the migration to stretch.", "migration_0003_still_on_jessie_after_main_upgrade": "Something wrong happened during the main upgrade : system is still on Jessie !? To investigate the issue, please look at {log} :s ...", - "migration_0003_general_warning": "Please note that this migration is a delicate operation. While the YunoHost team did its best to review and test it, the migration might still break parts of the system or apps.\n\nTherefore, we recommend you to :\n - Perform a backup of any critical data or app ;\n - Be patient after launching the migration : depending on your internet connection and hardware, it might take up to a few hours for everything to upgrade.", + "migration_0003_general_warning": "Please note that this migration is a delicate operation. While the YunoHost team did its best to review and test it, the migration might still break parts of the system or apps.\n\nTherefore, we recommend you to :\n - Perform a backup of any critical data or app. More infos on https://yunohost.org/backup ;\n - Be patient after launching the migration : depending on your internet connection and hardware, it might take up to a few hours for everything to upgrade.\n\nAdditionally, the port for SMTP, used by external email clients like (Thunderbird or K9-Mail) was changed from 465 (SSL/TLS) to 587 (STARTTLS). The old port 465 will automatically be closed and the new port 587 will be opened in the firewall. You and your users *will* have to adapt the configuration of your email clients accordingly!", "migration_0003_problematic_apps_warning": "Please note that the following possibly problematic installed apps were detected. It looks like those were not installed from an applist or are not flagged as 'working'. Consequently, we cannot guarantee that they will still work after the upgrade : {problematic_apps}", "migration_0003_modified_files": "Please note that the following files were found to be manually modified and might be overwritten at the end of the upgrade : {manually_modified_files}", "migrations_backward": "Migrating backward.", diff --git a/src/yunohost/data_migrations/0003_migrate_to_stretch.py b/src/yunohost/data_migrations/0003_migrate_to_stretch.py index 8b8d37447..6900b678a 100644 --- a/src/yunohost/data_migrations/0003_migrate_to_stretch.py +++ b/src/yunohost/data_migrations/0003_migrate_to_stretch.py @@ -15,6 +15,7 @@ from yunohost.service import (_run_service_command, manually_modified_files_compared_to_debian_default) from yunohost.utils.filesystem import free_space_in_directory from yunohost.utils.packages import get_installed_version +from yunohost.firewall import firewall_allow, firewall_disallow logger = getActionLogger('yunohost.migration') @@ -72,6 +73,11 @@ class MyMigration(Migration): os.system("apt autoremove --assume-yes") os.system("apt clean --assume-yes") + # We moved to port 587 for SMTP + # https://busylog.net/smtp-tls-ssl-25-465-587/ + firewall_allow("Both", 587) + firewall_disallow("Both", 465) + # Upgrade yunohost packages logger.warning(m18n.n("migration_0003_yunohost_upgrade")) self.restore_files_to_keep() From f96aa4450537dec77c4c1479bbdb1f36ad24d3c0 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 12 Jun 2018 00:05:47 +0200 Subject: [PATCH 2/7] Rely on the codename instead of release number because lsb_release is fokin stupid --- .../data_migrations/0003_migrate_to_stretch.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/yunohost/data_migrations/0003_migrate_to_stretch.py b/src/yunohost/data_migrations/0003_migrate_to_stretch.py index 6900b678a..add511a81 100644 --- a/src/yunohost/data_migrations/0003_migrate_to_stretch.py +++ b/src/yunohost/data_migrations/0003_migrate_to_stretch.py @@ -55,7 +55,7 @@ class MyMigration(Migration): _run_service_command("stop", "mysql") self.apt_dist_upgrade(conf_flags=["old", "miss", "def"]) _run_service_command("start", "mysql") - if self.debian_major_version() == 8: + if self.debian_major_version() == "jessie": raise MoulinetteError(m18n.n("migration_0003_still_on_jessie_after_main_upgrade", log=self.logfile)) # Specific upgrade for fail2ban... @@ -89,7 +89,10 @@ class MyMigration(Migration): # because "platform" relies on uname, which on some weird setups does # not behave correctly (still says running Jessie when lsb_release says # Stretch...) - return int(check_output("lsb_release -r").split("\t")[1][0]) + # Also lsb_release is fucking stupid and sometimes return "Release: 8" + # and "Codename: stretch". So apparently the codename is more reliable + # than the release number :| + return check_output("lsb_release -c").split("\t")[1].strip() def yunohost_major_version(self): return int(get_installed_version("yunohost").split('.')[0]) @@ -100,7 +103,7 @@ class MyMigration(Migration): # NB : we do both check to cover situations where the upgrade crashed # in the middle and debian version could be >= 9.x but yunohost package # would still be in 2.x... - if not self.debian_major_version() == 8 \ + if not self.debian_major_version() == "jessie" \ and not self.yunohost_major_version() == 2: raise MoulinetteError(m18n.n("migration_0003_not_jessie")) @@ -125,7 +128,7 @@ class MyMigration(Migration): # NB : we do both check to cover situations where the upgrade crashed # in the middle and debian version could be >= 9.x but yunohost package # would still be in 2.x... - if not self.debian_major_version() == 8 \ + if not self.debian_major_version() == "jessie" \ and not self.yunohost_major_version() == 2: return None From 201edd8c38b7ab333f05e38ee00a3a1e4b517504 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 12 Jun 2018 00:29:30 +0200 Subject: [PATCH 3/7] Revert "Rely on the codename instead of release number because lsb_release is fokin stupid" This reverts commit f96aa4450537dec77c4c1479bbdb1f36ad24d3c0. --- .../data_migrations/0003_migrate_to_stretch.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/yunohost/data_migrations/0003_migrate_to_stretch.py b/src/yunohost/data_migrations/0003_migrate_to_stretch.py index add511a81..6900b678a 100644 --- a/src/yunohost/data_migrations/0003_migrate_to_stretch.py +++ b/src/yunohost/data_migrations/0003_migrate_to_stretch.py @@ -55,7 +55,7 @@ class MyMigration(Migration): _run_service_command("stop", "mysql") self.apt_dist_upgrade(conf_flags=["old", "miss", "def"]) _run_service_command("start", "mysql") - if self.debian_major_version() == "jessie": + if self.debian_major_version() == 8: raise MoulinetteError(m18n.n("migration_0003_still_on_jessie_after_main_upgrade", log=self.logfile)) # Specific upgrade for fail2ban... @@ -89,10 +89,7 @@ class MyMigration(Migration): # because "platform" relies on uname, which on some weird setups does # not behave correctly (still says running Jessie when lsb_release says # Stretch...) - # Also lsb_release is fucking stupid and sometimes return "Release: 8" - # and "Codename: stretch". So apparently the codename is more reliable - # than the release number :| - return check_output("lsb_release -c").split("\t")[1].strip() + return int(check_output("lsb_release -r").split("\t")[1][0]) def yunohost_major_version(self): return int(get_installed_version("yunohost").split('.')[0]) @@ -103,7 +100,7 @@ class MyMigration(Migration): # NB : we do both check to cover situations where the upgrade crashed # in the middle and debian version could be >= 9.x but yunohost package # would still be in 2.x... - if not self.debian_major_version() == "jessie" \ + if not self.debian_major_version() == 8 \ and not self.yunohost_major_version() == 2: raise MoulinetteError(m18n.n("migration_0003_not_jessie")) @@ -128,7 +125,7 @@ class MyMigration(Migration): # NB : we do both check to cover situations where the upgrade crashed # in the middle and debian version could be >= 9.x but yunohost package # would still be in 2.x... - if not self.debian_major_version() == "jessie" \ + if not self.debian_major_version() == 8 \ and not self.yunohost_major_version() == 2: return None From 1b55eacf9cd1e41f65e222d830ed760eba012b9c Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 12 Jun 2018 00:29:52 +0200 Subject: [PATCH 4/7] Rely on /etc/os-release to get the release number.. --- .../data_migrations/0003_migrate_to_stretch.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/yunohost/data_migrations/0003_migrate_to_stretch.py b/src/yunohost/data_migrations/0003_migrate_to_stretch.py index 6900b678a..49e85a64e 100644 --- a/src/yunohost/data_migrations/0003_migrate_to_stretch.py +++ b/src/yunohost/data_migrations/0003_migrate_to_stretch.py @@ -85,11 +85,13 @@ class MyMigration(Migration): self.upgrade_yunohost_packages() def debian_major_version(self): - # We rely on lsb_release instead of the python module "platform", - # because "platform" relies on uname, which on some weird setups does - # not behave correctly (still says running Jessie when lsb_release says - # Stretch...) - return int(check_output("lsb_release -r").split("\t")[1][0]) + # The python module "platform" and lsb_release are not reliable because + # on some setup, they still return Release=8 even after upgrading to + # stretch ... (Apparently this is related to OVH overriding some stuff + # with /etc/lsb-release for instance -_-) + # Instead, we rely on /etc/os-release which should be the raw info from + # the distribution... + return int(check_output("grep VERSION_ID /etc/os-release | tr '\"' ' ' | cut -d ' ' -f2")) def yunohost_major_version(self): return int(get_installed_version("yunohost").split('.')[0]) From 98862ee25613f8d8aaf92b71e145de8692495c3c Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 12 Jun 2018 01:04:04 +0200 Subject: [PATCH 5/7] Update changelog --- debian/changelog | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/debian/changelog b/debian/changelog index 9bd67a3f8..2c855eae1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +yunohost (2.7.13.5) testing; urgency=low + + * [fix] a bug when log to be fetched is empty + * [fix] a bug when computing diff in regen_conf + * [stretch-migration] Tell postgresql-common to not send an email about 9.4->9.6 migration + * [stretch-migration] Close port 465 / open port 587 during migration according to SMTP port change in postfix + * [stretch-migration] Rely on /etc/os-release to get debian release number + + Fixes by Bram and Aleks + + -- Alexandre Aubin Tue, 12 Jun 2018 01:00:00 +0000 + yunohost (2.7.13.4) testing; urgency=low * Fix a bug for services with alternate names (mysql<->mariadb) From abf0b6c0d9a37c3b790bc03f299da67eea7f5b90 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 12 Jun 2018 23:22:31 +0200 Subject: [PATCH 6/7] Typo --- locales/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locales/en.json b/locales/en.json index 37160d403..4ca65826c 100644 --- a/locales/en.json +++ b/locales/en.json @@ -235,7 +235,7 @@ "migration_0003_not_jessie": "The current debian distribution is not Jessie !", "migration_0003_system_not_fully_up_to_date": "Your system is not fully up to date. Please perform a regular upgrade before running the migration to stretch.", "migration_0003_still_on_jessie_after_main_upgrade": "Something wrong happened during the main upgrade : system is still on Jessie !? To investigate the issue, please look at {log} :s ...", - "migration_0003_general_warning": "Please note that this migration is a delicate operation. While the YunoHost team did its best to review and test it, the migration might still break parts of the system or apps.\n\nTherefore, we recommend you to :\n - Perform a backup of any critical data or app. More infos on https://yunohost.org/backup ;\n - Be patient after launching the migration : depending on your internet connection and hardware, it might take up to a few hours for everything to upgrade.\n\nAdditionally, the port for SMTP, used by external email clients like (Thunderbird or K9-Mail) was changed from 465 (SSL/TLS) to 587 (STARTTLS). The old port 465 will automatically be closed and the new port 587 will be opened in the firewall. You and your users *will* have to adapt the configuration of your email clients accordingly!", + "migration_0003_general_warning": "Please note that this migration is a delicate operation. While the YunoHost team did its best to review and test it, the migration might still break parts of the system or apps.\n\nTherefore, we recommend you to :\n - Perform a backup of any critical data or app. More infos on https://yunohost.org/backup ;\n - Be patient after launching the migration : depending on your internet connection and hardware, it might take up to a few hours for everything to upgrade.\n\nAdditionally, the port for SMTP, used by external email clients (like Thunderbird or K9-Mail) was changed from 465 (SSL/TLS) to 587 (STARTTLS). The old port 465 will automatically be closed and the new port 587 will be opened in the firewall. You and your users *will* have to adapt the configuration of your email clients accordingly!", "migration_0003_problematic_apps_warning": "Please note that the following possibly problematic installed apps were detected. It looks like those were not installed from an applist or are not flagged as 'working'. Consequently, we cannot guarantee that they will still work after the upgrade : {problematic_apps}", "migration_0003_modified_files": "Please note that the following files were found to be manually modified and might be overwritten at the end of the upgrade : {manually_modified_files}", "migrations_backward": "Migrating backward.", From 9df14c6506993ba81af186764731296af009d261 Mon Sep 17 00:00:00 2001 From: Bram Date: Tue, 12 Jun 2018 23:43:40 +0200 Subject: [PATCH 7/7] [fix] remove slice by mistake in 14c270cebdc67a1123331237cee6dba347ee7623 --- src/yunohost/service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/yunohost/service.py b/src/yunohost/service.py index 0ce8073fa..ef711a4a9 100644 --- a/src/yunohost/service.py +++ b/src/yunohost/service.py @@ -709,7 +709,7 @@ def _tail(file, n): lines = f.read().splitlines() if len(lines) >= to_read or pos == 0: - return lines[-to_read] + return lines[-to_read:] avg_line_length *= 1.3