refs #1935 look for cert files on startup
parent
16d24f3d96
commit
fdd4e6d2ca
|
@ -36,6 +36,6 @@ urlMenu={}://{}/menu-browser
|
|||
urlMsg=http://localhost/cgi-bin/httpd-log.sh
|
||||
|
||||
# TLS
|
||||
ca=/opt/opengnsys/ca.crt
|
||||
crt=/opt/opengnsys/ogagent.crt
|
||||
key=/opt/opengnsys/ogagent.key
|
||||
ca=/opt/opengnsys/etc/ca.crt
|
||||
crt=/opt/opengnsys/etc/ogagent.crt
|
||||
key=/opt/opengnsys/etc/ogagent.key
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
|
||||
|
||||
import os
|
||||
import requests
|
||||
import logging
|
||||
import json
|
||||
|
@ -113,6 +114,14 @@ class REST(object):
|
|||
if not ca_file or not crt_file or not key_file:
|
||||
raise Exception ('missing TLS parameters in REST constructor')
|
||||
|
||||
errs = 0
|
||||
for f in [ca_file, crt_file, key_file]:
|
||||
if not os.path.exists (f):
|
||||
logger.error (f'{f}: No such file or directory')
|
||||
errs += 1
|
||||
if errs:
|
||||
raise Exception ('TLS files not found')
|
||||
|
||||
# Disable logging requests messages except for errors, ...
|
||||
logging.getLogger("requests").setLevel(logging.CRITICAL)
|
||||
# Tries to disable all warnings
|
||||
|
|
Loading…
Reference in New Issue