From 25736f61b8ec305261453f574f26417c51b75b18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Mon, 28 Jun 2021 13:12:49 +0200 Subject: [PATCH] Removed requests "tests" and updated tunnel to use an authId --- server/src/uds/core/util/middleware/request.py | 4 ++-- tunnel-server/src/uds_tunnel/config.py | 2 ++ tunnel-server/src/uds_tunnel/proxy.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/server/src/uds/core/util/middleware/request.py b/server/src/uds/core/util/middleware/request.py index 16b1bbab0..767cf0494 100644 --- a/server/src/uds/core/util/middleware/request.py +++ b/server/src/uds/core/util/middleware/request.py @@ -139,10 +139,10 @@ class GlobalRequestMiddleware: ] ) ) - proxies = list(reversed(['172.27.0.8', '172.27.0.128', '172.27.0.1'])) + # proxies = list(reversed(['172.27.0.8', '172.27.0.128', '172.27.0.1'])) # proxies = list(reversed(['172.27.0.12', '172.27.0.1'])) # proxies = list(reversed(['172.27.0.12'])) - request.ip = '' + # request.ip = '' logger.debug('Detected proxies: %s', proxies) diff --git a/tunnel-server/src/uds_tunnel/config.py b/tunnel-server/src/uds_tunnel/config.py index d096a58d5..7a41b0068 100644 --- a/tunnel-server/src/uds_tunnel/config.py +++ b/tunnel-server/src/uds_tunnel/config.py @@ -58,6 +58,7 @@ class ConfigurationType(typing.NamedTuple): ssl_dhparam: str uds_server: str + uds_auth: str secret: str allow: typing.Set[str] @@ -104,6 +105,7 @@ def read() -> ConfigurationType: ssl_ciphers=uds.get('ssl_ciphers'), ssl_dhparam=uds.get('ssl_dhparam'), uds_server=uds_server, + uds_auth=uds.get('uds_auth', 'unauthorized'), secret=secret, allow=set(uds.get('allow', '127.0.0.1').split(',')), ) diff --git a/tunnel-server/src/uds_tunnel/proxy.py b/tunnel-server/src/uds_tunnel/proxy.py index 4b83e1ed4..ca274e5bd 100644 --- a/tunnel-server/src/uds_tunnel/proxy.py +++ b/tunnel-server/src/uds_tunnel/proxy.py @@ -55,7 +55,7 @@ class Proxy: @staticmethod def _getUdsUrl(cfg: config.ConfigurationType, ticket: bytes, msg: str) -> typing.MutableMapping[str, typing.Any]: try: - url = cfg.uds_server + '/' + ticket.decode() + '/' + msg + url = cfg.uds_server + '/' + ticket.decode() + '/' + msg + '/' + cfg.uds_auth r = requests.get(url, headers={'content-type': 'application/json'}) if not r.ok: raise Exception(r.content)