mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-20 13:15:14 +02:00
feat(mcp): node_console_exec — one-shot console session via the host's websocat
Replaces node_console (which handed a URL + ticket to the client for a bash websocat chain) with a tool that runs the whole session server-side: spawn `timeout N websocat -t --no-close <console-ws-url>`, feed the command lines through stdin (paced, CRLF), read stdout until the timeout kills websocat, return the collected output as plain text. - plain text replies: "output: ..." or bare error text — no JSON envelope, no status field (the server cannot judge command success) - raw output: UTF-8 decode with replacement only, no telnet/ANSI stripping; control keys are real characters (description teaches \u0003, no \x03 translation) - output funnel: grep=<python regex> filter; <=50 lines return as-is; beyond that a 10-line sample plus hints — regrep=true re-filters the node's cached capture (no re-run), full=true returns the last 400 lines / 64 KiB, and the full capture is written to the node's files (console-capture.txt) with a ticketed curl download URL - get_node_console_info_handler removed with its hashlib/TTL imports; the node-bound console ticket redemption path stays (comment updated, no current producer)
This commit is contained in:
9 files changed
+1083
-140
No files matched your search
@@ -191,10 +191,13 @@ async def get_current_active_user_from_websocket(
|
||||
try:
|
||||
if token.startswith(TICKET_PREFIX):
|
||||
# Node-bound access tickets ("gns3t_…"): short-lived credentials
|
||||
# for one node's console endpoints, minted by the node_console
|
||||
# MCP tool. redeem() confines them to the route matching their
|
||||
# binding, so they cannot authenticate the notification/wireshark
|
||||
# sockets that share this dependency.
|
||||
# for one node's console endpoints. No MCP tool currently mints
|
||||
# them (node_console_exec connects server-side with the session
|
||||
# JWT), but the redemption path is kept as the designated
|
||||
# mechanism for handing node console access to external clients.
|
||||
# redeem() confines them to the route matching their binding, so
|
||||
# they cannot authenticate the notification/wireshark sockets
|
||||
# that share this dependency.
|
||||
ticket = access_ticket_service.redeem(token, websocket.path_params)
|
||||
if ticket is None:
|
||||
raise HTTPException(
|
||||
|
||||
Reference in new issue
Block a user