Browse Source

Pre-check HTTPS CERT and KEY files. Give warning if not good. (#1393)

* Pre-check HTTPS CERT and KEY files. Give warning if not good.

* Pre-check HTTPS CERT and KEY files: include traceback info

* Pre-check HTTPS CERT and KEY files: auto-launch browser with HTTP
pull/1397/head
Sander 5 years ago
committed by GitHub
parent
commit
a3ce436244
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      SABnzbd.py

12
SABnzbd.py

@ -1223,6 +1223,18 @@ def main():
if not (os.path.exists(https_cert) and os.path.exists(https_key)):
logging.warning(T('Disabled HTTPS because of missing CERT and KEY files'))
enable_https = False
sabnzbd.cfg.enable_https.set(False)
# So the cert and key files do exist, now let's check if they are valid:
trialcontext = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
try:
trialcontext.load_cert_chain(https_cert, https_key)
logging.info("HTTPS keys are OK")
except:
logging.warning(T('Disabled HTTPS because of invalid CERT and KEY files'))
logging.info("Traceback: ", exc_info=True)
enable_https = False
sabnzbd.cfg.enable_https.set(False)
# Starting of the webserver
# Determine if this system has multiple definitions for 'localhost'

Loading…
Cancel
Save