add option to skip auth
This commit is contained in:
@@ -8,6 +8,7 @@ import logging
|
|||||||
from asyncio import sleep, gather, Semaphore
|
from asyncio import sleep, gather, Semaphore
|
||||||
from typing import Tuple, Awaitable, NoReturn, List, Union, Callable, Optional
|
from typing import Tuple, Awaitable, NoReturn, List, Union, Callable, Optional
|
||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
|
from distutils.util import strtobool
|
||||||
|
|
||||||
from anyio import open_file
|
from anyio import open_file
|
||||||
from aiohttp import web, ClientResponse, ClientSession, ClientConnectorError
|
from aiohttp import web, ClientResponse, ClientSession, ClientConnectorError
|
||||||
@@ -55,6 +56,9 @@ class Backend:
|
|||||||
reqnum = -1
|
reqnum = -1
|
||||||
msg_history = []
|
msg_history = []
|
||||||
sem: Semaphore = dataclasses.field(default_factory=Semaphore)
|
sem: Semaphore = dataclasses.field(default_factory=Semaphore)
|
||||||
|
unsecured: bool = dataclasses.field(
|
||||||
|
default_factory=lambda: bool(strtobool(os.environ.get("UNSECURED", "false"))),
|
||||||
|
)
|
||||||
|
|
||||||
def __post_init__(self):
|
def __post_init__(self):
|
||||||
self.metrics = Metrics()
|
self.metrics = Metrics()
|
||||||
@@ -217,6 +221,9 @@ class Backend:
|
|||||||
return await self.session.post(url=handler.endpoint, json=api_payload)
|
return await self.session.post(url=handler.endpoint, json=api_payload)
|
||||||
|
|
||||||
def __check_signature(self, auth_data: AuthData) -> bool:
|
def __check_signature(self, auth_data: AuthData) -> bool:
|
||||||
|
if self.unsecured is True:
|
||||||
|
return True
|
||||||
|
|
||||||
def verify_signature(message, signature):
|
def verify_signature(message, signature):
|
||||||
if self.pubkey is None:
|
if self.pubkey is None:
|
||||||
log.debug(f"No Public Key!")
|
log.debug(f"No Public Key!")
|
||||||
|
|||||||
+1
-1
@@ -103,7 +103,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
export REPORT_ADDR WORKER_PORT USE_SSL
|
export REPORT_ADDR WORKER_PORT USE_SSL UNSECURED
|
||||||
|
|
||||||
cd "$SERVER_DIR"
|
cd "$SERVER_DIR"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user