Bug 3114

Summary: Remote command execution although -N specified with ControlMaster=yes, ControlPersist=yes and non-existent ControlPath
Product: Portable OpenSSH Reporter: Mihai Moldovan <ionic>
Component: sshAssignee: Assigned to nobody <unassigned-bugs>
Status: NEW ---    
Severity: normal    
Priority: P5    
Version: 8.1p1   
Hardware: All   
OS: All   

Description Mihai Moldovan 2020-01-18 15:22:58 AEDT
When creating a persistent master-slave control connection in master mode and the control socket does not exist yet, the -N option for NOT running a command seems to have no effect:


% ssh ionic.de -o ControlMaster="yes" -o ControlPersist="yes" -o ControlPath="/home/ionic/.sshsock" -N "echo \"Don't execute me\""
Don't execute me

However, this does not seem to be true when the control socket already exists:

% ssh ionic.de -o ControlMaster="yes" -o ControlPersist="yes" -o ControlPath="/home/ionic/.sshsock" -N "echo \"Don't execute me\""
ControlSocket /home/ionic/.sshsock already exists, disabling multiplexing
[hangs, which is normal, since the connection is established and kept open]

This also seems to hold for a "fake" control socket:

% ssh -O "exit" ionic.de -o ControlPath=/home/ionic/.sshsock # Correctly nuke socket, if necessary.
% rm -f /home/ionic/.sshsock # Get rid of "fake" sockets like the one we're going to create.
% touch /home/ionic/.sshsock
% ssh ionic.de -o ControlMaster="yes" -o ControlPersist="yes" -o ControlPath="/home/ionic/.sshsock" -N "echo \"Don't execute me\""
ControlSocket /home/ionic/.sshsock already exists, disabling multiplexing
[hangs]

It also doesn't happen with ControlPersist=no, so it must be related to a persistent master-slave connection:

% ssh ionic.de -o ControlMaster="yes" -o ControlPersist="no" -o ControlPath="/home/ionic/.sshsock" -N "echo \"Don't execute me\""
[hangs]
Comment 1 Mihai Moldovan 2020-03-16 17:56:40 AEDT
Hardware and OS shouldn't make a difference.