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}",