mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2024-11-22 02:17:26 +00:00
status checks were broken if sshd was not present, fixes #444
This commit is contained in:
parent
ab36cc8968
commit
6258a7f311
@ -19,6 +19,7 @@ DNS:
|
|||||||
|
|
||||||
Control panel:
|
Control panel:
|
||||||
* Resetting a user's password now forces them to log in again everywhere.
|
* Resetting a user's password now forces them to log in again everywhere.
|
||||||
|
* Status checks were not working if an ssh server was not installed.
|
||||||
|
|
||||||
System:
|
System:
|
||||||
* The munin system monitoring tool is now installed and accessible at /admin/munin.
|
* The munin system monitoring tool is now installed and accessible at /admin/munin.
|
||||||
|
@ -42,16 +42,22 @@ def run_checks(rounded_values, env, output, pool):
|
|||||||
|
|
||||||
def get_ssh_port():
|
def get_ssh_port():
|
||||||
# Returns ssh port
|
# Returns ssh port
|
||||||
|
try:
|
||||||
output = shell('check_output', ['sshd', '-T'])
|
output = shell('check_output', ['sshd', '-T'])
|
||||||
returnNext = False
|
except FileNotFoundError:
|
||||||
|
# sshd is not installed. That's ok.
|
||||||
|
return None
|
||||||
|
|
||||||
|
returnNext = False
|
||||||
for e in output.split():
|
for e in output.split():
|
||||||
if returnNext:
|
if returnNext:
|
||||||
return int(e)
|
return int(e)
|
||||||
if e == "port":
|
if e == "port":
|
||||||
returnNext = True
|
returnNext = True
|
||||||
|
|
||||||
|
# Did not find port!
|
||||||
|
return None
|
||||||
|
|
||||||
def run_services_checks(env, output, pool):
|
def run_services_checks(env, output, pool):
|
||||||
# Check that system services are running.
|
# Check that system services are running.
|
||||||
|
|
||||||
@ -82,6 +88,7 @@ def run_services_checks(env, output, pool):
|
|||||||
fatal = False
|
fatal = False
|
||||||
ret = pool.starmap(check_service, ((i, service, env) for i, service in enumerate(services)), chunksize=1)
|
ret = pool.starmap(check_service, ((i, service, env) for i, service in enumerate(services)), chunksize=1)
|
||||||
for i, running, fatal2, output2 in sorted(ret):
|
for i, running, fatal2, output2 in sorted(ret):
|
||||||
|
if output2 is None: continue # skip check (e.g. no port was set, e.g. no sshd)
|
||||||
all_running = all_running and running
|
all_running = all_running and running
|
||||||
fatal = fatal or fatal2
|
fatal = fatal or fatal2
|
||||||
output2.playback(output)
|
output2.playback(output)
|
||||||
@ -92,6 +99,10 @@ def run_services_checks(env, output, pool):
|
|||||||
return not fatal
|
return not fatal
|
||||||
|
|
||||||
def check_service(i, service, env):
|
def check_service(i, service, env):
|
||||||
|
if not service["port"]:
|
||||||
|
# Skip check (no port, e.g. no sshd).
|
||||||
|
return (i, None, None, None)
|
||||||
|
|
||||||
import socket
|
import socket
|
||||||
output = BufferedOutput()
|
output = BufferedOutput()
|
||||||
running = False
|
running = False
|
||||||
|
Loading…
Reference in New Issue
Block a user