Bug 3114 - Remote command execution although -N specified with ControlMaster=yes, ControlPersist=yes and non-existent ControlPath
Summary: Remote command execution although -N specified with ControlMaster=yes, Contro...
Status: NEW
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: 8.1p1
Hardware: All All
: P5 normal
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-18 15:22 AEDT by Mihai Moldovan
Modified: 2020-03-16 17:56 AEDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.