From 0c46f545105fe369c9d5cb6b6dfe6a59296e6b9b Mon Sep 17 00:00:00 2001 From: Alberto Sottile Date: Tue, 5 Feb 2019 16:28:48 +0100 Subject: [PATCH] startTLS: making TLS support (and dependencies) optional --- syncplay/client.py | 4 ---- syncplay/protocols.py | 2 +- syncplay/server.py | 4 +--- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/syncplay/client.py b/syncplay/client.py index e31e77c..7a2b64d 100755 --- a/syncplay/client.py +++ b/syncplay/client.py @@ -1,6 +1,5 @@ import ast -import certifi import collections import hashlib import os @@ -15,7 +14,6 @@ from functools import wraps from twisted.internet.endpoints import HostnameEndpoint, wrapClientTLS from twisted.internet.protocol import ClientFactory -from twisted.internet.ssl import Certificate, optionsForClientTLS from twisted.internet import reactor, task, defer, threads from twisted.application.internet import ClientService @@ -33,8 +31,6 @@ from syncplay.messages import getMissingStrings, getMessage from syncplay.protocols import SyncClientProtocol from syncplay.utils import isMacOS -os.environ['SSL_CERT_FILE'] = certifi.where() - class SyncClientFactory(ClientFactory): def __init__(self, client, retry=constants.RECONNECT_RETRIES): diff --git a/syncplay/protocols.py b/syncplay/protocols.py index a7f1a07..9545dce 100755 --- a/syncplay/protocols.py +++ b/syncplay/protocols.py @@ -81,7 +81,7 @@ class SyncClientProtocol(JSONCommandProtocol): self.sendTLS({"startTLS": "send"}) self._client.ui.showMessage("Attempting secure connection") else: - self._client.ui.showErrorMessage("This server does not support TLS") + self._client.ui.showErrorMessage("TLS is not supported") self.sendHello() def connectionLost(self, reason): diff --git a/syncplay/server.py b/syncplay/server.py index 4d62016..a76c0a5 100755 --- a/syncplay/server.py +++ b/syncplay/server.py @@ -5,7 +5,6 @@ import os import random import time from string import Template -from OpenSSL import crypto from twisted.enterprise import adbapi from twisted.internet import task, reactor, ssl @@ -14,7 +13,6 @@ from twisted.internet.protocol import Factory try: from OpenSSL import crypto from twisted.internet import ssl - from twisted.python.filepath import FilePath except: pass @@ -219,7 +217,7 @@ class SyncFactory(Factory): self.options = contextFactory except Exception as e: print(e) - print("Cannot import certificates. TLS support not enabled.") + print("TLS support is not enabled.") class StatsRecorder(object):