connect fix 4
This commit is contained in:
@ -24,9 +24,11 @@ from app.recordings.recorder import SessionRecorder
|
||||
from app.security import active_sessions
|
||||
from app.security.audit import write_audit_event
|
||||
from app.ssh_proxy.proxy import (
|
||||
SSH_SETUP_ERRORS,
|
||||
HostNotConfiguredError,
|
||||
PrivateKeyUnusableError,
|
||||
connect_to_host,
|
||||
describe_connection_error,
|
||||
load_host,
|
||||
)
|
||||
|
||||
@ -153,11 +155,18 @@ async def ssh_terminal(websocket: WebSocket, host_id: int):
|
||||
await websocket.send_json({"type": "error", "message": str(exc)})
|
||||
except Exception:
|
||||
logger.debug("Fehlermeldung konnte nicht mehr an Client gesendet werden", exc_info=True)
|
||||
except HostNotConfiguredError as exc:
|
||||
except SSH_SETUP_ERRORS as exc:
|
||||
# Alles, was den Sitzungsaufbau verhindert und der Benutzer selbst
|
||||
# einordnen kann: fehlender Benutzername/Schluessel, nicht gepinnter
|
||||
# oder abweichender Host-Key, unerreichbares Ziel. Bewusst mit
|
||||
# Klartextmeldung statt "interner Fehler" -- der Grund steht in der
|
||||
# Konfiguration, nicht im Code.
|
||||
logger.warning("SSH-Sitzung %s abgebrochen: %s", session_id, exc)
|
||||
end_reason = "error"
|
||||
try:
|
||||
await websocket.send_json({"type": "error", "message": str(exc)})
|
||||
await websocket.send_json(
|
||||
{"type": "error", "message": describe_connection_error(exc)}
|
||||
)
|
||||
except Exception:
|
||||
logger.debug("Fehlermeldung konnte nicht mehr an Client gesendet werden", exc_info=True)
|
||||
except asyncio.CancelledError:
|
||||
|
||||
Reference in New Issue
Block a user