From 7c8402ddb88df09cf1a33b3925c2996926fd0a23 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Fri, 26 Mar 2021 17:33:55 +0000 Subject: Suppress CryptographyDeprecationWarning (#9698) This warning is somewhat confusing to users, so let's suppress it --- synapse/app/_base.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'synapse/app/_base.py') diff --git a/synapse/app/_base.py b/synapse/app/_base.py index 43b1f1e94b..3912c8994c 100644 --- a/synapse/app/_base.py +++ b/synapse/app/_base.py @@ -21,8 +21,10 @@ import signal import socket import sys import traceback +import warnings from typing import Awaitable, Callable, Iterable +from cryptography.utils import CryptographyDeprecationWarning from typing_extensions import NoReturn from twisted.internet import defer, error, reactor @@ -195,6 +197,25 @@ def listen_metrics(bind_addresses, port): start_http_server(port, addr=host, registry=RegistryProxy) +def listen_manhole(bind_addresses: Iterable[str], port: int, manhole_globals: dict): + # twisted.conch.manhole 21.1.0 uses "int_from_bytes", which produces a confusing + # warning. It's fixed by https://github.com/twisted/twisted/pull/1522), so + # suppress the warning for now. + warnings.filterwarnings( + action="ignore", + category=CryptographyDeprecationWarning, + message="int_from_bytes is deprecated", + ) + + from synapse.util.manhole import manhole + + listen_tcp( + bind_addresses, + port, + manhole(username="matrix", password="rabbithole", globals=manhole_globals), + ) + + def listen_tcp(bind_addresses, port, factory, reactor=reactor, backlog=50): """ Create a TCP socket for a port and several addresses -- cgit 1.5.1