tRemove TLS certificate references. - obelisk - Electrum server using libbitcoin as its backend
git clone https://git.parazyd.org/obelisk
Log
Files
Refs
README
LICENSE
---
commit eb3fc9397ef86ba53823c113e3a14401d4839903
parent 916b26cc4c74cd178a61e4e5d0c9ae020c948cfc
Author: parazyd 
Date:   Fri,  9 Apr 2021 12:12:53 +0200

Remove TLS certificate references.

This won't be used in future Electrum, and lntransport shall be used instead.

Diffstat:
  M electrumobelisk/protocol.py         |       6 ++----
  M obelisk.py                          |      25 +------------------------
  M res/obelisk.cfg                     |       4 ----

3 files changed, 3 insertions(+), 32 deletions(-)
---
diff --git a/electrumobelisk/protocol.py b/electrumobelisk/protocol.py
t@@ -604,10 +604,8 @@ class ElectrumProtocol(asyncio.Protocol):  # pylint: disable=R0904,R0902
                 "genesis_hash": self.genesis,
                 "hosts": {
                     cfg["server_hostname"]: {
-                        "tcp_port":
-                        None if cfg["using_tls"] else cfg["server_port"],
-                        "ssl_port":
-                        cfg["server_port"] if cfg["using_tls"] else None,
+                        "tcp_port": cfg["server_port"],
+                        "ssl_port": None,
                     },
                 },
                 "protocol_max": SERVER_PROTO_MAX,
diff --git a/obelisk.py b/obelisk.py
t@@ -19,11 +19,9 @@ import sys
 from argparse import ArgumentParser
 from configparser import RawConfigParser, NoSectionError
 from logging import getLogger, FileHandler, Formatter, StreamHandler, DEBUG
-from os.path import exists, join
+from os.path import join
 from tempfile import gettempdir
 
-from pkg_resources import resource_filename
-
 from electrumobelisk.protocol import ElectrumProtocol, VERSION
 
 # Used for destructor/cleanup
t@@ -58,31 +56,11 @@ def logger_config(log, config):
     return log, filename
 
 
-def get_certs(config):
-    """Get file paths to TLS cert and key"""
-    certfile = config.get("obelisk", "certfile", fallback=None)
-    keyfile = config.get("obelisk", "keyfile", fallback=None)
-    if (certfile and keyfile) and (exists(certfile) and exists(keyfile)):
-        return certfile, keyfile
-
-    certfile = resource_filename("electrumobelisk", "certs/cert.pem")
-    keyfile = resource_filename("electrumobelisk", "certs/cert.key")
-    if exists(certfile) and exists(keyfile):
-        return certfile, keyfile
-
-    raise ValueError(f"TLS keypair not found ({certfile}, {keyfile})")
-
-
 async def run_electrum_server(config, chain):
     """Server coroutine"""
     log = getLogger("obelisk")
     host = config.get("obelisk", "host")
     port = int(config.get("obelisk", "port"))
-    usetls = config.getboolean("obelisk", "usetls", fallback=False)
-
-    if usetls:
-        certfile, keyfile = get_certs(config)
-        log.debug("Using TLS with keypair: %s , %s", certfile, keyfile)
 
     broadcast_method = config.get("obelisk",
                                   "broadcast_method",
t@@ -101,7 +79,6 @@ async def run_electrum_server(config, chain):
     server_cfg["broadcast_method"] = broadcast_method
     server_cfg["server_hostname"] = "localhost"  # TODO: <- should be public?
     server_cfg["server_port"] = port
-    server_cfg["using_tls"] = usetls
 
     global PROTOCOL
     PROTOCOL = ElectrumProtocol(log, chain, endpoints, server_cfg)
diff --git a/res/obelisk.cfg b/res/obelisk.cfg
t@@ -21,7 +21,3 @@ trans = tcp://testnet2.libbitcoin.net:29094
 # Accepts CIDR notation, e.g. 192.168.0.0/16 or 2a01:4f8:1f1::/120
 # Wildcard (*) means all are accepted (Generally requires host to be 0.0.0.0)
 ip_whitelist = *
-
-# Path to TLS certificate and key. Use openssl or similar tools to generate
-certfile = certs/cert.pem
-keyfile  = certs/cert.key