mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2025-04-29 04:17:07 +00:00
add get_ssh_port function & better error message for ssh service failure
This commit is contained in:
parent
61c1dc4984
commit
f46eb195d3
@ -43,6 +43,17 @@ def run_checks(env, output):
|
|||||||
r1.get().playback(output)
|
r1.get().playback(output)
|
||||||
r2.playback(output)
|
r2.playback(output)
|
||||||
|
|
||||||
|
def get_ssh_port():
|
||||||
|
# Returns ssh port
|
||||||
|
output = shell('check_output', ['sshd', '-T'])
|
||||||
|
returnNext = False
|
||||||
|
|
||||||
|
for e in output.split():
|
||||||
|
if returnNext:
|
||||||
|
return int(e)
|
||||||
|
if e == "port":
|
||||||
|
returnNext = True
|
||||||
|
|
||||||
def run_services_checks(env, output):
|
def run_services_checks(env, output):
|
||||||
# Check that system services are running.
|
# Check that system services are running.
|
||||||
|
|
||||||
@ -58,7 +69,7 @@ def run_services_checks(env, output):
|
|||||||
{ "name": "Sieve (dovecot)", "port": 4190, "public": True, },
|
{ "name": "Sieve (dovecot)", "port": 4190, "public": True, },
|
||||||
{ "name": "Mail-in-a-Box Management Daemon", "port": 10222, "public": False, },
|
{ "name": "Mail-in-a-Box Management Daemon", "port": 10222, "public": False, },
|
||||||
|
|
||||||
{ "name": "SSH Login (ssh)", "port": int(env['SSH_PORT']), "public": True, },
|
{ "name": "SSH Login (ssh)", "port": get_ssh_port(), "public": True, },
|
||||||
{ "name": "Public DNS (nsd4)", "port": 53, "public": True, },
|
{ "name": "Public DNS (nsd4)", "port": 53, "public": True, },
|
||||||
{ "name": "Incoming Mail (SMTP/postfix)", "port": 25, "public": True, },
|
{ "name": "Incoming Mail (SMTP/postfix)", "port": 25, "public": True, },
|
||||||
{ "name": "Outgoing Mail (SMTP 587/postfix)", "port": 587, "public": True, },
|
{ "name": "Outgoing Mail (SMTP 587/postfix)", "port": 587, "public": True, },
|
||||||
@ -96,7 +107,10 @@ def check_service(i, service, env):
|
|||||||
running = True
|
running = True
|
||||||
|
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
output.print_error("%s is not running (%s)." % (service['name'], str(e)))
|
if service['name'] == 'ssh':
|
||||||
|
output.print_error("%s is not running (%s). (Should be running on port %s)" % (service['name'], str(e), str(get_ssh_port())))
|
||||||
|
else:
|
||||||
|
output.print_error("%s is not running (%s)." % (service['name'], str(e)))
|
||||||
|
|
||||||
# Why is nginx not running?
|
# Why is nginx not running?
|
||||||
if service["port"] in (80, 443):
|
if service["port"] in (80, 443):
|
||||||
|
@ -109,7 +109,6 @@ PUBLIC_IPV6=$PUBLIC_IPV6
|
|||||||
PRIVATE_IP=$PRIVATE_IP
|
PRIVATE_IP=$PRIVATE_IP
|
||||||
PRIVATE_IPV6=$PRIVATE_IPV6
|
PRIVATE_IPV6=$PRIVATE_IPV6
|
||||||
CSR_COUNTRY=$CSR_COUNTRY
|
CSR_COUNTRY=$CSR_COUNTRY
|
||||||
SSH_PORT=$(sshd -T 2>/dev/null | grep "^port " | sed "s/port //")
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Start service configuration.
|
# Start service configuration.
|
||||||
|
Loading…
Reference in New Issue
Block a user