Make webserver TLS version advanced config

Ref: #1870
This commit is contained in:
JonnyWong16 2022-11-14 11:09:22 -08:00
parent 100fdd1df1
commit 0f39171f93
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
2 changed files with 7 additions and 1 deletions

View file

@ -126,6 +126,7 @@ _CONFIG_DEFINITIONS = {
'HTTPS_KEY': (str, 'General', ''),
'HTTPS_DOMAIN': (str, 'General', 'localhost'),
'HTTPS_IP': (str, 'General', '127.0.0.1'),
'HTTPS_MIN_TLS_VERSION': (str, 'Advanced', 'TLSv1.2'),
'HTTP_BASIC_AUTH': (int, 'General', 0),
'HTTP_ENVIRONMENT': (str, 'General', 'production'),
'HTTP_HASH_PASSWORD': (int, 'General', 1),

View file

@ -46,6 +46,7 @@ def start():
'https_cert': plexpy.CONFIG.HTTPS_CERT,
'https_cert_chain': plexpy.CONFIG.HTTPS_CERT_CHAIN,
'https_key': plexpy.CONFIG.HTTPS_KEY,
'https_min_tls_version': plexpy.CONFIG.HTTPS_MIN_TLS_VERSION,
'http_username': plexpy.CONFIG.HTTP_USERNAME,
'http_password': plexpy.CONFIG.HTTP_PASSWORD,
'http_basic_auth': plexpy.CONFIG.HTTP_BASIC_AUTH
@ -106,7 +107,11 @@ def initialize(options):
purpose=ssl.Purpose.CLIENT_AUTH,
cafile=https_cert_chain
)
context.minimum_version = ssl.TLSVersion.TLSv1_2
min_tls_version = options['https_min_tls_version'].replace('.', '_')
context.minimum_version = getattr(ssl.TLSVersion, min_tls_version, ssl.TLSVersion.TLSv1_2)
logger.debug("Tautulli WebStart :: Web server minimum TLS version set to %s.", context.minimum_version.name)
context.load_cert_chain(https_cert, https_key)
options_dict['server.ssl_context'] = context