mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] Add check STMP outgoing port
This commit is contained in:
parent
5dd516c6ab
commit
4372fe5fe9
2 changed files with 14 additions and 1 deletions
|
@ -32,10 +32,13 @@ import subprocess
|
|||
import xmlrpclib
|
||||
import os.path
|
||||
import errno
|
||||
import os
|
||||
import cPickle as pickle
|
||||
from subprocess import Popen, PIPE
|
||||
from urllib import urlopen
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
|
||||
from moulinette.core import MoulinetteError
|
||||
|
||||
glances_uri = 'http://127.0.0.1:61209'
|
||||
|
@ -151,6 +154,12 @@ def monitor_network(units=None, human_readable=False):
|
|||
glances = _get_glances_api()
|
||||
result = {}
|
||||
|
||||
cmd_check_smtp = os.system('/bin/nc -z -w1 yunohost.org 25')
|
||||
if cmd_check_smtp == 0:
|
||||
smtp_check = m18n.n('network_check_smtp_ok')
|
||||
else:
|
||||
smtp_check = m18n.n('network_check_smtp_ko')
|
||||
|
||||
if units is None:
|
||||
units = ['usage', 'infos']
|
||||
|
||||
|
@ -201,7 +210,8 @@ def monitor_network(units=None, human_readable=False):
|
|||
result[u] = {
|
||||
'public_ip': p_ip,
|
||||
'local_ip': l_ip,
|
||||
'gateway': gateway
|
||||
'gateway': gateway,
|
||||
'smtp_check' : smtp_check
|
||||
}
|
||||
else:
|
||||
raise MoulinetteError(errno.EINVAL, m18n.n('unit_unknown', u))
|
||||
|
|
|
@ -116,6 +116,9 @@
|
|||
"service_no_log" : "No log to display for service '{:s}'",
|
||||
"service_cmd_exec_failed" : "Unable to execute command '{:s}'",
|
||||
|
||||
"network_check_smtp_ok" : "Outbound mail (SMTP port 25) is not blocked",
|
||||
"network_check_smtp_ko" : "Outbound mail (SMTP port 25) seems to be blocked by your network",
|
||||
|
||||
"ldap_initialized" : "LDAP successfully initialized",
|
||||
"admin_password_change_failed" : "Unable to change password",
|
||||
"admin_password_changed" : "Administration password successfully changed",
|
||||
|
|
Loading…
Add table
Reference in a new issue