feat(security): add scoped identities, TLS boundaries and OpenBao bootstrap

This commit is contained in:
2026-11-20 18:08:59 +03:00
parent 20afc2c790
commit 1dd020d060
149 changed files with 16519 additions and 68 deletions
+26
View File
@@ -0,0 +1,26 @@
"""Reload trust and the current client leaf for every network connection."""
import urllib3
from urllib3.connection import HTTPSConnection
from urllib3.connectionpool import HTTPSConnectionPool
from src import identity
class CurrentConnection(HTTPSConnection):
def connect(self):
self.ssl_context = identity.tls_context()
self.cert_reqs = "CERT_REQUIRED"
return super().connect()
class CurrentPool(HTTPSConnectionPool):
ConnectionCls = CurrentConnection
def pool(**kwargs):
manager = urllib3.PoolManager(**kwargs)
# Copy before changing: PoolManager otherwise shares the class mapping.
manager.pool_classes_by_scheme = dict(manager.pool_classes_by_scheme)
manager.pool_classes_by_scheme["https"] = CurrentPool
return manager