PROTOCOL.mux (7505ef3a411ed3f714d5c6bf3228f0d7cd83d97f) | PROTOCOL.mux (e146993e33182e13df79b5a957f2734f663fd836) |
---|---|
1This document describes the multiplexing protocol used by ssh(1)'s 2ControlMaster connection-sharing. 3 4Most messages from the client to the server contain a "request id" field. 5This field is returned in replies as "client request id" to facilitate 6matching of responses to requests. 7 81. Connection setup --- 59 unchanged lines hidden (view full) --- 68 uint32 session id 69 uint32 exit value 70 71The client should exit with this value to mimic the behaviour of a 72non-multiplexed ssh(1) connection. Two additional cases that the 73client must cope with are it receiving a signal itself and the 74server disconnecting without sending an exit message. 75 | 1This document describes the multiplexing protocol used by ssh(1)'s 2ControlMaster connection-sharing. 3 4Most messages from the client to the server contain a "request id" field. 5This field is returned in replies as "client request id" to facilitate 6matching of responses to requests. 7 81. Connection setup --- 59 unchanged lines hidden (view full) --- 68 uint32 session id 69 uint32 exit value 70 71The client should exit with this value to mimic the behaviour of a 72non-multiplexed ssh(1) connection. Two additional cases that the 73client must cope with are it receiving a signal itself and the 74server disconnecting without sending an exit message. 75 |
76A master may also send a MUX_S_TTY_ALLOC_FAIL before MUX_S_EXIT_MESSAGE 77if remote TTY allocation was unsuccessful. The client may use this to 78return its local tty to "cooked" mode. 79 80 uint32 MUX_S_TTY_ALLOC_FAIL 81 uint32 session id 82 |
|
763. Health checks 77 78The client may request a health check/PID report from a server: 79 80 uint32 MUX_C_ALIVE_CHECK 81 uint32 request id 82 83The server replies with: --- 60 unchanged lines hidden (view full) --- 144 string connect host 145 string connect port 146 147The client then sends its standard input and output file descriptors 148(in that order) using Unix domain socket control messages. 149 150The contents of "reserved" are currently ignored. 151 | 833. Health checks 84 85The client may request a health check/PID report from a server: 86 87 uint32 MUX_C_ALIVE_CHECK 88 uint32 request id 89 90The server replies with: --- 60 unchanged lines hidden (view full) --- 151 string connect host 152 string connect port 153 154The client then sends its standard input and output file descriptors 155(in that order) using Unix domain socket control messages. 156 157The contents of "reserved" are currently ignored. 158 |
152A server may reply with a MUX_S_SESSION_OPEED, a MUX_S_PERMISSION_DENIED | 159A server may reply with a MUX_S_SESSION_OPENED, a MUX_S_PERMISSION_DENIED |
153or a MUX_S_FAILURE. 154 | 160or a MUX_S_FAILURE. 161 |
1558. Status messages | 1628. Requesting shutdown of mux listener |
156 | 163 |
164A client may request the master to stop accepting new multiplexing requests 165and remove its listener socket. 166 167 uint32 MUX_C_STOP_LISTENING 168 uint32 request id 169 170A server may reply with a MUX_S_OK, a MUX_S_PERMISSION_DENIED or a 171MUX_S_FAILURE. 172 1739. Status messages 174 |
|
157The MUX_S_OK message is empty: 158 159 uint32 MUX_S_OK 160 uint32 client request id 161 162The MUX_S_PERMISSION_DENIED and MUX_S_FAILURE include a reason: 163 164 uint32 MUX_S_PERMISSION_DENIED 165 uint32 client request id 166 string reason 167 168 uint32 MUX_S_FAILURE 169 uint32 client request id 170 string reason 171 | 175The MUX_S_OK message is empty: 176 177 uint32 MUX_S_OK 178 uint32 client request id 179 180The MUX_S_PERMISSION_DENIED and MUX_S_FAILURE include a reason: 181 182 uint32 MUX_S_PERMISSION_DENIED 183 uint32 client request id 184 string reason 185 186 uint32 MUX_S_FAILURE 187 uint32 client request id 188 string reason 189 |
1729. Protocol numbers | 19010. Protocol numbers |
173 174#define MUX_MSG_HELLO 0x00000001 175#define MUX_C_NEW_SESSION 0x10000002 176#define MUX_C_ALIVE_CHECK 0x10000004 177#define MUX_C_TERMINATE 0x10000005 178#define MUX_C_OPEN_FWD 0x10000006 179#define MUX_C_CLOSE_FWD 0x10000007 180#define MUX_C_NEW_STDIO_FWD 0x10000008 | 191 192#define MUX_MSG_HELLO 0x00000001 193#define MUX_C_NEW_SESSION 0x10000002 194#define MUX_C_ALIVE_CHECK 0x10000004 195#define MUX_C_TERMINATE 0x10000005 196#define MUX_C_OPEN_FWD 0x10000006 197#define MUX_C_CLOSE_FWD 0x10000007 198#define MUX_C_NEW_STDIO_FWD 0x10000008 |
199#define MUX_C_STOP_LISTENING 0x10000009 |
|
181#define MUX_S_OK 0x80000001 182#define MUX_S_PERMISSION_DENIED 0x80000002 183#define MUX_S_FAILURE 0x80000003 184#define MUX_S_EXIT_MESSAGE 0x80000004 185#define MUX_S_ALIVE 0x80000005 186#define MUX_S_SESSION_OPENED 0x80000006 187#define MUX_S_REMOTE_PORT 0x80000007 | 200#define MUX_S_OK 0x80000001 201#define MUX_S_PERMISSION_DENIED 0x80000002 202#define MUX_S_FAILURE 0x80000003 203#define MUX_S_EXIT_MESSAGE 0x80000004 204#define MUX_S_ALIVE 0x80000005 205#define MUX_S_SESSION_OPENED 0x80000006 206#define MUX_S_REMOTE_PORT 0x80000007 |
207#define MUX_S_TTY_ALLOC_FAIL 0x80000008 |
|
188 189#define MUX_FWD_LOCAL 1 190#define MUX_FWD_REMOTE 2 191#define MUX_FWD_DYNAMIC 3 192 193XXX TODO 194XXX extended status (e.g. report open channels / forwards) | 208 209#define MUX_FWD_LOCAL 1 210#define MUX_FWD_REMOTE 2 211#define MUX_FWD_DYNAMIC 3 212 213XXX TODO 214XXX extended status (e.g. report open channels / forwards) |
195XXX graceful close (delete listening socket, but keep existing sessions active) | |
196XXX lock (maybe) 197XXX watch in/out traffic (pre/post crypto) 198XXX inject packet (what about replies) 199XXX server->client error/warning notifications | 215XXX lock (maybe) 216XXX watch in/out traffic (pre/post crypto) 217XXX inject packet (what about replies) 218XXX server->client error/warning notifications |
200XXX port0 rfwd (need custom response message) | |
201XXX send signals via mux 202 | 219XXX send signals via mux 220 |
203$OpenBSD: PROTOCOL.mux,v 1.4 2011/01/31 21:42:15 djm Exp $ | 221$OpenBSD: PROTOCOL.mux,v 1.7 2011/05/08 12:52:01 djm Exp $ |