connect fix 4
This commit is contained in:
22
app/main.py
22
app/main.py
@ -21,10 +21,31 @@ from app.catalog.routes import router as catalog_router
|
||||
from app.db import close_db, init_db
|
||||
from app.rdp_proxy.ws_tunnel import router as rdp_ws_router
|
||||
from app.security import log_stream
|
||||
from app.ssh_proxy.proxy import bcrypt_kdf_available
|
||||
from app.ssh_proxy.sftp import router as sftp_router
|
||||
from app.ssh_proxy.terminal_ws import router as ssh_ws_router
|
||||
|
||||
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(name)s: %(message)s")
|
||||
logger = logging.getLogger("jumphost.main")
|
||||
|
||||
|
||||
def _check_optional_dependencies() -> None:
|
||||
"""Meldet fehlende, formal optionale Laufzeitabhaengigkeiten beim Start.
|
||||
|
||||
Bislang fiel das Fehlen von 'bcrypt' erst auf, wenn ein Benutzer eine
|
||||
SSH-Sitzung startete -- und dann als englische asyncssh-Meldung, die nach
|
||||
einem defekten Schluessel aussah. Die Warnung laeuft absichtlich NACH
|
||||
log_stream.install(), damit sie auch im Live-Verbindungslog des
|
||||
Adminbereichs sichtbar ist.
|
||||
"""
|
||||
if not bcrypt_kdf_available():
|
||||
logger.error(
|
||||
"Das Python-Modul 'bcrypt' fehlt im Virtualenv. Passphrasegeschuetzte "
|
||||
"SSH-Schluessel im OpenSSH-Format (ssh-keygen-Standard) koennen damit "
|
||||
"NICHT geladen werden. Behebung: pip install -r requirements.txt "
|
||||
"(bzw. Ansible-Rolle python_runtime erneut ausrollen) und Dienst "
|
||||
"neu starten."
|
||||
)
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
@ -33,6 +54,7 @@ async def lifespan(app: FastAPI):
|
||||
# app/security/log_stream.py) -- MUSS vor init_db() installiert werden,
|
||||
# damit auch fruehe Startmeldungen im Puffer landen.
|
||||
log_stream.install()
|
||||
_check_optional_dependencies()
|
||||
await init_db()
|
||||
yield
|
||||
await close_db()
|
||||
|
||||
Reference in New Issue
Block a user