Skip to content

Commit

Permalink
#4353 prevent 'win_openssh.OpenSSHAgentConnection' from beind loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Sep 11, 2024
1 parent 5f5522d commit 9e98dbd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions xpra/net/ssh/paramiko_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
MSYS_DEFAULT_PATH = os.environ.get("XPRA_MSYS_DEFAULT_PATH", "/mingw64/bin/xpra")
CYGWIN_DEFAULT_PATH = os.environ.get("XPRA_CYGWIN_DEFAULT_PATH", "/cygdrive/c/Program Files/Xpra/Xpra_cmd.exe")
DEFAULT_WIN32_INSTALL_PATH = "C:\\Program Files\\Xpra"
WIN_OPENSSH_AGENT = envbool("XPRA_WIN_OPENSSH_AGENT", False)
WIN_OPENSSH_AGENT_MODULE = "win_openssh.OpenSSHAgentConnection"

PARAMIKO_SESSION_LOST = "No existing session"

Expand Down Expand Up @@ -942,6 +944,9 @@ def winpath(p) -> str:
agent_option = str((paramiko_config or {}).get("agent", SSH_AGENT)) or "no"
log(f"paramiko {agent_option=}")
if agent_option.lower() in TRUE_OPTIONS:
if not WIN_OPENSSH_AGENT and WIN_OPENSSH_AGENT_MODULE not in sys.modules:
log(f"preventing {WIN_OPENSSH_AGENT_MODULE!r} from loading")
sys.modules[WIN_OPENSSH_AGENT_MODULE] = None
log.info("paramiko SSH agent forwarding enabled")
from paramiko.agent import AgentRequestHandler
AgentRequestHandler(chan)
Expand Down

0 comments on commit 9e98dbd

Please sign in to comment.