add option to skip auth

This commit is contained in:
Nader Arbabian
2025-07-15 14:02:33 -07:00
parent ce52419023
commit 6b0f019cf7
2 changed files with 8 additions and 1 deletions
+7
View File
@@ -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
View File
@@ -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"