From c39a1f010ea17b623c6cc0815cf8da7b45b4f14a Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 7 Nov 2019 22:19:07 +0100 Subject: [PATCH 1/3] Mistakes were made --- src/yunohost/regenconf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/yunohost/regenconf.py b/src/yunohost/regenconf.py index 5681f12a4..665b906d6 100644 --- a/src/yunohost/regenconf.py +++ b/src/yunohost/regenconf.py @@ -138,7 +138,8 @@ def regen_conf(operation_logger, names=[], with_diff=False, force=False, dry_run # services.yml (which will happens only during the regen-conf of # 'yunohost', so at the very end of the regen-conf cycle) Anyway, # this can be safely removed once we're in >= 4.0 - names.remove("glances") + if "glances" in names: + names.remove("glances") pre_result = hook_callback('conf_regen', names, pre_callback=_pre_call) From 65d6b02b5604421a9df30206ba29656d2a36e4e9 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Fri, 8 Nov 2019 19:22:54 +0100 Subject: [PATCH 2/3] Implement basic outgoing port 25 check for email stack --- data/hooks/diagnosis/18-mail.py | 16 ++++++++++------ locales/en.json | 3 +++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/data/hooks/diagnosis/18-mail.py b/data/hooks/diagnosis/18-mail.py index c12c15cff..f0060df52 100644 --- a/data/hooks/diagnosis/18-mail.py +++ b/data/hooks/diagnosis/18-mail.py @@ -13,16 +13,20 @@ class MailDiagnoser(Diagnoser): def run(self): - # TODO / FIXME TO BE IMPLEMETED in the future ... + # Is outgoing port 25 filtered somehow ? + if os.system('/bin/nc -z -w2 yunohost.org 25') == 0: + yield dict(meta={"test": "ougoing_port_25"}, + status="SUCCESS", + summary=("diagnosis_mail_ougoing_port_25_ok",{})) + else: + yield dict(meta={"test": "outgoing_port_25"}, + status="ERROR", + summary=("diagnosis_mail_ougoing_port_25_blocked",{})) + - yield dict(meta={}, - status="WARNING", - summary=("nothing_implemented_yet", {})) # Mail blacklist using dig requests (c.f. ljf's code) - # Outgoing port 25 (c.f. code in monitor.py, a simple 'nc -zv yunohost.org 25' IIRC) - # SMTP reachability (c.f. check-smtp to be implemented on yunohost's remote diagnoser) # ideally, SPF / DMARC / DKIM validation ... (c.f. https://github.com/alexAubin/yunoScripts/blob/master/yunoDKIM.py possibly though that looks horrible) diff --git a/locales/en.json b/locales/en.json index 751180a37..9a9855116 100644 --- a/locales/en.json +++ b/locales/en.json @@ -191,6 +191,8 @@ "diagnosis_swap_none": "The system has no swap at all. You should consider adding at least 256 MB of swap to avoid situations where the system runs out of memory.", "diagnosis_swap_notsomuch": "The system has only {total_MB} MB swap. You should consider having at least 256 MB to avoid situations where the system runs out of memory.", "diagnosis_swap_ok": "The system has {total_MB} MB of swap!", + "diagnosis_mail_ougoing_port_25_ok": "Outgoing port 25 is not blocked and email can be sent to other servers.", + "diagnosis_mail_ougoing_port_25_blocked": "Outgoing port 25 appears to be blocked. You should try to unblock it in your internet service provider (or hoster) configuration panel. Meanwhile, the server won't be able to send emails to other servers.", "diagnosis_regenconf_allgood": "All configurations files are in line with the recommended configuration!", "diagnosis_regenconf_manually_modified": "Configuration file {file} was manually modified.", "diagnosis_regenconf_manually_modified_details": "This is probably OK as long as you know what you're doing ;) !", @@ -207,6 +209,7 @@ "diagnosis_description_systemresources": "System resources", "diagnosis_description_ports": "Ports exposure", "diagnosis_description_http": "HTTP exposure", + "diagnosis_description_mail": "Email", "diagnosis_description_regenconf": "System configurations", "diagnosis_description_security": "Security checks", "diagnosis_ports_could_not_diagnose": "Could not diagnose if ports are reachable from outside. Error: {error}", From 104bba3dd86e995a5d80c17954a5c515b0da60be Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Fri, 8 Nov 2019 20:44:27 +0100 Subject: [PATCH 3/3] Sort services during diagnosis to avoid random order --- data/hooks/diagnosis/30-services.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/hooks/diagnosis/30-services.py b/data/hooks/diagnosis/30-services.py index 6589d83f2..32f99c84d 100644 --- a/data/hooks/diagnosis/30-services.py +++ b/data/hooks/diagnosis/30-services.py @@ -26,7 +26,7 @@ class ServicesDiagnoser(Diagnoser): all_result = service_status() - for service, result in all_result.items(): + for service, result in sorted(all_result.items()): if service in services_ignored: continue