kdouji89
kdouji89

Reputation: 19

Leverage OpenSSH ControlPersist via Python?

I'd like to use OpenSSH's ControlPersist feature in a python tool to run arbitrary commands on remote nodes.

Is there any way to use the ControlPath socket OpenSSH creates when opening a connection to a node outside of just calling ssh -oControlPath=/path/to/socket user@address <command> multiple times with something like Popen()?

Before it gets suggested, I cannot use Paramiko for the environment where this will run.

Upvotes: 1

Views: 352

Answers (1)

Kenster
Kenster

Reputation: 25448

The OpenSSH source code contains a file named "PROTOCOL.mux" which describes the protocol used by the control-master feature.

In theory, any software package could implement the protocol and use a control socket. In practice, I've never heard of any other software which did that. It's likely that the only software implementing the protocol is the OpenSSH ssh utility, so the only way to use the feature is by invoking the ssh program.

Upvotes: 1

Related Questions