View Single Post
  #1   (View Single Post)  
Old 17th September 2015
gso gso is offline
Port Guard
 
Join Date: Nov 2014
Posts: 35
Default ssh multiplexing issue

From the ssh man page:

Quote:
-O ctl_cmd

Control an active connection multiplexing master process ... ''stop''
(request the master to stop accepting further multiplexing
requests).
The following code configuring socks forwarding works as expected:

Code:
ssh -CN -f -o "ExitOnForwardFailure=yes" -o "ControlMaster=yes" -o "ControlPath=${control_path}/%r@%h:%p" "${sshsocks_user}@${sshsocks_server}"

ssh -O check -S "${control_path}/${sshsocks_user}@%h:%p" "$sshsocks_server"

ssh -O forward -D "${sshsocks_fwd_addr}:${sshsocks_fwd_port}" -S "${control_path}/${shsocks_user}@%h:%p" "$sshsocks_server"
However the problem being when asking the master connection to then not accept any further multiplexing requests:

Code:
ssh -O stop -S "${control_path}/${sshsocks_user}@%h:%p" "$sshsocks_server"
This works occasionally but mostly not for some odd reason.

However if a web page is loaded via the socks proxy and a browser in between establishing forwarding and attempting to stop any further multiplexing requests, then the 'stop' command always works without any problem.

Otherwise the ssh process mostly exits, which from what I can gather would be correct if there were no open connections remaining (assuming 'ControlPersist' is not set to 'yes'), but not if as in this case ssh is forwarding (i.e., an open connection still exists).

Has anyone any clues as to what is going on here?
Reply With Quote