Skip to content
Snippets Groups Projects
Commit 227f32bb authored by Florent Thiery's avatar Florent Thiery
Browse files

add ssl certificate test, fixes #20586

parent 9d021dff
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2017, Florent Thiery
'''
Criticality: Normal
Checks that SSL certificates are valid; if invalid, the user will have to add an exception in his browser
'''
import os
import sys
import requests
import imp
os.chdir(os.path.dirname(__file__))
if not os.path.isfile('../utils.py'):
print('conf.sh not found')
sys.exit(1)
es_utils = imp.load_source('es_utils', '../utils.py')
conf = es_utils.load_conf()
all_ok = True
conf_servers = (
'MS_SERVER_NAME',
'MONITOR_SERVER_NAME',
'CM_SERVER_NAME',
)
for s in conf_servers:
v = conf.get(s)
try:
url = "https://%s" % s
requests.get(url)
sys.exit(0)
except requests.exceptions.SSLError as e:
print('Error: SSL certificate for %s is not valid' % (url, e))
sys.exit(1)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment