Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e89174ba36 | ||
|
|
acd3ed797e | ||
|
|
0bcf9ad3c1 | ||
|
|
f7636d2435 | ||
|
|
ce7bd89f9b | ||
|
|
cd5b818a00 | ||
|
|
4c7921607b | ||
|
|
d83219faa3 | ||
|
|
295aa9710b | ||
|
|
3f833268bb | ||
|
|
1722d988c3 | ||
|
|
3c63849ca3 | ||
|
|
19ce0ea395 | ||
|
|
f9f310be82 |
No files matched your search
@@ -615,7 +615,6 @@ jobs:
|
||||
needs:
|
||||
- build-compute-tags
|
||||
- build
|
||||
- ci-core-mark
|
||||
permissions:
|
||||
# Needed to upload container images to ghcr.io
|
||||
packages: write
|
||||
|
||||
@@ -18,7 +18,7 @@ The Python core and the web UI talk through a **generated OpenAPI client** — n
|
||||
|
||||
```
|
||||
authentik/ # Django core — the IdP itself (see "The authentik Django package" below)
|
||||
lifecycle/ # Boot/runtime: migrations, gunicorn config, the `ak` CLI, container + AWS entrypoints
|
||||
lifecycle/ # Boot/runtime: migrations, the prefork Python server, the `ak` CLI, container + AWS entrypoints
|
||||
cmd/ # Go entrypoints: ldap/ rac/ radius/ outposts
|
||||
internal/ # Shared Go: outpost implementations, config
|
||||
src/ # Rust server/worker (ak-axum based; gated behind cargo features)
|
||||
|
||||
Generated
+10
-10
@@ -3054,9 +3054,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pyo3"
|
||||
version = "0.29.0"
|
||||
version = "0.29.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cd274650b21d4bfc26a0a47587962c1edb425f69287324355cd040c3ea66071c"
|
||||
checksum = "fc153f5fd745cc038b5eed86622125969f8a39834a57bc96beaaf2512b1da729"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"once_cell",
|
||||
@@ -3068,18 +3068,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pyo3-build-config"
|
||||
version = "0.29.0"
|
||||
version = "0.29.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c5e2a7d2f0d013342f295c048ad19237add5154a55b1c5a254c0ec93d4109078"
|
||||
checksum = "bb77d9aa6d647507b55c69ee714d266d84c526c78ff0bc6dd8757f58591e64d1"
|
||||
dependencies = [
|
||||
"target-lexicon",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pyo3-ffi"
|
||||
version = "0.29.0"
|
||||
version = "0.29.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca85c467da1bbc8d866eea5deff9cf29ea5f7785054a17da36e65bda9c05845b"
|
||||
checksum = "3160087aa5733bce7d9a729f8c55f85a2a53b74742a09613178eeebff0722253"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"pyo3-build-config",
|
||||
@@ -3087,9 +3087,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pyo3-macros"
|
||||
version = "0.29.0"
|
||||
version = "0.29.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ac53762fd065daa3194dd09337a38bd793a188100fd1a9304c4ab312d901771"
|
||||
checksum = "91f9d455db760a9a0b0ddeaac25f1390b8a36ba73dfbda9f127cac6fc340d4d5"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"pyo3-macros-backend",
|
||||
@@ -3099,9 +3099,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pyo3-macros-backend"
|
||||
version = "0.29.0"
|
||||
version = "0.29.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ca3a1557399783172dc5bf39cfca835157732532cba56b71d2292161e53b362"
|
||||
checksum = "e343bcec300ff262f5806a33a4e51b6d097a8a46435f512fcb83e95592581625"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
|
||||
+3
-2
@@ -71,6 +71,7 @@ moka = { version = "= 0.12.16", default-features = false, features = [
|
||||
nix = { version = "= 0.31.3", features = [
|
||||
"fs",
|
||||
"hostname",
|
||||
"process",
|
||||
"signal",
|
||||
"user",
|
||||
] }
|
||||
@@ -78,8 +79,8 @@ notify = "= 8.2.0"
|
||||
pem = "= 4.0.0"
|
||||
percent-encoding = "= 2.3.2"
|
||||
pin-project-lite = "= 0.2.17"
|
||||
pyo3 = "= 0.29.0"
|
||||
pyo3-build-config = "= 0.29.0"
|
||||
pyo3 = "= 0.29.1"
|
||||
pyo3-build-config = "= 0.29.1"
|
||||
rand = "= 0.10.3"
|
||||
rcgen = { version = "= 0.14.10", default-features = false, features = [
|
||||
"aws_lc_rs",
|
||||
|
||||
@@ -13,7 +13,7 @@ class LocalAnonRateThrottle(AnonRateThrottle):
|
||||
protective layer amplifies DB load under flood.
|
||||
|
||||
Points the throttle's cache at the ``throttle`` LocMemCache alias instead.
|
||||
Counters are per-process (per gunicorn worker)
|
||||
Counters are per-process (per server worker)
|
||||
"""
|
||||
|
||||
cache = caches["throttle"]
|
||||
@@ -36,8 +36,8 @@ class AuthentikCoreConfig(ManagedAppConfig):
|
||||
def ready(self) -> None:
|
||||
if CONFIG.get_bool("error_reporting.enabled", False):
|
||||
setup_pre_fork()
|
||||
# Under gunicorn's preload_app, some backends must finish initializing after
|
||||
# the fork instead (see lifecycle/gunicorn.conf.py's post_fork hook)
|
||||
# The server preloads the app before forking, some backends must finish
|
||||
# initializing after the fork instead (see lifecycle/server.py's post_fork)
|
||||
if not os.environ.get(TRACER_DEFER_POSTFORK_ENV_VAR):
|
||||
setup_post_fork()
|
||||
return super().ready()
|
||||
|
||||
@@ -41,7 +41,7 @@ def setup_post_fork() -> None:
|
||||
|
||||
|
||||
def init() -> None:
|
||||
"""Full init for single-process entrypoints that never fork afterwards. Gunicorn's
|
||||
"""Full init for single-process entrypoints that never fork afterwards. The
|
||||
preloaded web server calls setup_pre_fork()/setup_post_fork() separately instead"""
|
||||
setup_pre_fork()
|
||||
setup_post_fork()
|
||||
|
||||
@@ -5,8 +5,8 @@ from contextlib import contextmanager
|
||||
from functools import wraps
|
||||
from typing import Any, Protocol
|
||||
|
||||
# Set by lifecycle/gunicorn.conf.py before the app is preloaded, to tell
|
||||
# AuthentikCoreConfig.ready() to defer setup_post_fork() to gunicorn's post_fork hook
|
||||
# Set by lifecycle/server.py before the app is preloaded, to tell
|
||||
# AuthentikCoreConfig.ready() to defer setup_post_fork() to its post_fork
|
||||
TRACER_DEFER_POSTFORK_ENV_VAR = "AUTHENTIK_TRACER_DEFER_POSTFORK"
|
||||
|
||||
|
||||
|
||||
@@ -88,8 +88,8 @@ class OpenTelemetryTracer(Tracer):
|
||||
"""Create and set the real OpenTelemetry TracerProvider and span exporter.
|
||||
|
||||
Must run after any fork: BatchSpanProcessor's background export thread doesn't
|
||||
survive fork() safely. Under gunicorn's preload_app, call this from a post_fork
|
||||
hook, after setup_pre_fork() has run pre-fork."""
|
||||
survive fork() safely. When the app is preloaded before forking, call this after the fork,
|
||||
after setup_pre_fork() has run pre-fork."""
|
||||
sample_rate = 1 if settings.DEBUG else float(CONFIG.get("error_reporting.sample_rate", 0.1))
|
||||
provider = TracerProvider(
|
||||
resource=Resource.create(
|
||||
|
||||
@@ -14,7 +14,7 @@ from sentry_sdk.integrations.asgi import SentryAsgiMiddleware
|
||||
|
||||
from authentik.root.setup import setup
|
||||
|
||||
# DJANGO_SETTINGS_MODULE is set in gunicorn.conf.py
|
||||
# DJANGO_SETTINGS_MODULE is set in lifecycle/server.py
|
||||
|
||||
setup()
|
||||
django.setup()
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import os
|
||||
import warnings
|
||||
from functools import update_wrapper
|
||||
from types import FunctionType
|
||||
|
||||
from cryptography.hazmat.backends.openssl.backend import backend
|
||||
from defusedxml import defuse_stdlib
|
||||
@@ -8,7 +10,50 @@ from xmlsec import base64_default_line_size
|
||||
from authentik.lib.config import CONFIG
|
||||
|
||||
|
||||
def _keep_field_classes_cacheable():
|
||||
"""Django's and DRF's `Field.__init__` count instances in a class attribute, so every field
|
||||
created modifies the `Field` class. CPython stops caching attribute lookups for a class that
|
||||
was modified more than 1000 times, and for all its subclasses: every model field, serializer
|
||||
and serializer field. Lookups on those then take a lock that is global to the interpreter,
|
||||
which is slow with the GIL and makes threads queue up without it.
|
||||
|
||||
Hand both `__init__`s a stand-in for `Field` that keeps the counters instead. This has to
|
||||
run before models and serializers are imported, as the class can't recover afterwards."""
|
||||
from django.db.models import fields as django_fields
|
||||
from rest_framework import fields as drf_fields
|
||||
|
||||
for module in (django_fields, drf_fields):
|
||||
cls = module.Field
|
||||
init = cls.__init__
|
||||
if getattr(init, "_keeps_class_cacheable", False):
|
||||
continue
|
||||
|
||||
class Counters:
|
||||
# DRF's `__init__` also compares `self.__class__ == Field`
|
||||
def __eq__(self, other, cls=cls):
|
||||
return other is cls or other is self
|
||||
|
||||
__hash__ = object.__hash__
|
||||
|
||||
counters = Counters()
|
||||
for name, value in vars(cls).items():
|
||||
if name.endswith("creation_counter"):
|
||||
setattr(counters, name, value)
|
||||
new_init = FunctionType(
|
||||
init.__code__,
|
||||
{**module.__dict__, "Field": counters},
|
||||
init.__name__,
|
||||
init.__defaults__,
|
||||
init.__closure__,
|
||||
)
|
||||
new_init.__kwdefaults__ = init.__kwdefaults__
|
||||
update_wrapper(new_init, init)
|
||||
new_init._keeps_class_cacheable = True
|
||||
cls.__init__ = new_init
|
||||
|
||||
|
||||
def setup():
|
||||
_keep_field_classes_cacheable()
|
||||
warnings.filterwarnings("ignore", "SelectableGroups dict interface")
|
||||
warnings.filterwarnings(
|
||||
"ignore",
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
"""WSGI config for authentik project.
|
||||
|
||||
Ordinary HTTP requests are served through this, on whichever thread the embedding
|
||||
Rust binary happens to run them on. Websockets still go through ``authentik.root.asgi``,
|
||||
since WSGI has no notion of them.
|
||||
"""
|
||||
|
||||
import django
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
from sentry_sdk.integrations.wsgi import SentryWsgiMiddleware
|
||||
|
||||
from authentik.root.setup import setup
|
||||
|
||||
# DJANGO_SETTINGS_MODULE is set in lifecycle/server.py
|
||||
|
||||
setup()
|
||||
django.setup()
|
||||
|
||||
application = SentryWsgiMiddleware(get_wsgi_application())
|
||||
@@ -1,186 +0,0 @@
|
||||
"""Gunicorn config"""
|
||||
|
||||
import os
|
||||
import platform
|
||||
import signal
|
||||
from hashlib import sha512
|
||||
from pathlib import Path
|
||||
from tempfile import gettempdir
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from prometheus_client import values
|
||||
from prometheus_client.values import MultiProcessValue
|
||||
|
||||
from authentik import authentik_full_version
|
||||
from authentik.lib.config import CONFIG
|
||||
from authentik.lib.debug import start_debug_server
|
||||
from authentik.lib.logging import get_logger_config
|
||||
from authentik.lib.tracing import TRACER_DEFER_POSTFORK_ENV_VAR
|
||||
from authentik.lib.utils.http import get_http_session
|
||||
from authentik.lib.utils.reflection import get_env
|
||||
from authentik.root.install_id import get_install_id_raw
|
||||
from authentik.root.setup import setup
|
||||
from lifecycle.worker import DjangoUvicornWorker
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from gunicorn.app.wsgiapp import WSGIApplication
|
||||
from gunicorn.arbiter import Arbiter
|
||||
|
||||
from authentik.root.asgi import AuthentikAsgi
|
||||
|
||||
# preload_app below means the app (and AuthentikCoreConfig.ready()) loads once in this
|
||||
# master process before workers are forked; tell it to defer each tracer's post-fork setup
|
||||
# to the post_fork hook below instead (see authentik.lib.tracing.setup_post_fork)
|
||||
os.environ[TRACER_DEFER_POSTFORK_ENV_VAR] = "true"
|
||||
|
||||
# Install this *before* preload_app loads Django below, so metrics that get constructed
|
||||
# pre-fork (e.g. django-prometheus's Counters) share
|
||||
# the same MultiProcessValue class as everything else instead of being permanently bound to
|
||||
# the master's PID.
|
||||
_worker_id: dict[str, int | None] = {"value": None}
|
||||
|
||||
|
||||
values.ValueClass = MultiProcessValue(
|
||||
lambda: _worker_id["value"] if _worker_id["value"] is not None else 0
|
||||
)
|
||||
|
||||
setup()
|
||||
|
||||
_tmp = Path(gettempdir())
|
||||
worker_class = "lifecycle.worker.DjangoUvicornWorker"
|
||||
worker_tmp_dir = str(_tmp.joinpath("authentik_gunicorn_tmp"))
|
||||
|
||||
os.makedirs(worker_tmp_dir, exist_ok=True)
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "authentik.root.settings")
|
||||
|
||||
preload_app = True
|
||||
|
||||
max_requests = CONFIG.get_int("web.max_requests", 1000)
|
||||
max_requests_jitter = CONFIG.get_int("web.max_requests_jitter", 50)
|
||||
|
||||
# Match the value in packages/ak-common/src/arbiter.rs for graceful shutdown
|
||||
timeout = 30
|
||||
graceful_timeout = 30
|
||||
dirty_graceful_timeout = 30
|
||||
|
||||
logconfig_dict = get_logger_config()
|
||||
|
||||
workers = CONFIG.get_int("web.workers", 2)
|
||||
threads = CONFIG.get_int("web.threads", 4)
|
||||
|
||||
control_socket_disable = True
|
||||
|
||||
|
||||
# libpq can try Kerberos/GSS on macOS, which is not fork-safe in our Gunicorn worker model.
|
||||
# Disable GSS negotiation for local/dev PostgreSQL connections on Darwin.
|
||||
if platform.system() == "Darwin":
|
||||
os.environ.setdefault("PGGSSENCMODE", "disable")
|
||||
# Avoid macOS SystemConfiguration proxy lookups (_scproxy) in forked workers.
|
||||
# urllib/requests may consult these APIs and can crash in child workers.
|
||||
os.environ.setdefault("NO_PROXY", "*")
|
||||
os.environ.setdefault("no_proxy", "*")
|
||||
|
||||
|
||||
def when_ready(server: "Arbiter"): # noqa: UP037
|
||||
# Notify rust process that we are ready
|
||||
os.kill(os.getppid(), signal.SIGUSR1)
|
||||
|
||||
|
||||
def post_fork(server: "Arbiter", worker: DjangoUvicornWorker): # noqa: UP037
|
||||
"""Tell prometheus to use worker number instead of process ID for multiprocess"""
|
||||
_worker_id["value"] = worker._worker_id
|
||||
|
||||
from authentik.lib.debug import start_pyroscope
|
||||
|
||||
start_pyroscope("server", worker_id=str(worker._worker_id))
|
||||
|
||||
# OTel's real TracerProvider is created here rather than before the fork above, since
|
||||
# BatchSpanProcessor's background export thread and locks do not survive fork() and
|
||||
# can deadlock a forked worker that inherits them (see OpenTelemetryTracer.setup_post_fork)
|
||||
if CONFIG.get_bool("error_reporting.enabled", False):
|
||||
from authentik.lib.tracing import setup_post_fork
|
||||
|
||||
setup_post_fork()
|
||||
|
||||
|
||||
def worker_exit(server: "Arbiter", worker: DjangoUvicornWorker): # noqa: UP037
|
||||
"""Remove pid dbs when worker is shutdown"""
|
||||
from prometheus_client import multiprocess
|
||||
|
||||
multiprocess.mark_process_dead(worker._worker_id)
|
||||
|
||||
|
||||
def on_starting(server: "Arbiter"): # noqa: UP037
|
||||
"""Attach a set of IDs that can be temporarily reused.
|
||||
Used on reloads when each worker exists twice."""
|
||||
server._worker_id_overload = set()
|
||||
|
||||
|
||||
def nworkers_changed(server: "Arbiter", new_value, old_value): # noqa: UP037
|
||||
"""Gets called on startup too.
|
||||
Set the current number of workers. Required if we raise the worker count
|
||||
temporarily using TTIN because server.cfg.workers won't be updated and if
|
||||
one of those workers dies, we wouldn't know the ids go that far."""
|
||||
server._worker_id_current_workers = new_value
|
||||
|
||||
|
||||
def _next_worker_id(server: "Arbiter"): # noqa: UP037
|
||||
"""If there are IDs open for reuse, take one. Else look for a free one."""
|
||||
if server._worker_id_overload:
|
||||
return server._worker_id_overload.pop()
|
||||
|
||||
in_use = set(w._worker_id for w in tuple(server.WORKERS.values()) if w.alive)
|
||||
free = set(range(1, server._worker_id_current_workers + 1)) - in_use
|
||||
|
||||
return free.pop()
|
||||
|
||||
|
||||
def on_reload(server: "Arbiter"): # noqa: UP037
|
||||
"""Add a full set of ids into overload so it can be reused once."""
|
||||
server._worker_id_overload = set(range(1, server.cfg.workers + 1))
|
||||
|
||||
|
||||
def pre_fork(server: "Arbiter", worker: DjangoUvicornWorker): # noqa: UP037
|
||||
"""Attach the next free worker_id before forking off."""
|
||||
worker._worker_id = _next_worker_id(server)
|
||||
|
||||
|
||||
def post_worker_init(worker: DjangoUvicornWorker):
|
||||
"""Notify ASGI app that its started up"""
|
||||
# Only trigger startup DB logic on first worker
|
||||
# Startup code that imports code or is otherwise needed in every worker
|
||||
# does not use this signal, so we can skip this safely
|
||||
if worker._worker_id != 1:
|
||||
return
|
||||
app: WSGIApplication = worker.app
|
||||
root_app: AuthentikAsgi = app.callable
|
||||
root_app.call_startup()
|
||||
|
||||
|
||||
if not CONFIG.get_bool("disable_startup_analytics", False):
|
||||
env = get_env()
|
||||
should_send = env not in ["dev", "ci"]
|
||||
if should_send:
|
||||
try:
|
||||
get_http_session().post(
|
||||
"https://goauthentik.io/api/event",
|
||||
json={
|
||||
"domain": "authentik",
|
||||
"name": "pageview",
|
||||
"referrer": authentik_full_version(),
|
||||
"url": (
|
||||
f"http://localhost/{env}?utm_source={authentik_full_version()}&utm_medium={env}"
|
||||
),
|
||||
},
|
||||
headers={
|
||||
"User-Agent": sha512(get_install_id_raw().encode("ascii")).hexdigest()[:16],
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
timeout=5,
|
||||
)
|
||||
|
||||
except Exception: # nosec # noqa
|
||||
pass
|
||||
|
||||
start_debug_server()
|
||||
@@ -194,6 +194,10 @@ def run_migrations():
|
||||
if not CONFIG.get_bool("debug"):
|
||||
check_args.append("--deploy")
|
||||
execute_from_command_line(check_args)
|
||||
# This runs inside the long-lived authentik process, don't hold on to connections
|
||||
from django.db import connections
|
||||
|
||||
connections.close_all()
|
||||
finally:
|
||||
release_lock(conn, curr)
|
||||
curr.close()
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
"""Runs authentik's applications in the processes the authentik binary forks for them, which
|
||||
hands them connections directly."""
|
||||
|
||||
import asyncio
|
||||
import os
|
||||
import platform
|
||||
import signal
|
||||
from collections.abc import Callable
|
||||
from hashlib import sha512
|
||||
from threading import Thread
|
||||
from typing import Any
|
||||
|
||||
from structlog.stdlib import get_logger
|
||||
|
||||
LOGGER = get_logger()
|
||||
|
||||
Message = dict[str, Any]
|
||||
|
||||
|
||||
def send_startup_analytics():
|
||||
from authentik import authentik_full_version
|
||||
from authentik.lib.config import CONFIG
|
||||
from authentik.lib.utils.http import get_http_session
|
||||
from authentik.lib.utils.reflection import get_env
|
||||
from authentik.root.install_id import get_install_id_raw
|
||||
|
||||
if CONFIG.get_bool("disable_startup_analytics", False):
|
||||
return
|
||||
env = get_env()
|
||||
if env in ["dev", "ci"]:
|
||||
return
|
||||
try:
|
||||
get_http_session().post(
|
||||
"https://goauthentik.io/api/event",
|
||||
json={
|
||||
"domain": "authentik",
|
||||
"name": "pageview",
|
||||
"referrer": authentik_full_version(),
|
||||
"url": (
|
||||
f"http://localhost/{env}?utm_source={authentik_full_version()}&utm_medium={env}"
|
||||
),
|
||||
},
|
||||
headers={
|
||||
"User-Agent": sha512(get_install_id_raw().encode("ascii")).hexdigest()[:16],
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
timeout=5,
|
||||
)
|
||||
except Exception: # nosec # noqa
|
||||
pass
|
||||
|
||||
|
||||
class Server:
|
||||
"""An ASGI application, running on an event loop in its own thread"""
|
||||
|
||||
def __init__(self, application, loop: asyncio.AbstractEventLoop):
|
||||
self.application = application
|
||||
self.loop = loop
|
||||
# Set by `post_fork()`, once `authentik.root.wsgi` is importable. Ordinary HTTP
|
||||
# requests are dispatched to this directly, from whichever thread the
|
||||
# embedding binary calls it on, instead of through the ASGI app above.
|
||||
self.wsgi_application = None
|
||||
Thread(target=self.loop.run_forever, name="asgi", daemon=True).start()
|
||||
|
||||
def is_alive(self) -> bool:
|
||||
return self.loop.is_running()
|
||||
|
||||
def handle(
|
||||
self, scope: Message, send: Callable[[Message | None], None]
|
||||
) -> Callable[[Message], None]:
|
||||
"""Start handling a connection.
|
||||
|
||||
`send` gets every message the application sends, and `None` once it is done.
|
||||
Returns the function to hand the application the messages it receives."""
|
||||
queue: asyncio.Queue[Message] = asyncio.Queue()
|
||||
|
||||
async def receive() -> Message:
|
||||
return await queue.get()
|
||||
|
||||
async def _send(message: Message):
|
||||
send(message)
|
||||
|
||||
async def run():
|
||||
try:
|
||||
await self.application(scope, receive, _send)
|
||||
except Exception as exc: # noqa: BLE001, the loop must survive a failing request
|
||||
LOGGER.warning("ASGI application failed", exc=exc, path=scope.get("path"))
|
||||
finally:
|
||||
send(None)
|
||||
|
||||
asyncio.run_coroutine_threadsafe(run(), self.loop)
|
||||
return lambda message: self.loop.call_soon_threadsafe(queue.put_nowait, message)
|
||||
|
||||
def shutdown(self):
|
||||
"""The loop keeps running, so that requests still in flight can finish"""
|
||||
from prometheus_client import multiprocess
|
||||
|
||||
multiprocess.mark_process_dead(os.getpid())
|
||||
|
||||
|
||||
def preload():
|
||||
"""Load authentik's applications once, before the server forks the processes that run them"""
|
||||
from authentik.lib.tracing.common import TRACER_DEFER_POSTFORK_ENV_VAR
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "authentik.root.settings")
|
||||
# Tracing backends start threads, which don't survive the fork, so they are set up in
|
||||
# `post_fork` instead
|
||||
os.environ[TRACER_DEFER_POSTFORK_ENV_VAR] = "true"
|
||||
# libpq can try Kerberos/GSS on macOS, and urllib can consult the system's proxy settings,
|
||||
# neither of which is fork-safe
|
||||
if platform.system() == "Darwin":
|
||||
os.environ.setdefault("PGGSSENCMODE", "disable")
|
||||
os.environ.setdefault("NO_PROXY", "*")
|
||||
os.environ.setdefault("no_proxy", "*")
|
||||
|
||||
# The server waits for its forked processes to exit with `sigwait`, which never sees SIGCHLD
|
||||
# on macOS while it is ignored, as it is by default
|
||||
signal.signal(signal.SIGCHLD, lambda *_: None)
|
||||
|
||||
from django.db import connections
|
||||
|
||||
import authentik.root.asgi # noqa: F401
|
||||
import authentik.root.wsgi # noqa: F401
|
||||
|
||||
send_startup_analytics()
|
||||
# Forked processes must open their own
|
||||
connections.close_all()
|
||||
|
||||
|
||||
def post_fork(worker_id: int) -> Server:
|
||||
"""Start serving in a process forked after `preload`"""
|
||||
import uvloop
|
||||
|
||||
from authentik.lib.config import CONFIG
|
||||
from authentik.lib.debug import start_debug_server, start_pyroscope
|
||||
from authentik.root.asgi import application
|
||||
from authentik.root.wsgi import application as wsgi_application
|
||||
|
||||
signal.signal(signal.SIGCHLD, signal.SIG_DFL)
|
||||
if CONFIG.get_bool("error_reporting.enabled", False):
|
||||
from authentik.lib.tracing import setup_post_fork
|
||||
|
||||
setup_post_fork()
|
||||
start_pyroscope("server", worker_id=str(worker_id))
|
||||
|
||||
server = Server(application, uvloop.new_event_loop())
|
||||
server.wsgi_application = wsgi_application
|
||||
# Only once, startup code needed in every process doesn't use this signal
|
||||
if worker_id == 1:
|
||||
start_debug_server()
|
||||
application.call_startup()
|
||||
LOGGER.info("Started server process", worker_id=worker_id)
|
||||
return server
|
||||
@@ -1,16 +0,0 @@
|
||||
"""Uvicorn worker"""
|
||||
|
||||
from uvicorn.workers import UvicornWorker
|
||||
|
||||
|
||||
class DjangoUvicornWorker(UvicornWorker):
|
||||
"""Custom configured Uvicorn Worker without lifespan"""
|
||||
|
||||
CONFIG_KWARGS = {
|
||||
"loop": "uvloop",
|
||||
"http": "httptools",
|
||||
"lifespan": "off",
|
||||
"ws": "wsproto",
|
||||
}
|
||||
|
||||
_worker_id: int
|
||||
@@ -255,7 +255,7 @@ impl Arbiter {
|
||||
/// Shutdown the application gracefully.
|
||||
pub async fn do_graceful_shutdown(&self) {
|
||||
info!("arbiter has been told to shutdown gracefully");
|
||||
// Match the value in lifecycle/gunicorn.conf.py for graceful shutdown
|
||||
// How long in-flight requests get to finish on graceful shutdown
|
||||
let timeout = Some(Duration::from_secs(30 + 5));
|
||||
self.unix_handles
|
||||
.lock()
|
||||
@@ -296,7 +296,7 @@ pub enum Event {
|
||||
/// The configuration has been reloaded from sources.
|
||||
ConfigChanged,
|
||||
#[cfg(feature = "core")]
|
||||
/// The Gunicorn server has been marked as ready.
|
||||
/// The Python application has loaded and is ready.
|
||||
GunicornIsReady,
|
||||
}
|
||||
|
||||
|
||||
@@ -251,6 +251,12 @@ pub struct WebConfig {
|
||||
pub timeout_http_read: String,
|
||||
pub timeout_http_write: String,
|
||||
pub timeout_http_idle: String,
|
||||
/// How many processes the server forks to run Python in.
|
||||
#[serde(deserialize_with = "deserialize_str_or_num")]
|
||||
pub workers: NonZeroUsize,
|
||||
/// How many threads each of those processes runs requests on.
|
||||
#[serde(deserialize_with = "deserialize_str_or_num")]
|
||||
pub threads: NonZeroUsize,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
|
||||
+2
-2
@@ -36,7 +36,6 @@ dependencies = [
|
||||
"geopy==2.5.0",
|
||||
"google-api-python-client==2.201.0",
|
||||
"gssapi==1.12.0",
|
||||
"gunicorn==26.2.0",
|
||||
"jsonpatch==1.35",
|
||||
"jwcrypto==1.6.1",
|
||||
"kubernetes==36.0.3",
|
||||
@@ -77,7 +76,8 @@ dependencies = [
|
||||
"ua-parser==1.0.2",
|
||||
"unidecode==1.4.0",
|
||||
"urllib3<3",
|
||||
"uvicorn[standard]==0.54.0",
|
||||
"uvloop==0.22.1",
|
||||
"websockets==17.1",
|
||||
"watchdog==6.0.0",
|
||||
"webauthn==3.0.1",
|
||||
"wsproto==1.3.2",
|
||||
|
||||
+57
-18
@@ -20,6 +20,7 @@ use nix::{
|
||||
fcntl::{AT_FDCWD, AtFlags},
|
||||
unistd::{Gid, Group, Uid, User, getuid, setgid, setuid},
|
||||
};
|
||||
use pyo3::{exceptions::PySystemExit, prelude::*, types::PyDict};
|
||||
use tracing::{info, warn};
|
||||
|
||||
/// The unprivileged user the server runs as.
|
||||
@@ -115,6 +116,51 @@ fn run(cmd: &mut Command) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Run `module` in this process, like `python -m module args...` would.
|
||||
///
|
||||
/// When Python raises `SystemExit`, the process exits with its code, as `python` would.
|
||||
fn run_module(module: &str, args: &[String]) -> Result<()> {
|
||||
crate::python::initialize()?;
|
||||
let prometheus_dir = prometheus_dir()?;
|
||||
Python::attach(|py| {
|
||||
let result = (|| -> PyResult<()> {
|
||||
let sys = py.import("sys")?;
|
||||
let sys_argv: Vec<&str> = std::iter::once(module)
|
||||
.chain(args.iter().map(String::as_str))
|
||||
.collect();
|
||||
sys.setattr("argv", sys_argv)?;
|
||||
// Changing our own environment from Rust needs unsafe code, Python does it for us
|
||||
py.import("os")?
|
||||
.getattr("environ")?
|
||||
.set_item(PROMETHEUS_MULTIPROC_DIR, prometheus_dir.as_os_str())?;
|
||||
let kwargs = PyDict::new(py);
|
||||
kwargs.set_item("run_name", "__main__")?;
|
||||
kwargs.set_item("alter_sys", true)?;
|
||||
py.import("runpy")?
|
||||
.call_method("run_module", (module,), Some(&kwargs))?;
|
||||
Ok(())
|
||||
})();
|
||||
// We keep running after this, so don't leave output behind in Python's buffers
|
||||
for stream in ["stdout", "stderr"] {
|
||||
if let Ok(stream) = py.import("sys").and_then(|sys| sys.getattr(stream)) {
|
||||
let _ = stream.call_method0("flush");
|
||||
}
|
||||
}
|
||||
result.map_err(|err| {
|
||||
// Exits for `SystemExit`, prints the traceback otherwise
|
||||
err.print(py);
|
||||
eyre!("python module {module} failed")
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/// Run `module` like [`run_module`], then exit like `python` would, running Python's exit handlers.
|
||||
fn exec_module(module: &str, args: &[String]) -> Result<()> {
|
||||
run_module(module, args)?;
|
||||
Python::attach(|py| PySystemExit::new_err(0_i32).print(py));
|
||||
Err(eyre!("python did not exit after {module}"))
|
||||
}
|
||||
|
||||
/// Install what `test-all` and `AUTHENTIK_DEBUGGER` need.
|
||||
fn prepare_debug() -> Result<()> {
|
||||
// Only in the container, a development checkout has all of it already
|
||||
@@ -242,13 +288,13 @@ fn become_authentik(prometheus_dir: &Path) -> Result<PathBuf> {
|
||||
}
|
||||
|
||||
fn wait_for_db() -> Result<()> {
|
||||
run(Command::new("python").args(["-m", "lifecycle.wait_for_db"]))?;
|
||||
run_module("lifecycle.wait_for_db", &[])?;
|
||||
info!("bootstrap completed");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn run_migrations() -> Result<()> {
|
||||
run(Command::new("python").args(["-m", "lifecycle.migrate"]))?;
|
||||
run_module("lifecycle.migrate", &[])?;
|
||||
info!("migrations completed");
|
||||
Ok(())
|
||||
}
|
||||
@@ -279,32 +325,25 @@ pub(crate) fn bootstrap() -> Result<()> {
|
||||
|
||||
pub(crate) fn manage(args: &Manage) -> Result<()> {
|
||||
// manage.py waits for the database itself
|
||||
let mut cmd = Command::new("python");
|
||||
cmd.args(["-m", "manage"])
|
||||
.args(&args.args)
|
||||
.env(PROMETHEUS_MULTIPROC_DIR, prometheus_dir()?);
|
||||
exec(cmd)
|
||||
exec_module("manage", &args.args)
|
||||
}
|
||||
|
||||
pub(crate) fn test_all() -> Result<()> {
|
||||
let prometheus_dir = prometheus_dir()?;
|
||||
// manage.py waits for the database itself
|
||||
let mut cmd = Command::new("python");
|
||||
cmd.args(["-m", "manage", "test", "authentik"])
|
||||
.env(PROMETHEUS_MULTIPROC_DIR, &prometheus_dir);
|
||||
if getuid().is_root() {
|
||||
prepare_debug()?;
|
||||
cmd.env("HOME", become_authentik(&prometheus_dir)?);
|
||||
let home = become_authentik(&prometheus_dir)?;
|
||||
// Changing our own environment needs unsafe code, so exec ourselves with the new one
|
||||
let mut cmd = Command::new(std::env::current_exe()?);
|
||||
cmd.args(std::env::args_os().skip(1)).env("HOME", home);
|
||||
return exec(cmd);
|
||||
}
|
||||
exec(cmd)
|
||||
// manage.py waits for the database itself
|
||||
exec_module("manage", &["test".to_owned(), "authentik".to_owned()])
|
||||
}
|
||||
|
||||
pub(crate) fn dump_config(args: &DumpConfig) -> Result<()> {
|
||||
let mut cmd = Command::new("python");
|
||||
cmd.args(["-m", "authentik.lib.config"])
|
||||
.args(&args.keys)
|
||||
.env(PROMETHEUS_MULTIPROC_DIR, prometheus_dir()?);
|
||||
exec(cmd)
|
||||
exec_module("authentik.lib.config", &args.keys)
|
||||
}
|
||||
|
||||
fn shell(program: &str, args: &[String]) -> Result<()> {
|
||||
|
||||
+8
-1
@@ -16,6 +16,8 @@ mod metrics;
|
||||
#[cfg(feature = "proxy")]
|
||||
pub(crate) mod outpost;
|
||||
#[cfg(feature = "core")]
|
||||
mod python;
|
||||
#[cfg(feature = "core")]
|
||||
mod server;
|
||||
#[cfg(feature = "core")]
|
||||
mod worker;
|
||||
@@ -35,6 +37,8 @@ enum Command {
|
||||
#[cfg(feature = "core")]
|
||||
Server(server::Cli),
|
||||
#[cfg(feature = "core")]
|
||||
ServerPrefork(server::prefork::Cli),
|
||||
#[cfg(feature = "core")]
|
||||
Worker(worker::Cli),
|
||||
#[cfg(feature = "proxy")]
|
||||
Proxy(outpost::proxy::Cli),
|
||||
@@ -79,6 +83,8 @@ fn main() -> Result<()> {
|
||||
Mode::set(Mode::Server)?;
|
||||
}
|
||||
#[cfg(feature = "core")]
|
||||
Command::ServerPrefork(args) => return server::prefork::run(args, tracing_crude),
|
||||
#[cfg(feature = "core")]
|
||||
Command::Worker(_) => {
|
||||
boot::bootstrap()?;
|
||||
Mode::set(Mode::Worker)?;
|
||||
@@ -109,7 +115,7 @@ fn main() -> Result<()> {
|
||||
#[cfg(feature = "core")]
|
||||
if Mode::is_core() {
|
||||
trace!("initializing Python");
|
||||
pyo3::Python::initialize();
|
||||
python::initialize()?;
|
||||
trace!("Python initialized");
|
||||
}
|
||||
|
||||
@@ -170,6 +176,7 @@ fn main() -> Result<()> {
|
||||
// We're checking for these before starting anything else
|
||||
#[cfg(feature = "core")]
|
||||
Command::Manage(_)
|
||||
| Command::ServerPrefork(_)
|
||||
| Command::TestAll(_)
|
||||
| Command::DumpConfig(_)
|
||||
| Command::Bash(_)
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
//! The Python interpreter embedded in this process.
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use eyre::Result;
|
||||
use pyo3::{prelude::*, types::PyDict};
|
||||
|
||||
/// Start the interpreter and make authentik and the packages of its virtualenv importable.
|
||||
///
|
||||
/// The interpreter is linked into this binary instead of being started from the virtualenv,
|
||||
/// so it doesn't find the virtualenv on its own.
|
||||
pub(crate) fn initialize() -> Result<()> {
|
||||
Python::initialize();
|
||||
let venv =
|
||||
std::env::var_os("VIRTUAL_ENV").map_or_else(|| PathBuf::from(".venv"), PathBuf::from);
|
||||
let venv = std::path::absolute(venv)?;
|
||||
let cwd = std::env::current_dir()?;
|
||||
Python::attach(|py| {
|
||||
let vars = PyDict::new(py);
|
||||
vars.set_item("base", venv.as_os_str())?;
|
||||
vars.set_item("platbase", venv.as_os_str())?;
|
||||
let sysconfig = py.import("sysconfig")?;
|
||||
let site = py.import("site")?;
|
||||
for name in ["purelib", "platlib"] {
|
||||
let kwargs = PyDict::new(py);
|
||||
kwargs.set_item("scheme", "venv")?;
|
||||
kwargs.set_item("vars", &vars)?;
|
||||
let path = sysconfig.call_method("get_path", (name,), Some(&kwargs))?;
|
||||
// Also handles the `.pth` files of editable installs
|
||||
site.call_method1("addsitedir", (path,))?;
|
||||
}
|
||||
let sys = py.import("sys")?;
|
||||
// For anything that starts Python itself, like multiprocessing
|
||||
sys.setattr("executable", venv.join("bin").join("python").as_os_str())?;
|
||||
// `python -m` puts the working directory first, so that `authentik` can be imported
|
||||
let path = sys.getattr("path")?;
|
||||
if !path.contains(cwd.as_os_str())? {
|
||||
path.call_method1("insert", (0_i32, cwd.as_os_str()))?;
|
||||
}
|
||||
Ok::<_, PyErr>(())
|
||||
})?;
|
||||
Ok(())
|
||||
}
|
||||
@@ -0,0 +1,508 @@
|
||||
//! Hands connections to the ASGI application running in the embedded Python interpreter.
|
||||
|
||||
use std::{net::IpAddr, sync::Arc};
|
||||
|
||||
use axum::{
|
||||
body::{Body, Bytes},
|
||||
extract::Request,
|
||||
http::{
|
||||
HeaderMap, HeaderName, HeaderValue, StatusCode, Version,
|
||||
header::{
|
||||
CONNECTION, SEC_WEBSOCKET_ACCEPT, SEC_WEBSOCKET_KEY, SEC_WEBSOCKET_PROTOCOL, UPGRADE,
|
||||
},
|
||||
},
|
||||
response::{IntoResponse as _, Response},
|
||||
};
|
||||
use eyre::{Result, eyre};
|
||||
use futures::{SinkExt as _, StreamExt as _};
|
||||
use hyper::upgrade::OnUpgrade;
|
||||
use hyper_util::rt::TokioIo;
|
||||
use pyo3::{
|
||||
prelude::*,
|
||||
pybacked::{PyBackedBytes, PyBackedStr},
|
||||
types::{PyBytes, PyCFunction, PyDict, PyTuple},
|
||||
};
|
||||
use tokio::{
|
||||
sync::mpsc::{UnboundedReceiver, UnboundedSender, unbounded_channel},
|
||||
task::spawn_blocking,
|
||||
};
|
||||
use tokio_tungstenite::{
|
||||
WebSocketStream,
|
||||
tungstenite::{
|
||||
Message,
|
||||
handshake::derive_accept_key,
|
||||
protocol::{CloseFrame, Role},
|
||||
},
|
||||
};
|
||||
use tracing::warn;
|
||||
|
||||
/// A message the application sent.
|
||||
#[derive(Debug)]
|
||||
enum Sent {
|
||||
WebsocketAccept {
|
||||
subprotocol: Option<String>,
|
||||
headers: HeaderMap,
|
||||
},
|
||||
WebsocketSend(Message),
|
||||
WebsocketClose(CloseFrame),
|
||||
/// The application returned.
|
||||
Done,
|
||||
}
|
||||
|
||||
/// A message for the application to receive.
|
||||
#[derive(Debug)]
|
||||
enum Received {
|
||||
Connect,
|
||||
Receive(Message),
|
||||
Disconnect(u16),
|
||||
}
|
||||
|
||||
fn extract_headers(message: &Bound<'_, PyDict>) -> PyResult<HeaderMap> {
|
||||
let mut headers = HeaderMap::new();
|
||||
let Some(items) = message.get_item("headers")? else {
|
||||
return Ok(headers);
|
||||
};
|
||||
for item in items.try_iter()? {
|
||||
let item = item?;
|
||||
let name: PyBackedBytes = item.get_item(0_i32)?.extract()?;
|
||||
let value: PyBackedBytes = item.get_item(1_i32)?.extract()?;
|
||||
if let (Ok(name), Ok(value)) = (
|
||||
HeaderName::from_bytes(&name),
|
||||
HeaderValue::from_bytes(&value),
|
||||
) {
|
||||
headers.append(name, value);
|
||||
} else {
|
||||
warn!("ignoring invalid header from the application");
|
||||
}
|
||||
}
|
||||
Ok(headers)
|
||||
}
|
||||
|
||||
/// The value at `key`, treating `None` like a missing key.
|
||||
fn get<'py>(message: &Bound<'py, PyDict>, key: &str) -> PyResult<Option<Bound<'py, PyAny>>> {
|
||||
Ok(message.get_item(key)?.filter(|value| !value.is_none()))
|
||||
}
|
||||
|
||||
fn extract_bytes(message: &Bound<'_, PyDict>, key: &str) -> PyResult<Option<Bytes>> {
|
||||
get(message, key)?
|
||||
.map(|value| Ok(Bytes::copy_from_slice(&value.extract::<PyBackedBytes>()?)))
|
||||
.transpose()
|
||||
}
|
||||
|
||||
impl Sent {
|
||||
fn extract(message: &Bound<'_, PyAny>) -> PyResult<Option<Self>> {
|
||||
if message.is_none() {
|
||||
return Ok(Some(Self::Done));
|
||||
}
|
||||
let message = message.cast::<PyDict>()?;
|
||||
let Some(kind) = message.get_item("type")? else {
|
||||
return Ok(None);
|
||||
};
|
||||
Ok(match &*kind.extract::<PyBackedStr>()? {
|
||||
"websocket.accept" => Some(Self::WebsocketAccept {
|
||||
subprotocol: get(message, "subprotocol")?
|
||||
.map(|v| v.extract())
|
||||
.transpose()?,
|
||||
headers: extract_headers(message)?,
|
||||
}),
|
||||
"websocket.send" => match extract_bytes(message, "bytes")? {
|
||||
Some(bytes) => Some(Self::WebsocketSend(Message::Binary(bytes))),
|
||||
None => get(message, "text")?
|
||||
.map(|v| v.extract::<String>())
|
||||
.transpose()?
|
||||
.map(|text| Self::WebsocketSend(Message::text(text))),
|
||||
},
|
||||
"websocket.close" => Some(Self::WebsocketClose(CloseFrame {
|
||||
code: get(message, "code")?
|
||||
.map_or(Ok(1000_u16), |v| v.extract())?
|
||||
.into(),
|
||||
reason: get(message, "reason")?
|
||||
.map_or(Ok(String::new()), |v| v.extract())?
|
||||
.into(),
|
||||
})),
|
||||
_ => None,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl Received {
|
||||
fn into_dict(self, py: Python<'_>) -> PyResult<Bound<'_, PyDict>> {
|
||||
let dict = PyDict::new(py);
|
||||
match self {
|
||||
Self::Connect => dict.set_item("type", "websocket.connect")?,
|
||||
Self::Receive(message) => {
|
||||
dict.set_item("type", "websocket.receive")?;
|
||||
match message {
|
||||
Message::Text(text) => dict.set_item("text", text.as_str())?,
|
||||
message => dict.set_item("bytes", PyBytes::new(py, &message.into_data()))?,
|
||||
}
|
||||
}
|
||||
Self::Disconnect(code) => {
|
||||
dict.set_item("type", "websocket.disconnect")?;
|
||||
dict.set_item("code", code)?;
|
||||
}
|
||||
}
|
||||
Ok(dict)
|
||||
}
|
||||
}
|
||||
|
||||
/// What the scope says about the connection, besides the request itself.
|
||||
#[derive(Debug, Clone)]
|
||||
pub(super) struct Peer {
|
||||
pub(super) client: IpAddr,
|
||||
/// `http` or `https`.
|
||||
pub(super) scheme: String,
|
||||
}
|
||||
|
||||
fn build_scope<'py>(py: Python<'py>, request: &Head, peer: &Peer) -> PyResult<Bound<'py, PyDict>> {
|
||||
let scope = PyDict::new(py);
|
||||
let asgi = PyDict::new(py);
|
||||
asgi.set_item("version", "3.0")?;
|
||||
asgi.set_item("spec_version", "2.3")?;
|
||||
scope.set_item("asgi", asgi)?;
|
||||
let http_version = match request.version() {
|
||||
Version::HTTP_10 => "1.0",
|
||||
Version::HTTP_2 => "2",
|
||||
_ => "1.1",
|
||||
};
|
||||
scope.set_item("http_version", http_version)?;
|
||||
let raw_path = request.uri().path();
|
||||
scope.set_item(
|
||||
"path",
|
||||
percent_encoding::percent_decode_str(raw_path).decode_utf8_lossy(),
|
||||
)?;
|
||||
scope.set_item("raw_path", PyBytes::new(py, raw_path.as_bytes()))?;
|
||||
scope.set_item(
|
||||
"query_string",
|
||||
PyBytes::new(py, request.uri().query().unwrap_or_default().as_bytes()),
|
||||
)?;
|
||||
scope.set_item("root_path", "")?;
|
||||
let headers = request
|
||||
.headers()
|
||||
.iter()
|
||||
.map(|(name, value)| {
|
||||
PyTuple::new(
|
||||
py,
|
||||
[
|
||||
PyBytes::new(py, name.as_str().as_bytes()),
|
||||
PyBytes::new(py, value.as_bytes()),
|
||||
],
|
||||
)
|
||||
})
|
||||
.collect::<PyResult<Vec<_>>>()?;
|
||||
scope.set_item("headers", headers)?;
|
||||
scope.set_item("client", (peer.client.to_string(), 0_u16))?;
|
||||
scope.set_item("type", "websocket")?;
|
||||
let scheme = if peer.scheme == "https" { "wss" } else { "ws" };
|
||||
scope.set_item("scheme", scheme)?;
|
||||
let subprotocols: Vec<&str> = request
|
||||
.headers()
|
||||
.get_all(SEC_WEBSOCKET_PROTOCOL)
|
||||
.iter()
|
||||
.filter_map(|value| value.to_str().ok())
|
||||
.flat_map(|value| value.split(','))
|
||||
.map(str::trim)
|
||||
.filter(|value| !value.is_empty())
|
||||
.collect();
|
||||
scope.set_item("subprotocols", subprotocols)?;
|
||||
Ok(scope)
|
||||
}
|
||||
|
||||
/// The parts of a request the scope is made of.
|
||||
type Head = axum::http::Request<()>;
|
||||
|
||||
fn head(request: &Request) -> Head {
|
||||
let mut head = Head::new(());
|
||||
*head.method_mut() = request.method().clone();
|
||||
*head.uri_mut() = request.uri().clone();
|
||||
*head.version_mut() = request.version();
|
||||
*head.headers_mut() = request.headers().clone();
|
||||
head
|
||||
}
|
||||
|
||||
/// Hands the application the messages it receives, for one connection.
|
||||
#[derive(Debug, Clone)]
|
||||
struct Receiver(Arc<Py<PyAny>>);
|
||||
|
||||
impl Receiver {
|
||||
async fn push(&self, message: Received) -> Result<()> {
|
||||
let receive = Arc::clone(&self.0);
|
||||
spawn_blocking(move || {
|
||||
Python::attach(|py| {
|
||||
receive.call1(py, (message.into_dict(py)?,))?;
|
||||
Ok::<_, PyErr>(())
|
||||
})
|
||||
})
|
||||
.await??;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// The ASGI application in `lifecycle/server.py`.
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct Asgi(Arc<Py<PyAny>>);
|
||||
|
||||
impl Asgi {
|
||||
/// Start authentik's application in a process forked after `lifecycle.server.preload`.
|
||||
///
|
||||
/// Returns the ASGI app, used for websockets, alongside the WSGI app, which handles
|
||||
/// ordinary HTTP requests (see `super::wsgi`).
|
||||
pub(super) fn start_worker(worker_id: usize) -> Result<(Self, Py<PyAny>)> {
|
||||
Python::attach(|py| {
|
||||
let server = py
|
||||
.import("lifecycle.server")?
|
||||
.call_method1("post_fork", (worker_id,))?;
|
||||
let wsgi_application = server.getattr("wsgi_application")?.unbind();
|
||||
Ok::<_, PyErr>((Self::new(server.unbind()), wsgi_application))
|
||||
})
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
fn new(server: Py<PyAny>) -> Self {
|
||||
Self(Arc::new(server))
|
||||
}
|
||||
|
||||
async fn call(&self, method: &'static str) -> Result<bool> {
|
||||
let server = Arc::clone(&self.0);
|
||||
Ok(spawn_blocking(move || {
|
||||
Python::attach(|py| server.call_method0(py, method)?.is_truthy(py))
|
||||
})
|
||||
.await??)
|
||||
}
|
||||
|
||||
pub(super) async fn is_alive(&self) -> bool {
|
||||
self.call("is_alive").await.unwrap_or_else(|err| {
|
||||
warn!(?err, "failed to check if the application is alive");
|
||||
false
|
||||
})
|
||||
}
|
||||
|
||||
pub(super) async fn shutdown(&self) -> Result<()> {
|
||||
self.call("shutdown").await.map(|_| ())
|
||||
}
|
||||
|
||||
/// Start the application on a connection.
|
||||
async fn start(&self, head: Head, peer: &Peer) -> Result<(Receiver, UnboundedReceiver<Sent>)> {
|
||||
let (tx, rx) = unbounded_channel::<Sent>();
|
||||
let server = Arc::clone(&self.0);
|
||||
let peer = peer.clone();
|
||||
let receive = spawn_blocking(move || {
|
||||
Python::attach(|py| {
|
||||
let scope = build_scope(py, &head, &peer)?;
|
||||
let send = send_function(py, tx)?;
|
||||
server.call_method1(py, "handle", (scope, send))
|
||||
})
|
||||
})
|
||||
.await??;
|
||||
Ok((Receiver(Arc::new(receive)), rx))
|
||||
}
|
||||
|
||||
pub(super) async fn websocket(&self, mut request: Request, peer: &Peer) -> Result<Response> {
|
||||
let Some(ws_accept) = request
|
||||
.headers()
|
||||
.get(SEC_WEBSOCKET_KEY)
|
||||
.map(|key| derive_accept_key(key.as_bytes()))
|
||||
else {
|
||||
return Ok(StatusCode::BAD_REQUEST.into_response());
|
||||
};
|
||||
let client_upgrade = hyper::upgrade::on(&mut request);
|
||||
|
||||
let (receiver, mut rx) = self.start(head(&request), peer).await?;
|
||||
receiver.push(Received::Connect).await?;
|
||||
|
||||
let (subprotocol, headers) = loop {
|
||||
match rx.recv().await {
|
||||
Some(Sent::WebsocketAccept {
|
||||
subprotocol,
|
||||
headers,
|
||||
}) => break (subprotocol, headers),
|
||||
Some(Sent::WebsocketClose(_) | Sent::Done) | None => {
|
||||
return Ok(StatusCode::FORBIDDEN.into_response());
|
||||
}
|
||||
Some(_) => {}
|
||||
}
|
||||
};
|
||||
|
||||
let mut response = Response::new(Body::empty());
|
||||
*response.status_mut() = StatusCode::SWITCHING_PROTOCOLS;
|
||||
*response.headers_mut() = headers;
|
||||
response
|
||||
.headers_mut()
|
||||
.insert(UPGRADE, HeaderValue::from_static("websocket"));
|
||||
response
|
||||
.headers_mut()
|
||||
.insert(CONNECTION, HeaderValue::from_static("upgrade"));
|
||||
response
|
||||
.headers_mut()
|
||||
.insert(SEC_WEBSOCKET_ACCEPT, HeaderValue::from_str(&ws_accept)?);
|
||||
if let Some(subprotocol) = subprotocol {
|
||||
response
|
||||
.headers_mut()
|
||||
.insert(SEC_WEBSOCKET_PROTOCOL, HeaderValue::from_str(&subprotocol)?);
|
||||
}
|
||||
|
||||
tokio::spawn(async move {
|
||||
if let Err(err) = relay_websocket(client_upgrade, receiver, rx).await {
|
||||
warn!(?err, "websocket connection error");
|
||||
}
|
||||
});
|
||||
|
||||
Ok(response)
|
||||
}
|
||||
}
|
||||
|
||||
/// The function the application calls to send a message.
|
||||
fn send_function(py: Python<'_>, tx: UnboundedSender<Sent>) -> PyResult<Bound<'_, PyCFunction>> {
|
||||
PyCFunction::new_closure(py, None, None, move |args, _kwargs| -> PyResult<()> {
|
||||
if let Some(message) = Sent::extract(&args.get_item(0)?)? {
|
||||
// The connection is already gone when nothing receives anymore
|
||||
let _ = tx.send(message);
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
async fn relay_websocket(
|
||||
client_upgrade: OnUpgrade,
|
||||
receiver: Receiver,
|
||||
mut rx: UnboundedReceiver<Sent>,
|
||||
) -> Result<()> {
|
||||
let client =
|
||||
WebSocketStream::from_raw_socket(TokioIo::new(client_upgrade.await?), Role::Server, None)
|
||||
.await;
|
||||
let (mut client_tx, mut client_rx) = client.split();
|
||||
|
||||
// 1006: closed without a close frame
|
||||
let mut code = 1006_u16;
|
||||
let result = loop {
|
||||
tokio::select! {
|
||||
message = client_rx.next() => match message {
|
||||
Some(Ok(Message::Close(frame))) => {
|
||||
code = frame.map_or(1005, |frame| frame.code.into());
|
||||
break Ok(());
|
||||
}
|
||||
Some(Ok(message @ (Message::Text(_) | Message::Binary(_)))) => {
|
||||
if let Err(err) = receiver.push(Received::Receive(message)).await {
|
||||
break Err(err);
|
||||
}
|
||||
}
|
||||
// tungstenite answers pings itself
|
||||
Some(Ok(Message::Ping(_) | Message::Pong(_) | Message::Frame(_))) => {}
|
||||
Some(Err(err)) => break Err(err.into()),
|
||||
None => break Ok(()),
|
||||
},
|
||||
sent = rx.recv() => match sent {
|
||||
Some(Sent::WebsocketSend(message)) => {
|
||||
if let Err(err) = client_tx.send(message).await {
|
||||
break Err(err.into());
|
||||
}
|
||||
}
|
||||
Some(Sent::WebsocketClose(frame)) => {
|
||||
code = frame.code.into();
|
||||
break client_tx.send(Message::Close(Some(frame))).await.map_err(Into::into);
|
||||
}
|
||||
Some(Sent::Done) | None => {
|
||||
break client_tx.send(Message::Close(None)).await.map_err(Into::into);
|
||||
}
|
||||
Some(_) => {}
|
||||
},
|
||||
}
|
||||
};
|
||||
receiver.push(Received::Disconnect(code)).await?;
|
||||
result.map_err(|err: eyre::Report| eyre!("websocket relay failed: {err}"))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::{ffi::CString, net::Ipv4Addr};
|
||||
|
||||
use axum::http::header::{HOST, SEC_WEBSOCKET_VERSION};
|
||||
|
||||
use super::*;
|
||||
|
||||
const APP: &str = r#"
|
||||
import asyncio
|
||||
from lifecycle.server import Server
|
||||
|
||||
async def app(scope, receive, send):
|
||||
if scope["type"] == "websocket":
|
||||
await receive()
|
||||
if scope["path"] == "/ws/deny/":
|
||||
await send({"type": "websocket.close"})
|
||||
return
|
||||
await send({"type": "websocket.accept", "subprotocol": (scope["subprotocols"] or [None])[0]})
|
||||
return
|
||||
|
||||
server = Server(app, asyncio.new_event_loop())
|
||||
"#;
|
||||
|
||||
fn asgi() -> Asgi {
|
||||
crate::python::initialize().expect("failed to initialize Python");
|
||||
Asgi::new(Python::attach(|py| {
|
||||
let code = CString::new(APP).expect("invalid code");
|
||||
PyModule::from_code(py, &code, c"test_app.py", c"test_app")
|
||||
.and_then(|module| module.getattr("server"))
|
||||
.expect("failed to load the test application")
|
||||
.unbind()
|
||||
}))
|
||||
}
|
||||
|
||||
fn peer() -> Peer {
|
||||
Peer {
|
||||
client: IpAddr::V4(Ipv4Addr::new(192, 0, 2, 1)),
|
||||
scheme: "https".to_owned(),
|
||||
}
|
||||
}
|
||||
|
||||
fn websocket_request(path: &str, subprotocol: Option<&str>) -> Request {
|
||||
let mut builder = Request::builder()
|
||||
.uri(path)
|
||||
.header(HOST, "authentik.company")
|
||||
.header(UPGRADE, "websocket")
|
||||
.header(CONNECTION, "upgrade")
|
||||
.header(SEC_WEBSOCKET_KEY, "dGhlIHNhbXBsZSBub25jZQ==")
|
||||
.header(SEC_WEBSOCKET_VERSION, "13");
|
||||
if let Some(subprotocol) = subprotocol {
|
||||
builder = builder.header(SEC_WEBSOCKET_PROTOCOL, subprotocol);
|
||||
}
|
||||
builder
|
||||
.body(Body::empty())
|
||||
.expect("failed to build request")
|
||||
}
|
||||
|
||||
/// RAC is the only consumer that negotiates a subprotocol, and browsers
|
||||
/// fail a connection when they offered one and the 101 names none.
|
||||
#[tokio::test]
|
||||
async fn websocket_upgrade_names_the_selected_subprotocol() {
|
||||
let response = asgi()
|
||||
.websocket(websocket_request("/ws/rac/", Some("guacamole")), &peer())
|
||||
.await
|
||||
.expect("upgrade failed");
|
||||
|
||||
assert_eq!(response.status(), StatusCode::SWITCHING_PROTOCOLS);
|
||||
assert_eq!(response.headers()[SEC_WEBSOCKET_PROTOCOL], "guacamole");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn websocket_upgrade_without_subprotocol_names_none() {
|
||||
let response = asgi()
|
||||
.websocket(websocket_request("/ws/client/", None), &peer())
|
||||
.await
|
||||
.expect("upgrade failed");
|
||||
|
||||
assert_eq!(response.status(), StatusCode::SWITCHING_PROTOCOLS);
|
||||
assert!(!response.headers().contains_key(SEC_WEBSOCKET_PROTOCOL));
|
||||
}
|
||||
|
||||
/// An application that denies the connection must not be preceded by a
|
||||
/// 101 the client would have to tear down immediately.
|
||||
#[tokio::test]
|
||||
async fn websocket_denial_is_forbidden() {
|
||||
let response = asgi()
|
||||
.websocket(websocket_request("/ws/deny/", None), &peer())
|
||||
.await
|
||||
.expect("upgrade failed");
|
||||
|
||||
assert_eq!(response.status(), StatusCode::FORBIDDEN);
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -287,7 +287,7 @@ pub(super) fn build_router(server: &Arc<Server>) -> eyre::Result<Router> {
|
||||
// Static files
|
||||
let static_router = wrap_router(super::r#static::build_router(), true);
|
||||
// Router for endpoints handled in Python
|
||||
let gunicorn_router = wrap_router(
|
||||
let python_router = wrap_router(
|
||||
Router::new()
|
||||
.fallback(forward_request)
|
||||
.with_state(Arc::clone(server)),
|
||||
@@ -298,7 +298,7 @@ pub(super) fn build_router(server: &Arc<Server>) -> eyre::Result<Router> {
|
||||
let router = Router::new()
|
||||
.nest("/-/", monitoring_router.clone())
|
||||
.merge(static_router)
|
||||
.merge(gunicorn_router);
|
||||
.merge(python_router);
|
||||
|
||||
let web_path = &config::get().web.path;
|
||||
let router = if web_path == "/" {
|
||||
@@ -350,7 +350,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
mod websockets {
|
||||
pub(super) mod websockets {
|
||||
use std::path::Path;
|
||||
|
||||
use ak_axum::error::{AppError, Result};
|
||||
@@ -378,7 +378,7 @@ mod websockets {
|
||||
};
|
||||
use tracing::{debug, trace, warn};
|
||||
|
||||
pub(super) fn is_websocket_upgrade(headers: &HeaderMap<HeaderValue>) -> bool {
|
||||
pub(in crate::server) fn is_websocket_upgrade(headers: &HeaderMap<HeaderValue>) -> bool {
|
||||
let has_upgrade = headers
|
||||
.get(UPGRADE)
|
||||
.and_then(|v| v.to_str().ok())
|
||||
|
||||
+16
-18
@@ -52,9 +52,12 @@ use crate::{
|
||||
worker::Workers,
|
||||
};
|
||||
|
||||
mod asgi;
|
||||
mod core;
|
||||
pub(crate) mod prefork;
|
||||
mod r#static;
|
||||
mod tls;
|
||||
mod wsgi;
|
||||
|
||||
#[derive(Debug, Default, FromArgs, PartialEq, Eq)]
|
||||
/// Run the authentik server.
|
||||
@@ -73,7 +76,7 @@ pub(crate) fn socket_path() -> PathBuf {
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct Server {
|
||||
gunicorn: Mutex<Child>,
|
||||
prefork: Mutex<Child>,
|
||||
socket_path: PathBuf,
|
||||
pub(crate) client: Client<UnixSocketConnector<PathBuf>, Body>,
|
||||
pub(crate) workers: ArcSwapOption<Workers>,
|
||||
@@ -86,14 +89,9 @@ impl Server {
|
||||
fn new(socket_path: PathBuf) -> Result<Self> {
|
||||
info!("starting server");
|
||||
|
||||
let gunicorn = Command::new("gunicorn")
|
||||
.args([
|
||||
"--bind",
|
||||
&format!("unix://{}", socket_path.display()),
|
||||
"-c",
|
||||
"./lifecycle/gunicorn.conf.py",
|
||||
"authentik.root.asgi:application",
|
||||
])
|
||||
let prefork = Command::new(std::env::current_exe()?)
|
||||
.arg("server-prefork")
|
||||
.arg(&socket_path)
|
||||
.kill_on_drop(true)
|
||||
.stdin(Stdio::null())
|
||||
.stdout(Stdio::inherit())
|
||||
@@ -106,7 +104,7 @@ impl Server {
|
||||
.build(UnixSocketConnector::new(socket_path.clone()));
|
||||
|
||||
Ok(Self {
|
||||
gunicorn: Mutex::new(gunicorn),
|
||||
prefork: Mutex::new(prefork),
|
||||
client,
|
||||
socket_path,
|
||||
workers: ArcSwapOption::empty(),
|
||||
@@ -121,12 +119,12 @@ impl Server {
|
||||
signal = signal.as_str(),
|
||||
"sending shutdown signal to server"
|
||||
);
|
||||
let mut gunicorn = self.gunicorn.lock().await;
|
||||
if let Some(id) = gunicorn.id() {
|
||||
let mut prefork = self.prefork.lock().await;
|
||||
if let Some(id) = prefork.id() {
|
||||
kill(Pid::from_raw(id.cast_signed()), signal)?;
|
||||
}
|
||||
gunicorn.wait().await?;
|
||||
drop(gunicorn);
|
||||
prefork.wait().await?;
|
||||
drop(prefork);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -141,7 +139,7 @@ impl Server {
|
||||
}
|
||||
|
||||
async fn is_alive(&self) -> bool {
|
||||
let try_wait = self.gunicorn.lock().await.try_wait();
|
||||
let try_wait = self.prefork.lock().await.try_wait();
|
||||
match try_wait {
|
||||
Ok(Some(code)) => {
|
||||
warn!(?code, "server has exited");
|
||||
@@ -268,7 +266,7 @@ async fn route_core_and_outpost(
|
||||
) -> Response {
|
||||
let start = Instant::now();
|
||||
|
||||
// The embedded outpost is only populated once gunicorn is ready, so this is
|
||||
// The embedded outpost is only populated once the server is ready, so this is
|
||||
// `None` during startup and every request naturally falls through to core.
|
||||
let app = proxy_outpost
|
||||
.load_full()
|
||||
@@ -318,7 +316,7 @@ pub(crate) async fn start(_cli: Cli, tasks: &mut Tasks) -> Result<Arc<Server>> {
|
||||
let arbiter = tasks.arbiter();
|
||||
let mut events_rx = arbiter.events_subscribe();
|
||||
|
||||
let server = Arc::new(Server::new(temp_dir().join("authentik-gunicorn.sock"))?);
|
||||
let server = Arc::new(Server::new(temp_dir().join("authentik-core.sock"))?);
|
||||
|
||||
tasks
|
||||
.build_task()
|
||||
@@ -352,7 +350,7 @@ pub(crate) async fn start(_cli: Cli, tasks: &mut Tasks) -> Result<Arc<Server>> {
|
||||
)?;
|
||||
|
||||
if !config::get().outposts.disable_embedded_outpost {
|
||||
info!("waiting for gunicorn to be ready before starting embedded outpost");
|
||||
info!("waiting for the server to be ready before starting embedded outpost");
|
||||
loop {
|
||||
tokio::select! {
|
||||
event = events_rx.recv() => {
|
||||
|
||||
@@ -0,0 +1,205 @@
|
||||
//! The processes that run authentik's Python applications for the server.
|
||||
//!
|
||||
//! The server starts this as a separate process, which loads the applications once and then
|
||||
//! forks the processes that run them, so that those share what was loaded. It stays
|
||||
//! single-threaded, as forking is only safe then. The forked processes all accept connections
|
||||
//! on the same socket, which the server forwards requests to.
|
||||
|
||||
use std::{
|
||||
collections::HashMap, net::Ipv6Addr, os::unix::net::UnixListener, path::PathBuf, sync::Arc,
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use ak_common::{config, tracing as ak_tracing};
|
||||
use argh::FromArgs;
|
||||
use axum::{
|
||||
Router,
|
||||
extract::{Request, State},
|
||||
http::{HeaderMap, StatusCode},
|
||||
response::{IntoResponse as _, Response},
|
||||
};
|
||||
use eyre::{Result, eyre};
|
||||
use nix::{
|
||||
sys::{
|
||||
signal::{SigSet, Signal, kill},
|
||||
wait::{WaitPidFlag, WaitStatus, waitpid},
|
||||
},
|
||||
unistd::{Pid, getppid},
|
||||
};
|
||||
use pyo3::prelude::*;
|
||||
use tokio::{
|
||||
signal::unix::{SignalKind, signal},
|
||||
time::interval,
|
||||
};
|
||||
use tracing::{error, info, warn};
|
||||
|
||||
use super::{
|
||||
asgi::{Asgi, Peer},
|
||||
core::websockets::is_websocket_upgrade,
|
||||
wsgi::Wsgi,
|
||||
};
|
||||
|
||||
#[derive(Debug, FromArgs, PartialEq)]
|
||||
/// Run the server's Python processes. The server starts this itself.
|
||||
#[argh(subcommand, name = "server-prefork")]
|
||||
pub(crate) struct Cli {
|
||||
/// the socket to accept connections on
|
||||
#[argh(positional)]
|
||||
socket_path: PathBuf,
|
||||
}
|
||||
|
||||
pub(crate) fn run(cli: &Cli, tracing_crude: tracing::dispatcher::DefaultGuard) -> Result<()> {
|
||||
config::init()?;
|
||||
drop(tracing_crude);
|
||||
// ponytail: `listen.debug_tokio` makes this start a thread, which the forked processes
|
||||
// don't get. Install it after forking if it needs to work here.
|
||||
ak_tracing::install()?;
|
||||
// Waited for below rather than handled, which would need a thread
|
||||
let mut signals = SigSet::empty();
|
||||
for signal in [Signal::SIGTERM, Signal::SIGINT, Signal::SIGCHLD] {
|
||||
signals.add(signal);
|
||||
}
|
||||
signals.thread_block()?;
|
||||
|
||||
crate::python::initialize()?;
|
||||
Python::attach(|py| {
|
||||
py.import("lifecycle.server")?
|
||||
.call_method0("preload")
|
||||
.map(drop)
|
||||
})?;
|
||||
|
||||
// Only bound now, as the server takes connections being accepted to mean we're ready
|
||||
let _ = std::fs::remove_file(&cli.socket_path);
|
||||
let listener = UnixListener::bind(&cli.socket_path)?;
|
||||
|
||||
let mut children = HashMap::new();
|
||||
for worker_id in 1..=config::get().web.workers.get() {
|
||||
children.insert(fork_worker(worker_id, &listener, signals)?, worker_id);
|
||||
}
|
||||
kill(getppid(), Signal::SIGUSR1)?;
|
||||
|
||||
loop {
|
||||
let signal = signals.wait()?;
|
||||
if signal != Signal::SIGCHLD {
|
||||
info!(signal = signal.as_str(), "stopping server processes");
|
||||
for pid in children.keys() {
|
||||
let _ = kill(*pid, signal);
|
||||
}
|
||||
while let Ok(status) = waitpid(None, None) {
|
||||
if let Some(pid) = status.pid() {
|
||||
children.remove(&pid);
|
||||
}
|
||||
if children.is_empty() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
while let Ok(status) = waitpid(None, Some(WaitPidFlag::WNOHANG)) {
|
||||
let Some(pid) = status.pid() else {
|
||||
break;
|
||||
};
|
||||
if !matches!(status, WaitStatus::Exited(..) | WaitStatus::Signaled(..)) {
|
||||
continue;
|
||||
}
|
||||
let Some(worker_id) = children.remove(&pid) else {
|
||||
continue;
|
||||
};
|
||||
warn!(worker_id, ?status, "server process exited, restarting it");
|
||||
// So that a process failing right away doesn't make us fork in a tight loop
|
||||
std::thread::sleep(Duration::from_secs(1));
|
||||
children.insert(fork_worker(worker_id, &listener, signals)?, worker_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn fork_worker(worker_id: usize, listener: &UnixListener, signals: SigSet) -> Result<Pid> {
|
||||
// Through Python, so that the interpreter is prepared for the fork
|
||||
let pid: i32 = Python::attach(|py| py.import("os")?.call_method0("fork")?.extract())?;
|
||||
if pid != 0_i32 {
|
||||
return Ok(Pid::from_raw(pid));
|
||||
}
|
||||
let result = signals
|
||||
.thread_unblock()
|
||||
.map_err(Into::into)
|
||||
.and_then(|()| worker(worker_id, listener));
|
||||
if let Err(err) = &result {
|
||||
error!(worker_id, ?err, "server process failed");
|
||||
}
|
||||
#[expect(
|
||||
clippy::exit,
|
||||
reason = "the forked process must not return to the loop forking it"
|
||||
)]
|
||||
std::process::exit(i32::from(result.is_err()));
|
||||
}
|
||||
|
||||
struct App {
|
||||
asgi: Asgi,
|
||||
wsgi: Wsgi,
|
||||
}
|
||||
|
||||
fn worker(worker_id: usize, listener: &UnixListener) -> Result<()> {
|
||||
// Don't outlive the process that forked us when it is killed
|
||||
#[cfg(target_os = "linux")]
|
||||
nix::sys::prctl::set_pdeathsig(Signal::SIGKILL)?;
|
||||
|
||||
let (asgi, wsgi) = Asgi::start_worker(worker_id)?;
|
||||
let app = Arc::new(App {
|
||||
asgi,
|
||||
wsgi: Wsgi::new(wsgi, config::get().web.threads)?,
|
||||
});
|
||||
listener.set_nonblocking(true)?;
|
||||
let listener = listener.try_clone()?;
|
||||
|
||||
tokio::runtime::Builder::new_current_thread()
|
||||
.enable_all()
|
||||
.build()?
|
||||
.block_on(async {
|
||||
let listener = tokio::net::UnixListener::from_std(listener)?;
|
||||
let mut terminate = signal(SignalKind::terminate())?;
|
||||
let mut interrupt = signal(SignalKind::interrupt())?;
|
||||
let router = Router::new().fallback(handle).with_state(Arc::clone(&app));
|
||||
let serve = axum::serve(listener, router).with_graceful_shutdown(async move {
|
||||
terminate.recv().await;
|
||||
});
|
||||
let watch = async {
|
||||
let mut check = interval(Duration::from_secs(5));
|
||||
loop {
|
||||
check.tick().await;
|
||||
if !app.asgi.is_alive().await {
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
tokio::select! {
|
||||
res = serve => res?,
|
||||
_ = interrupt.recv() => {},
|
||||
() = watch => return Err(eyre!("the application's event loop has stopped")),
|
||||
}
|
||||
app.asgi.shutdown().await
|
||||
})
|
||||
}
|
||||
|
||||
/// Only the server connects to us, which says who the request came from in these
|
||||
fn peer(headers: &HeaderMap) -> Peer {
|
||||
let header = |name| headers.get(name)?.to_str().ok();
|
||||
Peer {
|
||||
client: header("x-forwarded-for")
|
||||
.and_then(|value| value.parse().ok())
|
||||
.unwrap_or_else(|| Ipv6Addr::LOCALHOST.into()),
|
||||
scheme: header("x-forwarded-proto").unwrap_or("http").to_owned(),
|
||||
}
|
||||
}
|
||||
|
||||
async fn handle(State(app): State<Arc<App>>, request: Request) -> Response {
|
||||
let peer = peer(request.headers());
|
||||
let result = if is_websocket_upgrade(request.headers()) {
|
||||
app.asgi.websocket(request, &peer).await
|
||||
} else {
|
||||
app.wsgi.http(request, &peer).await
|
||||
};
|
||||
result.unwrap_or_else(|err| {
|
||||
warn!(?err, "failed to handle request");
|
||||
StatusCode::INTERNAL_SERVER_ERROR.into_response()
|
||||
})
|
||||
}
|
||||
+1
-1
@@ -80,7 +80,7 @@ pub(super) async fn watch_tls_config(
|
||||
) -> Result<()> {
|
||||
let mut events_rx = arbiter.events_subscribe();
|
||||
|
||||
info!("waiting for gunicorn to be ready before starting tls watcher");
|
||||
info!("waiting for the server to be ready before starting tls watcher");
|
||||
loop {
|
||||
tokio::select! {
|
||||
event = events_rx.recv() => {
|
||||
|
||||
@@ -0,0 +1,377 @@
|
||||
//! Hands ordinary HTTP requests to the Django WSGI application in the embedded interpreter.
|
||||
//!
|
||||
//! Unlike the ASGI bridge, this runs every request as a single blocking Python call on one of
|
||||
//! a fixed set of threads that stay attached to the interpreter, instead of funnelling them all
|
||||
//! through the one asyncio loop thread (and asgiref's single-worker thread-sensitive executor)
|
||||
//! that the ASGI path is stuck with for synchronous Django/DRF code. Requests overlap while
|
||||
//! they wait on I/O, the server forks processes to run them in parallel (see `super::prefork`).
|
||||
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
num::NonZeroUsize,
|
||||
sync::{Arc, Mutex, PoisonError, mpsc},
|
||||
thread,
|
||||
};
|
||||
|
||||
use axum::{
|
||||
body::{Body, Bytes},
|
||||
extract::Request,
|
||||
http::{
|
||||
HeaderMap, HeaderName, HeaderValue, StatusCode, Version,
|
||||
header::{CONTENT_LENGTH, CONTENT_TYPE, HOST},
|
||||
request::Parts,
|
||||
},
|
||||
response::Response,
|
||||
};
|
||||
use eyre::{Result, eyre};
|
||||
use http_body_util::BodyExt as _;
|
||||
use pyo3::{
|
||||
exceptions::PyRuntimeError,
|
||||
prelude::*,
|
||||
pybacked::{PyBackedBytes, PyBackedStr},
|
||||
sync::PyOnceLock,
|
||||
types::{PyBytes, PyCFunction, PyDict},
|
||||
};
|
||||
use tokio::sync::oneshot;
|
||||
|
||||
use super::asgi::Peer;
|
||||
|
||||
type Job = Box<dyn FnOnce(Python<'_>) + Send>;
|
||||
|
||||
/// Threads that stay attached to the interpreter between requests.
|
||||
///
|
||||
/// Attaching a thread that has no Python thread state creates one, and detaching deletes it
|
||||
/// again, along with everything in its `threading.local`s, like Django's per-thread state.
|
||||
/// Threads from tokio's blocking pool would do that on every request, these keep theirs.
|
||||
#[derive(Debug)]
|
||||
struct Threads(mpsc::Sender<Job>);
|
||||
|
||||
impl Threads {
|
||||
fn new(count: NonZeroUsize) -> Result<Self> {
|
||||
let (tx, rx) = mpsc::channel::<Job>();
|
||||
let rx = Arc::new(Mutex::new(rx));
|
||||
for i in 0..count.get() {
|
||||
let rx = Arc::clone(&rx);
|
||||
thread::Builder::new()
|
||||
.name(format!("python-{i}"))
|
||||
.spawn(move || {
|
||||
Python::attach(|py| {
|
||||
// Only detached while waiting, so the thread state survives
|
||||
while let Ok(job) =
|
||||
py.detach(|| rx.lock().unwrap_or_else(PoisonError::into_inner).recv())
|
||||
{
|
||||
job(py);
|
||||
}
|
||||
});
|
||||
})?;
|
||||
}
|
||||
Ok(Self(tx))
|
||||
}
|
||||
|
||||
async fn run<T, F>(&self, f: F) -> Result<T>
|
||||
where
|
||||
T: Send + 'static,
|
||||
F: FnOnce(Python<'_>) -> T + Send + 'static,
|
||||
{
|
||||
let (tx, rx) = oneshot::channel();
|
||||
self.0
|
||||
.send(Box::new(move |py| {
|
||||
let _ = tx.send(f(py));
|
||||
}))
|
||||
.map_err(|_| eyre!("the Python threads are gone"))?;
|
||||
Ok(rx.await?)
|
||||
}
|
||||
}
|
||||
|
||||
/// The Django WSGI application in `authentik.root.wsgi`.
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct Wsgi {
|
||||
application: Arc<Py<PyAny>>,
|
||||
threads: Threads,
|
||||
}
|
||||
|
||||
static BYTES_IO: PyOnceLock<Py<PyAny>> = PyOnceLock::new();
|
||||
static STDERR: PyOnceLock<Py<PyAny>> = PyOnceLock::new();
|
||||
|
||||
/// What `start_response` was called with.
|
||||
type StartResponse = Arc<Mutex<Option<(u16, HeaderMap)>>>;
|
||||
|
||||
fn header_env_name(name: &HeaderName) -> String {
|
||||
let mut env = String::with_capacity(5 + name.as_str().len());
|
||||
env.push_str("HTTP_");
|
||||
for ch in name.as_str().chars() {
|
||||
env.push(if ch == '-' {
|
||||
'_'
|
||||
} else {
|
||||
ch.to_ascii_uppercase()
|
||||
});
|
||||
}
|
||||
env
|
||||
}
|
||||
|
||||
/// Builds the WSGI `environ` dict for a request, with its body already buffered
|
||||
/// (WSGI's `wsgi.input` is a blocking file-like object, which doesn't fit this request
|
||||
/// being driven by an async runtime; the request body limit layer caps how big that buffer
|
||||
/// can get).
|
||||
fn build_environ<'py>(
|
||||
py: Python<'py>,
|
||||
parts: &Parts,
|
||||
body: &[u8],
|
||||
peer: &Peer,
|
||||
) -> PyResult<Bound<'py, PyDict>> {
|
||||
let environ = PyDict::new(py);
|
||||
environ.set_item("REQUEST_METHOD", parts.method.as_str())?;
|
||||
environ.set_item(
|
||||
"PATH_INFO",
|
||||
percent_encoding::percent_decode_str(parts.uri.path()).decode_utf8_lossy(),
|
||||
)?;
|
||||
environ.set_item("SCRIPT_NAME", "")?;
|
||||
environ.set_item("QUERY_STRING", parts.uri.query().unwrap_or_default())?;
|
||||
environ.set_item(
|
||||
"SERVER_PROTOCOL",
|
||||
match parts.version {
|
||||
Version::HTTP_10 => "HTTP/1.0",
|
||||
Version::HTTP_2 => "HTTP/2.0",
|
||||
_ => "HTTP/1.1",
|
||||
},
|
||||
)?;
|
||||
environ.set_item("CONTENT_LENGTH", body.len().to_string())?;
|
||||
|
||||
let host = parts
|
||||
.headers
|
||||
.get(HOST)
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.unwrap_or_default();
|
||||
let (server_name, server_port) = host
|
||||
.rsplit_once(':')
|
||||
.unwrap_or((host, if peer.scheme == "https" { "443" } else { "80" }));
|
||||
environ.set_item("SERVER_NAME", server_name)?;
|
||||
environ.set_item("SERVER_PORT", server_port)?;
|
||||
environ.set_item("REMOTE_ADDR", peer.client.to_string())?;
|
||||
|
||||
environ.set_item("wsgi.version", (1_i32, 0_i32))?;
|
||||
environ.set_item("wsgi.url_scheme", peer.scheme.as_str())?;
|
||||
environ.set_item(
|
||||
"wsgi.input",
|
||||
BYTES_IO
|
||||
.import(py, "io", "BytesIO")?
|
||||
.call1((PyBytes::new(py, body),))?,
|
||||
)?;
|
||||
environ.set_item("wsgi.errors", STDERR.import(py, "sys", "stderr")?)?;
|
||||
environ.set_item("wsgi.multithread", true)?;
|
||||
environ.set_item("wsgi.multiprocess", true)?;
|
||||
environ.set_item("wsgi.run_once", false)?;
|
||||
|
||||
// Headers repeated on the wire become one comma-joined HTTP_* value, per the WSGI spec.
|
||||
let mut grouped: HashMap<String, Vec<&str>> = HashMap::new();
|
||||
for (name, value) in &parts.headers {
|
||||
let Ok(value) = value.to_str() else {
|
||||
continue;
|
||||
};
|
||||
if name == CONTENT_TYPE {
|
||||
environ.set_item("CONTENT_TYPE", value)?;
|
||||
continue;
|
||||
}
|
||||
if name == CONTENT_LENGTH {
|
||||
// Already set from the buffered body above.
|
||||
continue;
|
||||
}
|
||||
grouped
|
||||
.entry(header_env_name(name))
|
||||
.or_default()
|
||||
.push(value);
|
||||
}
|
||||
for (name, values) in grouped {
|
||||
environ.set_item(name, values.join(", "))?;
|
||||
}
|
||||
|
||||
Ok(environ)
|
||||
}
|
||||
|
||||
/// The `start_response(status, headers)` callable the application calls before returning
|
||||
/// its body iterable.
|
||||
fn start_response_function(
|
||||
py: Python<'_>,
|
||||
captured: StartResponse,
|
||||
) -> PyResult<Bound<'_, PyCFunction>> {
|
||||
PyCFunction::new_closure(py, None, None, move |args, _kwargs| -> PyResult<()> {
|
||||
let status_line: PyBackedStr = args.get_item(0_usize)?.extract()?;
|
||||
let status = status_line
|
||||
.split_ascii_whitespace()
|
||||
.next()
|
||||
.and_then(|code| code.parse().ok())
|
||||
.unwrap_or(500_u16);
|
||||
|
||||
let mut headers = HeaderMap::new();
|
||||
for item in args.get_item(1_usize)?.try_iter()? {
|
||||
let item = item?;
|
||||
let name: PyBackedStr = item.get_item(0_i32)?.extract()?;
|
||||
let value: PyBackedStr = item.get_item(1_i32)?.extract()?;
|
||||
if let (Ok(name), Ok(value)) = (
|
||||
HeaderName::from_bytes(name.as_bytes()),
|
||||
HeaderValue::from_str(&value),
|
||||
) {
|
||||
headers.append(name, value);
|
||||
}
|
||||
}
|
||||
*captured.lock().unwrap_or_else(PoisonError::into_inner) = Some((status, headers));
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
/// Runs entirely in `PyResult`, so every conversion stays inside pyo3's own (`Send`-safe)
|
||||
/// error type; only the caller converts it to an `eyre::Report`.
|
||||
fn call(
|
||||
py: Python<'_>,
|
||||
application: &Py<PyAny>,
|
||||
parts: &Parts,
|
||||
body: &[u8],
|
||||
peer: &Peer,
|
||||
) -> PyResult<(u16, HeaderMap, Bytes)> {
|
||||
let environ = build_environ(py, parts, body, peer)?;
|
||||
let captured: StartResponse = Arc::new(Mutex::new(None));
|
||||
let start_response = start_response_function(py, Arc::clone(&captured))?;
|
||||
|
||||
let result = application.call1(py, (environ, start_response))?;
|
||||
let result = result.bind(py);
|
||||
|
||||
let mut collected = Vec::new();
|
||||
for chunk in result.try_iter()? {
|
||||
let chunk: PyBackedBytes = chunk?.extract()?;
|
||||
collected.extend_from_slice(&chunk);
|
||||
}
|
||||
if result.hasattr("close")? {
|
||||
result.call_method0("close")?;
|
||||
}
|
||||
|
||||
let (status, headers) = captured
|
||||
.lock()
|
||||
.unwrap_or_else(PoisonError::into_inner)
|
||||
.take()
|
||||
.ok_or_else(|| {
|
||||
PyRuntimeError::new_err("the application returned without calling start_response")
|
||||
})?;
|
||||
Ok((status, headers, Bytes::from(collected)))
|
||||
}
|
||||
|
||||
impl Wsgi {
|
||||
pub(super) fn new(application: Py<PyAny>, threads: NonZeroUsize) -> Result<Self> {
|
||||
Ok(Self {
|
||||
application: Arc::new(application),
|
||||
threads: Threads::new(threads)?,
|
||||
})
|
||||
}
|
||||
|
||||
pub(super) async fn http(&self, request: Request, peer: &Peer) -> Result<Response> {
|
||||
let (parts, body) = request.into_parts();
|
||||
// ponytail: buffers the request body, which the body limit layer caps. Stream it
|
||||
// through `wsgi.input` if large uploads become a problem.
|
||||
let body = body.collect().await?.to_bytes();
|
||||
let application = Arc::clone(&self.application);
|
||||
let peer = peer.clone();
|
||||
|
||||
let (status, headers, body) = self
|
||||
.threads
|
||||
.run(move |py| call(py, &application, &parts, &body, &peer))
|
||||
.await??;
|
||||
|
||||
let mut response = Response::new(Body::from(body));
|
||||
*response.status_mut() = StatusCode::from_u16(status)?;
|
||||
*response.headers_mut() = headers;
|
||||
Ok(response)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::{
|
||||
collections::HashSet,
|
||||
ffi::CString,
|
||||
net::{IpAddr, Ipv4Addr},
|
||||
};
|
||||
|
||||
use super::*;
|
||||
|
||||
const APP: &str = r#"
|
||||
import threading
|
||||
import time
|
||||
|
||||
def app(environ, start_response):
|
||||
# Long enough that concurrent requests overlap
|
||||
time.sleep(0.05)
|
||||
start_response("200 OK", [("X-Thread", str(threading.get_ident()))])
|
||||
return [environ["PATH_INFO"].encode()]
|
||||
"#;
|
||||
|
||||
fn wsgi() -> Wsgi {
|
||||
crate::python::initialize().expect("failed to initialize Python");
|
||||
let application = Python::attach(|py| {
|
||||
let code = CString::new(APP).expect("invalid code");
|
||||
PyModule::from_code(py, &code, c"test_wsgi_app.py", c"test_wsgi_app")
|
||||
.and_then(|module| module.getattr("app"))
|
||||
.expect("failed to load the test application")
|
||||
.unbind()
|
||||
});
|
||||
Wsgi::new(application, NonZeroUsize::new(4).expect("non-zero"))
|
||||
.expect("failed to start the Python threads")
|
||||
}
|
||||
|
||||
fn peer() -> Peer {
|
||||
Peer {
|
||||
client: IpAddr::V4(Ipv4Addr::new(192, 0, 2, 1)),
|
||||
scheme: "http".to_owned(),
|
||||
}
|
||||
}
|
||||
|
||||
fn request(path: &str) -> Request {
|
||||
Request::builder()
|
||||
.uri(path)
|
||||
.header(HOST, "authentik.company")
|
||||
.body(Body::empty())
|
||||
.expect("failed to build request")
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn http_request_round_trips() {
|
||||
let response = wsgi()
|
||||
.http(request("/api/v3/caf%C3%A9/"), &peer())
|
||||
.await
|
||||
.expect("request failed");
|
||||
|
||||
assert_eq!(response.status(), StatusCode::OK);
|
||||
let body = response
|
||||
.into_body()
|
||||
.collect()
|
||||
.await
|
||||
.expect("failed to read body")
|
||||
.to_bytes();
|
||||
assert_eq!(body, "/api/v3/café/");
|
||||
}
|
||||
|
||||
/// The whole point of moving HTTP off the single ASGI event-loop thread: requests must
|
||||
/// actually land on more than one OS thread.
|
||||
#[tokio::test]
|
||||
async fn concurrent_requests_run_on_distinct_threads() {
|
||||
let wsgi = wsgi();
|
||||
let peer = peer();
|
||||
let responses = futures::future::join_all(
|
||||
std::iter::repeat_with(|| wsgi.http(request("/"), &peer)).take(8),
|
||||
)
|
||||
.await;
|
||||
|
||||
let threads: HashSet<_> = responses
|
||||
.into_iter()
|
||||
.map(|response| {
|
||||
response.expect("request failed").headers()["x-thread"]
|
||||
.to_str()
|
||||
.expect("thread id header")
|
||||
.to_owned()
|
||||
})
|
||||
.collect();
|
||||
|
||||
assert!(
|
||||
threads.len() > 1,
|
||||
"all 8 concurrent requests ran on the same thread: {threads:?}"
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
version = 1
|
||||
revision = 3
|
||||
revision = 5
|
||||
requires-python = "==3.14.*"
|
||||
resolution-markers = [
|
||||
"platform_python_implementation == 'PyPy' and sys_platform == 'win32'",
|
||||
@@ -312,7 +312,6 @@ dependencies = [
|
||||
{ name = "geopy" },
|
||||
{ name = "google-api-python-client" },
|
||||
{ name = "gssapi" },
|
||||
{ name = "gunicorn" },
|
||||
{ name = "jsonpatch" },
|
||||
{ name = "jwcrypto" },
|
||||
{ name = "kubernetes" },
|
||||
@@ -353,9 +352,10 @@ dependencies = [
|
||||
{ name = "ua-parser" },
|
||||
{ name = "unidecode" },
|
||||
{ name = "urllib3" },
|
||||
{ name = "uvicorn", extra = ["standard"] },
|
||||
{ name = "uvloop" },
|
||||
{ name = "watchdog" },
|
||||
{ name = "webauthn" },
|
||||
{ name = "websockets" },
|
||||
{ name = "wsproto" },
|
||||
{ name = "xmlsec" },
|
||||
{ name = "zxcvbn" },
|
||||
@@ -432,7 +432,6 @@ requires-dist = [
|
||||
{ name = "geopy", specifier = "==2.5.0" },
|
||||
{ name = "google-api-python-client", specifier = "==2.201.0" },
|
||||
{ name = "gssapi", specifier = "==1.12.0" },
|
||||
{ name = "gunicorn", specifier = "==26.2.0" },
|
||||
{ name = "jsonpatch", specifier = "==1.35" },
|
||||
{ name = "jwcrypto", specifier = "==1.6.1" },
|
||||
{ name = "kubernetes", specifier = "==36.0.3" },
|
||||
@@ -473,9 +472,10 @@ requires-dist = [
|
||||
{ name = "ua-parser", specifier = "==1.0.2" },
|
||||
{ name = "unidecode", specifier = "==1.4.0" },
|
||||
{ name = "urllib3", specifier = "<3" },
|
||||
{ name = "uvicorn", extras = ["standard"], specifier = "==0.54.0" },
|
||||
{ name = "uvloop", specifier = "==0.22.1" },
|
||||
{ name = "watchdog", specifier = "==6.0.0" },
|
||||
{ name = "webauthn", specifier = "==3.0.1" },
|
||||
{ name = "websockets", specifier = "==17.1" },
|
||||
{ name = "wsproto", specifier = "==1.3.2" },
|
||||
{ name = "xmlsec", specifier = "==1.3.17" },
|
||||
{ name = "zxcvbn", specifier = "==4.5.0" },
|
||||
@@ -1803,15 +1803,6 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/f1/a9/5006c8dce263b01708d024c25680b0648b294d6e36f1d56c2d797b52c3cb/gssapi-1.12.0-cp314-cp314t-win_amd64.whl", hash = "sha256:59c601325789d9aa34f14117f534f224031de455174ac01b64b7bbbdff6d2bd0", size = 1978925, upload-time = "2026-08-26T03:00:34.623Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gunicorn"
|
||||
version = "26.2.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/d9/8a/e4ef6ee11701b6cd64702848415ffb69eeff85cb388a3c6c7fe86f22f3f8/gunicorn-26.2.0.tar.gz", hash = "sha256:62b864895d9ebff0b2f9867ba04fe811c93121596540830c9c916d0769668447", size = 787921, upload-time = "2026-08-24T15:05:59.3Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/fe/85/7522a52e5e2f42faf1a129113ab63e548c42e103e9af395b7bfe65e403e2/gunicorn-26.2.0-py3-none-any.whl", hash = "sha256:bd249d0b3f7972f7432f0a6b6ff3b3ee2d129f70cd1ff6c09a9dd9e29a2b88e3", size = 228389, upload-time = "2026-08-24T15:05:57.67Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "h11"
|
||||
version = "0.16.0"
|
||||
@@ -1868,28 +1859,6 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/33/a0/550eec327e5f5c7b732531c489f5307efec41f047b0d703bd4ca1e5ad2db/httplib2-0.32.0-py3-none-any.whl", hash = "sha256:dc6705cacdf3fb0a2aba7629fa33c90fd93e30035db0c157325826be177e4816", size = 93148, upload-time = "2026-06-26T10:13:54.985Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "httptools"
|
||||
version = "0.8.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/43/e5/d471fcb0e14523fe1c3f4ba58ca52480e7bd70ad7109a3846bc75892f7fb/httptools-0.8.0.tar.gz", hash = "sha256:6b2a32f18d97e16e90827d7a819ffa8dbd8cc245fc4e1fa9d1095b54ef4bd999", size = 271342, upload-time = "2026-05-25T22:17:48.841Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/1a/12/fa3fbf5f9517b273edea2dc982aa82a8c634091e67c590792b729017bc6f/httptools-0.8.0-cp314-cp314-macosx_10_13_universal2.whl", hash = "sha256:de242a49b5d18e0a8776e654e9f6bf6d89f3875a5c35b425a0e7ce940feb3fd6", size = 206183, upload-time = "2026-05-25T22:17:24.004Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/30/fc/5e7c4cb443370f2090a3aba0453a07384d29ff66b7435bb90e77e1037599/httptools-0.8.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:159e9ab5f701ccd42e555a12f1ad8ff69702910fc1c996cf2bb66e5fcb7a231b", size = 112079, upload-time = "2026-05-25T22:17:25.216Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ba/53/771bd891eb0f236f32145d6a1775777ec85745f3cc983a1f23d1a3b8ddfe/httptools-0.8.0-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:c4a9f1707e4823d54dfec6c33fa3697d302aed536ed352a7ebb5a061ddb869d0", size = 481596, upload-time = "2026-05-25T22:17:26.186Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/62/42/94e15bc68ce3d423243c45d7f1b0c7561f13844f97dc52ae23182fb65628/httptools-0.8.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d76ad7b951387e3632c8716a9bb03ac5b45c5f16119aa409db0459520887944e", size = 480865, upload-time = "2026-05-25T22:17:27.542Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/1c/7c/fe2980fc03723272e30f135b62360b075f513dfe7cc73aef36c7f04012bd/httptools-0.8.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:a3b7387147361c3fd47a0bde763c5c91b5b4cd4dc9989b8ece84ff436c99843b", size = 463189, upload-time = "2026-05-25T22:17:28.546Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/15/1b/47fc5fff68acd1bfa20b4734059c9a06cadb88119dcd5258b5b0d21d91c8/httptools-0.8.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:f256d6ce930c52ca1cb2a960b7da03548c454e7d28b06059ad41bfe789036ce0", size = 466610, upload-time = "2026-05-25T22:17:29.816Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/60/bd/07b13c93ffd9bec9546e0d43f8e19378dd696dbd278511406bc07371ef1f/httptools-0.8.0-cp314-cp314-win_amd64.whl", hash = "sha256:19d1ee275bb59ba2643ba9a3a1e51cc0c788caf2b8df506368e03f56fdd08527", size = 92705, upload-time = "2026-05-25T22:17:31.133Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fd/c4/121648f68ce066d7bd762d6b6d97e620847642d38d54f3d90ff11d947629/httptools-0.8.0-cp314-cp314t-macosx_10_13_universal2.whl", hash = "sha256:de1ed58a974e75d56560acc7e7fed01a454994429456f65209789992e41f2568", size = 215023, upload-time = "2026-05-25T22:17:32.401Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/b9/b0/312a062ae741ae3e8baa8c8bf20be81b2e67337b259ab4349bebc7b6142e/httptools-0.8.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:e93c227b595c6926c1acee96891dd9da4be338cfbe82e5cd3bb9d8dd7dc4ac0b", size = 117405, upload-time = "2026-05-25T22:17:33.742Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fc/37/fccd705f795386bb05bf413012fecff2a33e5aa8c2f069096de3e9fd8702/httptools-0.8.0-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:2a021c3a8e65cc125390d72f59b968afca3bdcaff25bd67965e0a055a14946ca", size = 558497, upload-time = "2026-05-25T22:17:34.732Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/bd/39/f172e8003576de35f5ba77ff417cf0e34429d35dc014deef15afa337a72c/httptools-0.8.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:48774d39cbb70e2b1f71f88852a3087ae1d3a1eb80482bb48c13067ab080c14f", size = 571585, upload-time = "2026-05-25T22:17:35.813Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3e/b9/f5564760af99f3dbbf3f9104dc00e5da27e96cf433c6bdcf77617f70bf3f/httptools-0.8.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:88eead8ec8680a9f146c655bc88445a325bd7921cfd8194c7337e9467282427d", size = 543297, upload-time = "2026-05-25T22:17:37.08Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/99/67/8d9f2c313618e161b82f3873188e7196126da1d6e29688df40eb3997c77a/httptools-0.8.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:2c032fa028f46871ec7e1fc59fc15e8023eab3e6bbe6ece786a1611719a5d081", size = 539535, upload-time = "2026-05-25T22:17:38.032Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/48/63/b906c01e53f50d432c0defe43ce52764a111dc1bdd028bafbeb54dcfd008/httptools-0.8.0-cp314-cp314t-win_amd64.whl", hash = "sha256:384c17174464c8e873398b7af24f0b1f44d992c820328413951a625323155d77", size = 108209, upload-time = "2026-05-25T22:17:39.473Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "httpx"
|
||||
version = "0.28.1"
|
||||
@@ -3437,15 +3406,6 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/ec/57/56b9bcc3c9c6a792fcbaf139543cee77261f3651ca9da0c93f5c1221264b/python_dateutil-2.9.0.post0-py2.py3-none-any.whl", hash = "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427", size = 229892, upload-time = "2024-03-01T18:36:18.57Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "python-dotenv"
|
||||
version = "1.2.3"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/6a/53/ed9d74092561d4b01a2ef1349d52cdbc135e526c245f366b089cfca6de49/python_dotenv-1.2.3.tar.gz", hash = "sha256:a20a594dabeaa385725aa239d5244871c143ecb356add8a20fcf23773a6c3a35", size = 58945, upload-time = "2026-08-16T16:54:54.067Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/0d/17/c5c6b53ddc18f297992099b3d9ec16c855c0ccc83263a21fe4d1c625ec6c/python_dotenv-1.2.3-py3-none-any.whl", hash = "sha256:904552145e8bfed22162c09dab1c2b9b54fefa7b23ba780f4f26ca0316b0f0d9", size = 22780, upload-time = "2026-08-16T16:54:52.473Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "python-kadmin-rs"
|
||||
version = "0.7.4"
|
||||
@@ -4170,29 +4130,6 @@ socks = [
|
||||
{ name = "pysocks" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "uvicorn"
|
||||
version = "0.54.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "click" },
|
||||
{ name = "h11" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/da/34/30e9280707135d2cfc589dfff3cb796bd07a3aeb1a3e415ba09dd89d7bb4/uvicorn-0.54.0.tar.gz", hash = "sha256:a2e33cbfaa0306f8e6b0c13e0cb89d7d7a2da3e62b90c66e18c33d9807b28620", size = 112283, upload-time = "2026-09-25T06:52:37.601Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/38/0c/b54a4fdd7f90a3af8b02ebc9ce6712c2c208b7926a2f7bad95c33ebbe943/uvicorn-0.54.0-py3-none-any.whl", hash = "sha256:505bdb0f318731d45f1f712071fc781a8981f6847a31c902c9f5e652d4f67faf", size = 87427, upload-time = "2026-09-25T06:52:35.829Z" },
|
||||
]
|
||||
|
||||
[package.optional-dependencies]
|
||||
standard = [
|
||||
{ name = "httptools" },
|
||||
{ name = "python-dotenv" },
|
||||
{ name = "pyyaml" },
|
||||
{ name = "uvloop", marker = "platform_python_implementation != 'PyPy' and sys_platform != 'cygwin' and sys_platform != 'win32'" },
|
||||
{ name = "watchfiles" },
|
||||
{ name = "websockets" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "uvloop"
|
||||
version = "0.22.1"
|
||||
@@ -4231,42 +4168,6 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/33/e8/e40370e6d74ddba47f002a32919d91310d6074130fe4e17dabcafc15cbf1/watchdog-6.0.0-py3-none-win_ia64.whl", hash = "sha256:a1914259fa9e1454315171103c6a30961236f508b9b623eae470268bbcc6a22f", size = 79067, upload-time = "2024-11-01T14:07:11.845Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "watchfiles"
|
||||
version = "1.2.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "anyio" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/cd/41/5e1a4bb12aac5f1493fa1bdc11154eca3b258ca4eba65d39c473fe19d8e9/watchfiles-1.2.0.tar.gz", hash = "sha256:c995fba777f1ea992f090f9236e9284cf7a5d1a0130dd5a3d82c598cacd76838", size = 108252, upload-time = "2026-05-18T04:32:04.251Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/e7/54/a9c7ea9a82a4ac65e7004c0a03920b5cdd2f9c3b678757d9cd425aa51d53/watchfiles-1.2.0-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:b8c8358484d5fa12ef34f05b7f4168eaf1932f408725ff6d023c33ec17bd79d4", size = 400205, upload-time = "2026-05-18T04:32:05.153Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/aa/5d/c9ab3534374a4a67450696905d6ef16a04405448b8dc52bd752ae50423d4/watchfiles-1.2.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:9f04b092229ad2c50126dd3c922c8822e51e605993764a33058d4a791ab42281", size = 392508, upload-time = "2026-05-18T04:30:54.849Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/26/ca/1ad30103535cf0cecd7b993e8d50edc5351b1820e38f2d22e3df58962feb/watchfiles-1.2.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7a7ce236284f002a156f70add88efe5c70879cccbb658be0822c54b1306fc09d", size = 452448, upload-time = "2026-05-18T04:30:53.727Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/37/a1/ceee2cdf2afbd715fa07758d39c9859513eae411b23196f7fd039e5feedd/watchfiles-1.2.0-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:b9909cc2b48468b575eefa944919e1fe8a36c5849d5c7c168f80a8c1db69398e", size = 459605, upload-time = "2026-05-18T04:30:23.312Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e8/f6/421e30fd1cb3907a84ed92ab3f1983e37ba2dca015e9a894a048418417a2/watchfiles-1.2.0-cp314-cp314-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0a37faaed405c67e28e6be45a1fa4f206ef5a2860f27c237db9fa30704c38242", size = 490757, upload-time = "2026-05-18T04:30:47.358Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/41/b0/55ed1b97ed08be7bba6f9a541cac15f2a858e1d74d2b07b6da70a82aab00/watchfiles-1.2.0-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9649193aa27bd9ff2e80ff29bfaa93085496c7a3a377592823cc58b77ee88add", size = 568672, upload-time = "2026-05-18T04:30:38.915Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d1/cf/d8ae8a80dd7bafab395ea7681c10237311bbf34d37704a8c744e7cf31fc7/watchfiles-1.2.0-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4e4ff8e37f99cf1da89e255e07c9c4b37c214038c4283707bdec308cb1b0ea1f", size = 464197, upload-time = "2026-05-18T04:30:09.914Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/7c/8a/3076c496ca8dafe0e8cd03fcebdfc47be4b1174b4e5b24ff6e396e6b3af2/watchfiles-1.2.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:054dc20fd2e3132b4c3883b4a00d72fd6e1f56fdaf89fccd12e8057d74cd74d7", size = 453181, upload-time = "2026-05-18T04:30:14.829Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e5/10/9745e17c98e7b8a86454df0a3c7b5686bd650383f1e9f26e4ebcbd6cc0c0/watchfiles-1.2.0-cp314-cp314-manylinux_2_31_riscv64.whl", hash = "sha256:e140ed30ebde76796b686e67c182cff10ea2fbab186fafd1560f74bb5a473a6e", size = 465109, upload-time = "2026-05-18T04:30:28.123Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/8f/95/8ef4a95481d3e0cb52d62a06fa6e972e81424be2d9698b91a2fecca9904c/watchfiles-1.2.0-cp314-cp314-musllinux_1_1_aarch64.whl", hash = "sha256:bb7e52ecf68ba46d22df23467b87cffeb2146908aa523ebfe803019618cfda06", size = 630653, upload-time = "2026-05-18T04:31:49.304Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fd/e4/3b3bf36b0f829b50c6ebcb8d031583863c59f923d6a6af3d485e470d0fac/watchfiles-1.2.0-cp314-cp314-musllinux_1_1_x86_64.whl", hash = "sha256:23282a321c8baf9b3a3c4afff673f9fe65eb7fdc2338d765ccad9d3d1916a5ba", size = 657838, upload-time = "2026-05-18T04:31:06.497Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/21/b1/6cbbb50c1f3002ab568777d44aa21206dfb8807a840990c4037523b51812/watchfiles-1.2.0-cp314-cp314-win32.whl", hash = "sha256:c0db965c5f79aa49fe672d297cf1febc5ad149b658594944f49a54a2b96270a7", size = 275108, upload-time = "2026-05-18T04:30:06.891Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/92/45/190ce6db8dcb4536682cf75d3889ff1a27182a58cb519d343cb6d9ea63d8/watchfiles-1.2.0-cp314-cp314-win_amd64.whl", hash = "sha256:71283b39fd17e5408eb123bd37aeecfd9d54c81fc184421943208aadb879d103", size = 288441, upload-time = "2026-05-18T04:32:12.901Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/74/0d/3eae1c2313ab08378431d907c3f8095ecca00f3eda33111cf4f0f2591799/watchfiles-1.2.0-cp314-cp314-win_arm64.whl", hash = "sha256:c5c19526f4e54a00f2666a6c0e9e40d582c09e865055ea7378bf0009aab857b3", size = 280684, upload-time = "2026-05-18T04:31:26.902Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/b1/75/fb64e6c25d6b5ca636d03df34ffb1c6e9873303e76d27967e045f8df088f/watchfiles-1.2.0-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:d73a585accffa5ae39c17264c36ec3166d2fad7000c780f5ef83b2722afb9dd2", size = 398857, upload-time = "2026-05-18T04:32:17.108Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/73/4e/9f7adf01754cbf81843722ccfec169d8f26c69778281a302855cecd2ee08/watchfiles-1.2.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:ae99b14c5f21e026e0e9d96f40e07d8570ebee6cafd9d8fc318354606daa7a28", size = 392413, upload-time = "2026-05-18T04:31:07.911Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/47/c8/bec626bcc2d69f44b9acb24ce7d60ed7b16b73628eea747fcbd169d8edda/watchfiles-1.2.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4429f3b105524a10b72c3a819b091c495d2811d419c1e1e8df773a5a5974f831", size = 452409, upload-time = "2026-05-18T04:31:20.142Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/00/b7/b6362068e81e7c556d155a34c35d40ac3ef42d747b06d7f6e5bf58e359c2/watchfiles-1.2.0-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:43d818978d06062d9b22c4fab2ebe44cf5213d42dc8e62bda8c2760cfa2eeb33", size = 458827, upload-time = "2026-05-18T04:32:06.219Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/67/f8/9a813fa42afb1e0b4625e75f0479826644d3ee8dc287e093799bc01f390c/watchfiles-1.2.0-cp314-cp314t-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b9f732dc58b2dbe69e464ccf8fff7a03b0dd0be439da4c0720d3558527d3d6b4", size = 490104, upload-time = "2026-05-18T04:31:56.034Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/2f/bf/27dfb6094ca4c9aad21298b5525b6c53cb36121ee454331d05161e58d130/watchfiles-1.2.0-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8f200104103feb097de4cab8fe4f5dd18a2026934c7dea98c55a2f5fd6d5a33b", size = 571360, upload-time = "2026-05-18T04:31:57.133Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fb/39/44a096d67270ea93df91d33877dbe91fbda3aa4f8ec2edf799d93eda8736/watchfiles-1.2.0-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:63ac26eefbf4af1741247d6fb68b11c49a25b2f7413fbd318a83a12aaa9cf666", size = 464644, upload-time = "2026-05-18T04:30:57.33Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/0e/80/c7472203bad6268e3ef1ad260739704847898938ad7ea8b63a5131f46b50/watchfiles-1.2.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0c4997d4e4a55f0d02b6cde327322daf3a0400e5df6c6b15948994bf72497925", size = 454771, upload-time = "2026-05-18T04:30:48.736Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/51/cf/3b10b268b4b7f0fc26e9debb5eef1998b515887840f444cd3ec80c688755/watchfiles-1.2.0-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:4c887eba18b7945ac73067a8b4a66f21cd46c2539b2bc68588f7be6c7eb6d26b", size = 463494, upload-time = "2026-05-18T04:31:33.826Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3d/3e/a4302545cd589262a0dc7d140e86f7688eba3f9c72776c27f7e23b8864c4/watchfiles-1.2.0-cp314-cp314t-musllinux_1_1_aarch64.whl", hash = "sha256:3416ff151bb6b5a8d8d11664974fbef4d9305b9b2957839ab5a270468fd8df30", size = 629383, upload-time = "2026-05-18T04:31:15.596Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/db/99/d5649df0a9a410d45b7c882304d0b790903ac9b6e8f2cfd12114e0c6b9f2/watchfiles-1.2.0-cp314-cp314t-musllinux_1_1_x86_64.whl", hash = "sha256:0e831a271c035d89789cffc386b6aa1375f39f1cd25eb7ca0997e4970d152fc5", size = 656093, upload-time = "2026-05-18T04:31:58.707Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wcwidth"
|
||||
version = "0.8.3"
|
||||
|
||||
Reference in new issue
Block a user