xref: /dflybsd-src/crypto/openssh/PROTOCOL (revision ba1276acd1c8c22d225b1bcf370a14c878644f44)
118de8d7fSPeter AvalosThis documents OpenSSH's deviations and extensions to the published SSH
218de8d7fSPeter Avalosprotocol.
318de8d7fSPeter Avalos
418de8d7fSPeter AvalosNote that OpenSSH's sftp and sftp-server implement revision 3 of the SSH
518de8d7fSPeter Avalosfilexfer protocol described in:
618de8d7fSPeter Avalos
7ce74bacaSMatthew Dillonhttps://www.openssh.com/txt/draft-ietf-secsh-filexfer-02.txt
818de8d7fSPeter Avalos
9856ea928SPeter AvalosNewer versions of the draft will not be supported, though some features
10856ea928SPeter Avalosare individually implemented as extensions described below.
1118de8d7fSPeter Avalos
1218de8d7fSPeter AvalosThe protocol used by OpenSSH's ssh-agent is described in the file
1318de8d7fSPeter AvalosPROTOCOL.agent
1418de8d7fSPeter Avalos
159f304aafSPeter Avalos1. Transport protocol changes
169f304aafSPeter Avalos
179f304aafSPeter Avalos1.1. transport: Protocol 2 MAC algorithm "umac-64@openssh.com"
1818de8d7fSPeter Avalos
1918de8d7fSPeter AvalosThis is a new transport-layer MAC method using the UMAC algorithm
2018de8d7fSPeter Avalos(rfc4418). This method is identical to the "umac-64" method documented
2118de8d7fSPeter Avalosin:
2218de8d7fSPeter Avalos
23ce74bacaSMatthew Dillonhttps://www.openssh.com/txt/draft-miller-secsh-umac-01.txt
2418de8d7fSPeter Avalos
259f304aafSPeter Avalos1.2. transport: Protocol 2 compression algorithm "zlib@openssh.com"
2618de8d7fSPeter Avalos
2718de8d7fSPeter AvalosThis transport-layer compression method uses the zlib compression
2818de8d7fSPeter Avalosalgorithm (identical to the "zlib" method in rfc4253), but delays the
2918de8d7fSPeter Avalosstart of compression until after authentication has completed. This
3018de8d7fSPeter Avalosavoids exposing compression code to attacks from unauthenticated users.
3118de8d7fSPeter Avalos
3218de8d7fSPeter AvalosThe method is documented in:
3318de8d7fSPeter Avalos
34ce74bacaSMatthew Dillonhttps://www.openssh.com/txt/draft-miller-secsh-compression-delayed-00.txt
3518de8d7fSPeter Avalos
36ce74bacaSMatthew Dillon1.3. transport: New public key algorithms "ssh-rsa-cert-v01@openssh.com",
37ce74bacaSMatthew Dillon     "ssh-dsa-cert-v01@openssh.com",
389f304aafSPeter Avalos     "ecdsa-sha2-nistp256-cert-v01@openssh.com",
399f304aafSPeter Avalos     "ecdsa-sha2-nistp384-cert-v01@openssh.com" and
409f304aafSPeter Avalos     "ecdsa-sha2-nistp521-cert-v01@openssh.com"
41856ea928SPeter Avalos
429f304aafSPeter AvalosOpenSSH introduces new public key algorithms to support certificate
43e9778795SPeter Avalosauthentication for users and host keys. These methods are documented
44e9778795SPeter Avalosin the file PROTOCOL.certkeys
45856ea928SPeter Avalos
469f304aafSPeter Avalos1.4. transport: Elliptic Curve cryptography
479f304aafSPeter Avalos
489f304aafSPeter AvalosOpenSSH supports ECC key exchange and public key authentication as
499f304aafSPeter Avalosspecified in RFC5656. Only the ecdsa-sha2-nistp256, ecdsa-sha2-nistp384
509f304aafSPeter Avalosand ecdsa-sha2-nistp521 curves over GF(p) are supported. Elliptic
519f304aafSPeter Avaloscurve points encoded using point compression are NOT accepted or
529f304aafSPeter Avalosgenerated.
539f304aafSPeter Avalos
5436e94dc5SPeter Avalos1.5 transport: Protocol 2 Encrypt-then-MAC MAC algorithms
5536e94dc5SPeter Avalos
5636e94dc5SPeter AvalosOpenSSH supports MAC algorithms, whose names contain "-etm", that
5736e94dc5SPeter Avalosperform the calculations in a different order to that defined in RFC
5836e94dc5SPeter Avalos4253. These variants use the so-called "encrypt then MAC" ordering,
5936e94dc5SPeter Avaloscalculating the MAC over the packet ciphertext rather than the
6036e94dc5SPeter Avalosplaintext. This ordering closes a security flaw in the SSH transport
6136e94dc5SPeter Avalosprotocol, where decryption of unauthenticated ciphertext provided a
6236e94dc5SPeter Avalos"decryption oracle" that could, in conjunction with cipher flaws, reveal
6336e94dc5SPeter Avalossession plaintext.
6436e94dc5SPeter Avalos
6536e94dc5SPeter AvalosSpecifically, the "-etm" MAC algorithms modify the transport protocol
6636e94dc5SPeter Avalosto calculate the MAC over the packet ciphertext and to send the packet
6736e94dc5SPeter Avaloslength unencrypted. This is necessary for the transport to obtain the
6836e94dc5SPeter Avaloslength of the packet and location of the MAC tag so that it may be
6936e94dc5SPeter Avalosverified without decrypting unauthenticated data.
7036e94dc5SPeter Avalos
7136e94dc5SPeter AvalosAs such, the MAC covers:
7236e94dc5SPeter Avalos
7336e94dc5SPeter Avalos      mac = MAC(key, sequence_number || packet_length || encrypted_packet)
7436e94dc5SPeter Avalos
7536e94dc5SPeter Avaloswhere "packet_length" is encoded as a uint32 and "encrypted_packet"
7636e94dc5SPeter Avaloscontains:
7736e94dc5SPeter Avalos
7836e94dc5SPeter Avalos      byte      padding_length
7936e94dc5SPeter Avalos      byte[n1]  payload; n1 = packet_length - padding_length - 1
8036e94dc5SPeter Avalos      byte[n2]  random padding; n2 = padding_length
8136e94dc5SPeter Avalos
8236e94dc5SPeter Avalos1.6 transport: AES-GCM
8336e94dc5SPeter Avalos
8436e94dc5SPeter AvalosOpenSSH supports the AES-GCM algorithm as specified in RFC 5647.
8536e94dc5SPeter AvalosBecause of problems with the specification of the key exchange
8636e94dc5SPeter Avalosthe behaviour of OpenSSH differs from the RFC as follows:
8736e94dc5SPeter Avalos
8836e94dc5SPeter AvalosAES-GCM is only negotiated as the cipher algorithms
8936e94dc5SPeter Avalos"aes128-gcm@openssh.com" or "aes256-gcm@openssh.com" and never as
9036e94dc5SPeter Avalosan MAC algorithm. Additionally, if AES-GCM is selected as the cipher
9136e94dc5SPeter Avalosthe exchanged MAC algorithms are ignored and there doesn't have to be
9236e94dc5SPeter Avalosa matching MAC.
9336e94dc5SPeter Avalos
9436e94dc5SPeter Avalos1.7 transport: chacha20-poly1305@openssh.com authenticated encryption
9536e94dc5SPeter Avalos
9636e94dc5SPeter AvalosOpenSSH supports authenticated encryption using ChaCha20 and Poly1305
9736e94dc5SPeter Avalosas described in PROTOCOL.chacha20poly1305.
9836e94dc5SPeter Avalos
9936e94dc5SPeter Avalos1.8 transport: curve25519-sha256@libssh.org key exchange algorithm
10036e94dc5SPeter Avalos
10136e94dc5SPeter AvalosOpenSSH supports the use of ECDH in Curve25519 for key exchange as
10236e94dc5SPeter Avalosdescribed at:
10336e94dc5SPeter Avaloshttp://git.libssh.org/users/aris/libssh.git/plain/doc/curve25519-sha256@libssh.org.txt?h=curve25519
10436e94dc5SPeter Avalos
105ee116499SAntonio Huete JimenezThis is identical to curve25519-sha256 as later published in RFC8731.
106ee116499SAntonio Huete Jimenez
107*ba1276acSMatthew Dillon1.9 transport: ping facility
108*ba1276acSMatthew Dillon
109*ba1276acSMatthew DillonOpenSSH implements a transport level ping message SSH2_MSG_PING
110*ba1276acSMatthew Dillonand a corresponding SSH2_MSG_PONG reply.
111*ba1276acSMatthew Dillon
112*ba1276acSMatthew Dillon#define SSH2_MSG_PING	192
113*ba1276acSMatthew Dillon#define SSH2_MSG_PONG	193
114*ba1276acSMatthew Dillon
115*ba1276acSMatthew DillonThe ping message is simply:
116*ba1276acSMatthew Dillon
117*ba1276acSMatthew Dillon	byte		SSH_MSG_PING
118*ba1276acSMatthew Dillon	string		data
119*ba1276acSMatthew Dillon
120*ba1276acSMatthew DillonThe reply copies the data (which may be the empty string) from the
121*ba1276acSMatthew Dillonping:
122*ba1276acSMatthew Dillon
123*ba1276acSMatthew Dillon	byte		SSH_MSG_PONG
124*ba1276acSMatthew Dillon	string		data
125*ba1276acSMatthew Dillon
126*ba1276acSMatthew DillonReplies are sent in order. They are sent immediately except when rekeying
127*ba1276acSMatthew Dillonis in progress, in which case they are queued until rekeying completes.
128*ba1276acSMatthew Dillon
129*ba1276acSMatthew DillonThe server advertises support for these messages using the
130*ba1276acSMatthew DillonSSH2_MSG_EXT_INFO mechanism (RFC8308), with the following message:
131*ba1276acSMatthew Dillon
132*ba1276acSMatthew Dillon	string		"ping@openssh.com"
133*ba1276acSMatthew Dillon	string		"0" (version)
134*ba1276acSMatthew Dillon
135*ba1276acSMatthew DillonThe ping/reply message is implemented at the transport layer rather
136*ba1276acSMatthew Dillonthan as a named global or channel request to allow pings with very
137*ba1276acSMatthew Dillonshort packet lengths, which would not be possible with other
138*ba1276acSMatthew Dillonapproaches.
139*ba1276acSMatthew Dillon
140*ba1276acSMatthew Dillon1.10 transport: strict key exchange extension
141*ba1276acSMatthew Dillon
142*ba1276acSMatthew DillonOpenSSH supports a number of transport-layer hardening measures under
143*ba1276acSMatthew Dillona "strict KEX" feature. This feature is signalled similarly to the
144*ba1276acSMatthew DillonRFC8308 ext-info feature: by including a additional algorithm in the
145*ba1276acSMatthew Dilloninitial SSH2_MSG_KEXINIT kex_algorithms field. The client may append
146*ba1276acSMatthew Dillon"kex-strict-c-v00@openssh.com" to its kex_algorithms and the server
147*ba1276acSMatthew Dillonmay append "kex-strict-s-v00@openssh.com". These pseudo-algorithms
148*ba1276acSMatthew Dillonare only valid in the initial SSH2_MSG_KEXINIT and MUST be ignored
149*ba1276acSMatthew Dillonif they are present in subsequent SSH2_MSG_KEXINIT packets.
150*ba1276acSMatthew Dillon
151*ba1276acSMatthew DillonWhen an endpoint that supports this extension observes this algorithm
152*ba1276acSMatthew Dillonname in a peer's KEXINIT packet, it MUST make the following changes to
153*ba1276acSMatthew Dillonthe protocol:
154*ba1276acSMatthew Dillon
155*ba1276acSMatthew Dillona) During initial KEX, terminate the connection if out-of-sequence
156*ba1276acSMatthew Dillon   packet or any message that is not strictly required by KEX is
157*ba1276acSMatthew Dillon   received. This includes terminating the connection if the first
158*ba1276acSMatthew Dillon   packet received is not SSH2_MSG_KEXINIT. Unexpected packets for
159*ba1276acSMatthew Dillon   the purpose of strict KEX include messages that are otherwise
160*ba1276acSMatthew Dillon   valid at any time during the connection such as SSH2_MSG_DEBUG,
161*ba1276acSMatthew Dillon   SSH2_MSG_IGNORE or SSH2_MSG_UNIMPLEMENTED.
162*ba1276acSMatthew Dillonb) After sending or receiving a SSH2_MSG_NEWKEYS message, reset the
163*ba1276acSMatthew Dillon   packet sequence number to zero. This behaviour persists for the
164*ba1276acSMatthew Dillon   duration of the connection (i.e. not just the first
165*ba1276acSMatthew Dillon   SSH2_MSG_NEWKEYS).
166*ba1276acSMatthew Dillon
167*ba1276acSMatthew Dillon1.11 transport: SSH2_MSG_EXT_INFO during user authentication
168*ba1276acSMatthew Dillon
169*ba1276acSMatthew DillonThis protocol extension allows the SSH2_MSG_EXT_INFO to be sent
170*ba1276acSMatthew Dillonduring user authentication. RFC8308 does allow a second
171*ba1276acSMatthew DillonSSH2_MSG_EXT_INFO notification, but it may only be sent at the end
172*ba1276acSMatthew Dillonof user authentication and this is too late to signal per-user
173*ba1276acSMatthew Dillonserver signature algorithms.
174*ba1276acSMatthew Dillon
175*ba1276acSMatthew DillonSupport for receiving the SSH2_MSG_EXT_INFO message during user
176*ba1276acSMatthew Dillonauthentication is signalled by the client including a
177*ba1276acSMatthew Dillon"ext-info-in-auth@openssh.com" key via its initial SSH2_MSG_EXT_INFO
178*ba1276acSMatthew Dillonset after the SSH2_MSG_NEWKEYS message.
179*ba1276acSMatthew Dillon
180*ba1276acSMatthew DillonA server that supports this extension MAY send a second
181*ba1276acSMatthew DillonSSH2_MSG_EXT_INFO message any time after the client's first
182*ba1276acSMatthew DillonSSH2_MSG_USERAUTH_REQUEST, regardless of whether it succeed or fails.
183*ba1276acSMatthew DillonThe client SHOULD be prepared to update the server-sig-algs that
184*ba1276acSMatthew Dillonit received during an earlier SSH2_MSG_EXT_INFO with the later one.
185*ba1276acSMatthew Dillon
1869f304aafSPeter Avalos2. Connection protocol changes
1879f304aafSPeter Avalos
1889f304aafSPeter Avalos2.1. connection: Channel write close extension "eow@openssh.com"
18918de8d7fSPeter Avalos
19018de8d7fSPeter AvalosThe SSH connection protocol (rfc4254) provides the SSH_MSG_CHANNEL_EOF
19118de8d7fSPeter Avalosmessage to allow an endpoint to signal its peer that it will send no
19218de8d7fSPeter Avalosmore data over a channel. Unfortunately, there is no symmetric way for
19318de8d7fSPeter Avalosan endpoint to request that its peer should cease sending data to it
19418de8d7fSPeter Avaloswhile still keeping the channel open for the endpoint to send data to
19518de8d7fSPeter Avalosthe peer.
19618de8d7fSPeter Avalos
19718de8d7fSPeter AvalosThis is desirable, since it saves the transmission of data that would
19818de8d7fSPeter Avalosotherwise need to be discarded and it allows an endpoint to signal local
19918de8d7fSPeter Avalosprocesses of the condition, e.g. by closing the corresponding file
20018de8d7fSPeter Avalosdescriptor.
20118de8d7fSPeter Avalos
20218de8d7fSPeter AvalosOpenSSH implements a channel extension message to perform this
20318de8d7fSPeter Avalossignalling: "eow@openssh.com" (End Of Write). This message is sent by
20418de8d7fSPeter Avalosan endpoint when the local output of a session channel is closed or
20518de8d7fSPeter Avalosexperiences a write error. The message is formatted as follows:
20618de8d7fSPeter Avalos
20718de8d7fSPeter Avalos	byte		SSH_MSG_CHANNEL_REQUEST
20818de8d7fSPeter Avalos	uint32		recipient channel
20918de8d7fSPeter Avalos	string		"eow@openssh.com"
21018de8d7fSPeter Avalos	boolean		FALSE
21118de8d7fSPeter Avalos
21218de8d7fSPeter AvalosOn receiving this message, the peer SHOULD cease sending data of
21318de8d7fSPeter Avalosthe channel and MAY signal the process from which the channel data
21418de8d7fSPeter Avalosoriginates (e.g. by closing its read file descriptor).
21518de8d7fSPeter Avalos
21618de8d7fSPeter AvalosAs with the symmetric SSH_MSG_CHANNEL_EOF message, the channel does
21718de8d7fSPeter Avalosremain open after a "eow@openssh.com" has been sent and more data may
21818de8d7fSPeter Avalosstill be sent in the other direction. This message does not consume
21918de8d7fSPeter Avaloswindow space and may be sent even if no window space is available.
22018de8d7fSPeter Avalos
221cb5eb4f1SPeter AvalosNB. due to certain broken SSH implementations aborting upon receipt
222cb5eb4f1SPeter Avalosof this message (in contravention of RFC4254 section 5.4), this
223cb5eb4f1SPeter Avalosmessage is only sent to OpenSSH peers (identified by banner).
22450a69bb5SSascha WildnerOther SSH implementations may be listed to receive this message
225cb5eb4f1SPeter Avalosupon request.
226cb5eb4f1SPeter Avalos
2279f304aafSPeter Avalos2.2. connection: disallow additional sessions extension
22818de8d7fSPeter Avalos     "no-more-sessions@openssh.com"
22918de8d7fSPeter Avalos
23018de8d7fSPeter AvalosMost SSH connections will only ever request a single session, but a
23118de8d7fSPeter Avalosattacker may abuse a running ssh client to surreptitiously open
23218de8d7fSPeter Avalosadditional sessions under their control. OpenSSH provides a global
23318de8d7fSPeter Avalosrequest "no-more-sessions@openssh.com" to mitigate this attack.
23418de8d7fSPeter Avalos
23518de8d7fSPeter AvalosWhen an OpenSSH client expects that it will never open another session
23618de8d7fSPeter Avalos(i.e. it has been started with connection multiplexing disabled), it
23718de8d7fSPeter Avaloswill send the following global request:
23818de8d7fSPeter Avalos
23918de8d7fSPeter Avalos	byte		SSH_MSG_GLOBAL_REQUEST
24018de8d7fSPeter Avalos	string		"no-more-sessions@openssh.com"
24118de8d7fSPeter Avalos	char		want-reply
24218de8d7fSPeter Avalos
24318de8d7fSPeter AvalosOn receipt of such a message, an OpenSSH server will refuse to open
24418de8d7fSPeter Avalosfuture channels of type "session" and instead immediately abort the
24518de8d7fSPeter Avalosconnection.
24618de8d7fSPeter Avalos
24718de8d7fSPeter AvalosNote that this is not a general defence against compromised clients
24818de8d7fSPeter Avalos(that is impossible), but it thwarts a simple attack.
24918de8d7fSPeter Avalos
250cb5eb4f1SPeter AvalosNB. due to certain broken SSH implementations aborting upon receipt
251cb5eb4f1SPeter Avalosof this message, the no-more-sessions request is only sent to OpenSSH
252cb5eb4f1SPeter Avalosservers (identified by banner). Other SSH implementations may be
25350a69bb5SSascha Wildnerlisted to receive this message upon request.
254cb5eb4f1SPeter Avalos
2559f304aafSPeter Avalos2.3. connection: Tunnel forward extension "tun@openssh.com"
25618de8d7fSPeter Avalos
25718de8d7fSPeter AvalosOpenSSH supports layer 2 and layer 3 tunnelling via the "tun@openssh.com"
25818de8d7fSPeter Avaloschannel type. This channel type supports forwarding of network packets
25918de8d7fSPeter Avaloswith datagram boundaries intact between endpoints equipped with
26018de8d7fSPeter Avalosinterfaces like the BSD tun(4) device. Tunnel forwarding channels are
26118de8d7fSPeter Avalosrequested by the client with the following packet:
26218de8d7fSPeter Avalos
26318de8d7fSPeter Avalos	byte		SSH_MSG_CHANNEL_OPEN
26418de8d7fSPeter Avalos	string		"tun@openssh.com"
26518de8d7fSPeter Avalos	uint32		sender channel
26618de8d7fSPeter Avalos	uint32		initial window size
26718de8d7fSPeter Avalos	uint32		maximum packet size
26818de8d7fSPeter Avalos	uint32		tunnel mode
26918de8d7fSPeter Avalos	uint32		remote unit number
27018de8d7fSPeter Avalos
27118de8d7fSPeter AvalosThe "tunnel mode" parameter specifies whether the tunnel should forward
27218de8d7fSPeter Avaloslayer 2 frames or layer 3 packets. It may take one of the following values:
27318de8d7fSPeter Avalos
27418de8d7fSPeter Avalos	SSH_TUNMODE_POINTOPOINT  1		/* layer 3 packets */
27518de8d7fSPeter Avalos	SSH_TUNMODE_ETHERNET     2		/* layer 2 frames */
27618de8d7fSPeter Avalos
27718de8d7fSPeter AvalosThe "tunnel unit number" specifies the remote interface number, or may
2780cbfa66cSDaniel Fojtbe 0x7fffffff to allow the server to automatically choose an interface. A
279856ea928SPeter Avalosserver that is not willing to open a client-specified unit should refuse
280856ea928SPeter Avalosthe request with a SSH_MSG_CHANNEL_OPEN_FAILURE error. On successful
281856ea928SPeter Avalosopen, the server should reply with SSH_MSG_CHANNEL_OPEN_SUCCESS.
28218de8d7fSPeter Avalos
28318de8d7fSPeter AvalosOnce established the client and server may exchange packet or frames
28418de8d7fSPeter Avalosover the tunnel channel by encapsulating them in SSH protocol strings
28518de8d7fSPeter Avalosand sending them as channel data. This ensures that packet boundaries
28618de8d7fSPeter Avalosare kept intact. Specifically, packets are transmitted using normal
28718de8d7fSPeter AvalosSSH_MSG_CHANNEL_DATA packets:
28818de8d7fSPeter Avalos
28918de8d7fSPeter Avalos	byte		SSH_MSG_CHANNEL_DATA
29018de8d7fSPeter Avalos	uint32		recipient channel
29118de8d7fSPeter Avalos	string		data
29218de8d7fSPeter Avalos
29318de8d7fSPeter AvalosThe contents of the "data" field for layer 3 packets is:
29418de8d7fSPeter Avalos
29518de8d7fSPeter Avalos	uint32			packet length
29618de8d7fSPeter Avalos	uint32			address family
29718de8d7fSPeter Avalos	byte[packet length - 4]	packet data
29818de8d7fSPeter Avalos
29918de8d7fSPeter AvalosThe "address family" field identifies the type of packet in the message.
30018de8d7fSPeter AvalosIt may be one of:
30118de8d7fSPeter Avalos
30218de8d7fSPeter Avalos	SSH_TUN_AF_INET		2		/* IPv4 */
30318de8d7fSPeter Avalos	SSH_TUN_AF_INET6	24		/* IPv6 */
30418de8d7fSPeter Avalos
30518de8d7fSPeter AvalosThe "packet data" field consists of the IPv4/IPv6 datagram itself
30618de8d7fSPeter Avaloswithout any link layer header.
30718de8d7fSPeter Avalos
308856ea928SPeter AvalosThe contents of the "data" field for layer 2 packets is:
30918de8d7fSPeter Avalos
31018de8d7fSPeter Avalos	uint32			packet length
31118de8d7fSPeter Avalos	byte[packet length]	frame
31218de8d7fSPeter Avalos
31318de8d7fSPeter AvalosThe "frame" field contains an IEEE 802.3 Ethernet frame, including
31418de8d7fSPeter Avalosheader.
31518de8d7fSPeter Avalos
31636e94dc5SPeter Avalos2.4. connection: Unix domain socket forwarding
31736e94dc5SPeter Avalos
31836e94dc5SPeter AvalosOpenSSH supports local and remote Unix domain socket forwarding
31936e94dc5SPeter Avalosusing the "streamlocal" extension.  Forwarding is initiated as per
32036e94dc5SPeter AvalosTCP sockets but with a single path instead of a host and port.
32136e94dc5SPeter Avalos
32236e94dc5SPeter AvalosSimilar to direct-tcpip, direct-streamlocal is sent by the client
32336e94dc5SPeter Avalosto request that the server make a connection to a Unix domain socket.
32436e94dc5SPeter Avalos
32536e94dc5SPeter Avalos	byte		SSH_MSG_CHANNEL_OPEN
32636e94dc5SPeter Avalos	string		"direct-streamlocal@openssh.com"
32736e94dc5SPeter Avalos	uint32		sender channel
32836e94dc5SPeter Avalos	uint32		initial window size
32936e94dc5SPeter Avalos	uint32		maximum packet size
33036e94dc5SPeter Avalos	string		socket path
331e9778795SPeter Avalos	string		reserved
332e9778795SPeter Avalos	uint32		reserved
33336e94dc5SPeter Avalos
33436e94dc5SPeter AvalosSimilar to forwarded-tcpip, forwarded-streamlocal is sent by the
33536e94dc5SPeter Avalosserver when the client has previously send the server a streamlocal-forward
33636e94dc5SPeter AvalosGLOBAL_REQUEST.
33736e94dc5SPeter Avalos
33836e94dc5SPeter Avalos	byte		SSH_MSG_CHANNEL_OPEN
33936e94dc5SPeter Avalos	string		"forwarded-streamlocal@openssh.com"
34036e94dc5SPeter Avalos	uint32		sender channel
34136e94dc5SPeter Avalos	uint32		initial window size
34236e94dc5SPeter Avalos	uint32		maximum packet size
34336e94dc5SPeter Avalos	string		socket path
34436e94dc5SPeter Avalos	string		reserved for future use
34536e94dc5SPeter Avalos
34636e94dc5SPeter AvalosThe reserved field is not currently defined and is ignored on the
34736e94dc5SPeter Avalosremote end.  It is intended to be used in the future to pass
34836e94dc5SPeter Avalosinformation about the socket file, such as ownership and mode.
34936e94dc5SPeter AvalosThe client currently sends the empty string for this field.
35036e94dc5SPeter Avalos
35136e94dc5SPeter AvalosSimilar to tcpip-forward, streamlocal-forward is sent by the client
35236e94dc5SPeter Avalosto request remote forwarding of a Unix domain socket.
35336e94dc5SPeter Avalos
35436e94dc5SPeter Avalos	byte		SSH2_MSG_GLOBAL_REQUEST
35536e94dc5SPeter Avalos	string		"streamlocal-forward@openssh.com"
35636e94dc5SPeter Avalos	boolean		TRUE
35736e94dc5SPeter Avalos	string		socket path
35836e94dc5SPeter Avalos
35936e94dc5SPeter AvalosSimilar to cancel-tcpip-forward, cancel-streamlocal-forward is sent
36036e94dc5SPeter Avalosby the client cancel the forwarding of a Unix domain socket.
36136e94dc5SPeter Avalos
36236e94dc5SPeter Avalos	byte		SSH2_MSG_GLOBAL_REQUEST
36336e94dc5SPeter Avalos	string		"cancel-streamlocal-forward@openssh.com"
36436e94dc5SPeter Avalos	boolean		FALSE
36536e94dc5SPeter Avalos	string		socket path
36636e94dc5SPeter Avalos
367e9778795SPeter Avalos2.5. connection: hostkey update and rotation "hostkeys-00@openssh.com"
368e9778795SPeter Avalosand "hostkeys-prove-00@openssh.com"
369e9778795SPeter Avalos
370e9778795SPeter AvalosOpenSSH supports a protocol extension allowing a server to inform
371e9778795SPeter Avalosa client of all its protocol v.2 host keys after user-authentication
372e9778795SPeter Avaloshas completed.
373e9778795SPeter Avalos
374e9778795SPeter Avalos	byte		SSH_MSG_GLOBAL_REQUEST
375e9778795SPeter Avalos	string		"hostkeys-00@openssh.com"
37650a69bb5SSascha Wildner	char		0 /* want-reply */
377e9778795SPeter Avalos	string[]	hostkeys
378e9778795SPeter Avalos
379e9778795SPeter AvalosUpon receiving this message, a client should check which of the
380664f4763Szrjsupplied host keys are present in known_hosts.
381664f4763Szrj
382664f4763SzrjNote that the server may send key types that the client does not
3830cbfa66cSDaniel Fojtsupport. The client should disregard such keys if they are received.
384664f4763Szrj
385664f4763SzrjIf the client identifies any keys that are not present for the host,
386664f4763Szrjit should send a "hostkeys-prove@openssh.com" message to request the
387664f4763Szrjserver prove ownership of the private half of the key.
388e9778795SPeter Avalos
389e9778795SPeter Avalos	byte		SSH_MSG_GLOBAL_REQUEST
390e9778795SPeter Avalos	string		"hostkeys-prove-00@openssh.com"
391e9778795SPeter Avalos	char		1 /* want-reply */
392e9778795SPeter Avalos	string[]	hostkeys
393e9778795SPeter Avalos
394e9778795SPeter AvalosWhen a server receives this message, it should generate a signature
395e9778795SPeter Avalosusing each requested key over the following:
396e9778795SPeter Avalos
397e9778795SPeter Avalos	string		"hostkeys-prove-00@openssh.com"
398e9778795SPeter Avalos	string		session identifier
399e9778795SPeter Avalos	string		hostkey
400e9778795SPeter Avalos
401e9778795SPeter AvalosThese signatures should be included in the reply, in the order matching
402e9778795SPeter Avalosthe hostkeys in the request:
403e9778795SPeter Avalos
404e9778795SPeter Avalos	byte		SSH_MSG_REQUEST_SUCCESS
405e9778795SPeter Avalos	string[]	signatures
406e9778795SPeter Avalos
407e9778795SPeter AvalosWhen the client receives this reply (and not a failure), it should
408e9778795SPeter Avalosvalidate the signatures and may update its known_hosts file, adding keys
409e9778795SPeter Avalosthat it has not seen before and deleting keys for the server host that
410e9778795SPeter Avalosare no longer offered.
411e9778795SPeter Avalos
412e9778795SPeter AvalosThese extensions let a client learn key types that it had not previously
413e9778795SPeter Avalosencountered, thereby allowing it to potentially upgrade from weaker
414e9778795SPeter Avaloskey algorithms to better ones. It also supports graceful key rotation:
415e9778795SPeter Avalosa server may offer multiple keys of the same type for a period (to
416e9778795SPeter Avalosgive clients an opportunity to learn them using this extension) before
417e9778795SPeter Avalosremoving the deprecated key from those offered.
418e9778795SPeter Avalos
419664f4763Szrj2.6. connection: SIGINFO support for "signal" channel request
420664f4763Szrj
421664f4763SzrjThe SSH channels protocol (RFC4254 section 6.9) supports sending a
422664f4763Szrjsignal to a session attached to a channel. OpenSSH supports one
423664f4763Szrjextension signal "INFO@openssh.com" that allows sending SIGINFO on
424664f4763SzrjBSD-derived systems.
425664f4763Szrj
426ee116499SAntonio Huete Jimenez3. Authentication protocol changes
4279f304aafSPeter Avalos
428ee116499SAntonio Huete Jimenez3.1. Host-bound public key authentication
429ee116499SAntonio Huete Jimenez
430ee116499SAntonio Huete JimenezThis is trivial change to the traditional "publickey" authentication
431ee116499SAntonio Huete Jimenezmethod. The authentication request is identical to the original method
432ee116499SAntonio Huete Jimenezbut for the name and one additional field:
433ee116499SAntonio Huete Jimenez
434ee116499SAntonio Huete Jimenez	byte		SSH2_MSG_USERAUTH_REQUEST
435ee116499SAntonio Huete Jimenez	string		username
436ee116499SAntonio Huete Jimenez	string		"ssh-connection"
437ee116499SAntonio Huete Jimenez	string		"publickey-hostbound-v00@openssh.com"
438ee116499SAntonio Huete Jimenez	bool		has_signature
439ee116499SAntonio Huete Jimenez	string		pkalg
440ee116499SAntonio Huete Jimenez	string		public key
441ee116499SAntonio Huete Jimenez	string		server host key
442ee116499SAntonio Huete Jimenez
443ee116499SAntonio Huete JimenezBecause the entire SSH2_MSG_USERAUTH_REQUEST message is included in
444ee116499SAntonio Huete Jimenezthe signed data, this ensures that a binding between the destination
445ee116499SAntonio Huete Jimenezuser, the server identity and the session identifier is visible to the
446ee116499SAntonio Huete Jimenezsigner. OpenSSH uses this binding via signed data to implement per-key
447ee116499SAntonio Huete Jimenezrestrictions in ssh-agent.
448ee116499SAntonio Huete Jimenez
449ee116499SAntonio Huete JimenezA server may advertise this method using the SSH2_MSG_EXT_INFO
450ee116499SAntonio Huete Jimenezmechanism (RFC8308), with the following message:
451ee116499SAntonio Huete Jimenez
452ee116499SAntonio Huete Jimenez	string		"publickey-hostbound@openssh.com"
453ee116499SAntonio Huete Jimenez	string		"0" (version)
454ee116499SAntonio Huete Jimenez
455ee116499SAntonio Huete JimenezClients should prefer host-bound authentication when advertised by
456ee116499SAntonio Huete Jimenezserver.
457ee116499SAntonio Huete Jimenez
458ee116499SAntonio Huete Jimenez4. SFTP protocol changes
459ee116499SAntonio Huete Jimenez
460ee116499SAntonio Huete Jimenez4.1. sftp: Reversal of arguments to SSH_FXP_SYMLINK
46118de8d7fSPeter Avalos
46218de8d7fSPeter AvalosWhen OpenSSH's sftp-server was implemented, the order of the arguments
46318de8d7fSPeter Avalosto the SSH_FXP_SYMLINK method was inadvertently reversed. Unfortunately,
46418de8d7fSPeter Avalosthe reversal was not noticed until the server was widely deployed. Since
46518de8d7fSPeter Avalosfixing this to follow the specification would cause incompatibility, the
46618de8d7fSPeter Avaloscurrent order was retained. For correct operation, clients should send
46718de8d7fSPeter AvalosSSH_FXP_SYMLINK as follows:
46818de8d7fSPeter Avalos
46918de8d7fSPeter Avalos	uint32		id
47018de8d7fSPeter Avalos	string		targetpath
47118de8d7fSPeter Avalos	string		linkpath
47218de8d7fSPeter Avalos
473ee116499SAntonio Huete Jimenez4.2. sftp: Server extension announcement in SSH_FXP_VERSION
47418de8d7fSPeter Avalos
47518de8d7fSPeter AvalosOpenSSH's sftp-server lists the extensions it supports using the
47618de8d7fSPeter Avalosstandard extension announcement mechanism in the SSH_FXP_VERSION server
47718de8d7fSPeter Avaloshello packet:
47818de8d7fSPeter Avalos
47918de8d7fSPeter Avalos	uint32		3		/* protocol version */
48018de8d7fSPeter Avalos	string		ext1-name
48118de8d7fSPeter Avalos	string		ext1-version
48218de8d7fSPeter Avalos	string		ext2-name
48318de8d7fSPeter Avalos	string		ext2-version
48418de8d7fSPeter Avalos	...
48518de8d7fSPeter Avalos	string		extN-name
48618de8d7fSPeter Avalos	string		extN-version
48718de8d7fSPeter Avalos
48818de8d7fSPeter AvalosEach extension reports its integer version number as an ASCII encoded
48918de8d7fSPeter Avalosstring, e.g. "1". The version will be incremented if the extension is
49018de8d7fSPeter Avalosever changed in an incompatible way. The server MAY advertise the same
49118de8d7fSPeter Avalosextension with multiple versions (though this is unlikely). Clients MUST
49218de8d7fSPeter Avaloscheck the version number before attempting to use the extension.
49318de8d7fSPeter Avalos
494ee116499SAntonio Huete Jimenez4.3. sftp: Extension request "posix-rename@openssh.com"
49518de8d7fSPeter Avalos
49618de8d7fSPeter AvalosThis operation provides a rename operation with POSIX semantics, which
49718de8d7fSPeter Avalosare different to those provided by the standard SSH_FXP_RENAME in
49818de8d7fSPeter Avalosdraft-ietf-secsh-filexfer-02.txt. This request is implemented as a
49918de8d7fSPeter AvalosSSH_FXP_EXTENDED request with the following format:
50018de8d7fSPeter Avalos
50118de8d7fSPeter Avalos	uint32		id
50218de8d7fSPeter Avalos	string		"posix-rename@openssh.com"
50318de8d7fSPeter Avalos	string		oldpath
50418de8d7fSPeter Avalos	string		newpath
50518de8d7fSPeter Avalos
50618de8d7fSPeter AvalosOn receiving this request the server will perform the POSIX operation
50718de8d7fSPeter Avalosrename(oldpath, newpath) and will respond with a SSH_FXP_STATUS message.
50818de8d7fSPeter AvalosThis extension is advertised in the SSH_FXP_VERSION hello with version
50918de8d7fSPeter Avalos"1".
51018de8d7fSPeter Avalos
511ee116499SAntonio Huete Jimenez4.4. sftp: Extension requests "statvfs@openssh.com" and
51218de8d7fSPeter Avalos         "fstatvfs@openssh.com"
51318de8d7fSPeter Avalos
51418de8d7fSPeter AvalosThese requests correspond to the statvfs and fstatvfs POSIX system
51518de8d7fSPeter Avalosinterfaces. The "statvfs@openssh.com" request operates on an explicit
51618de8d7fSPeter Avalospathname, and is formatted as follows:
51718de8d7fSPeter Avalos
51818de8d7fSPeter Avalos	uint32		id
51918de8d7fSPeter Avalos	string		"statvfs@openssh.com"
52018de8d7fSPeter Avalos	string		path
52118de8d7fSPeter Avalos
52218de8d7fSPeter AvalosThe "fstatvfs@openssh.com" operates on an open file handle:
52318de8d7fSPeter Avalos
52418de8d7fSPeter Avalos	uint32		id
52518de8d7fSPeter Avalos	string		"fstatvfs@openssh.com"
52618de8d7fSPeter Avalos	string		handle
52718de8d7fSPeter Avalos
52818de8d7fSPeter AvalosThese requests return a SSH_FXP_STATUS reply on failure. On success they
52918de8d7fSPeter Avalosreturn the following SSH_FXP_EXTENDED_REPLY reply:
53018de8d7fSPeter Avalos
53118de8d7fSPeter Avalos	uint32		id
53218de8d7fSPeter Avalos	uint64		f_bsize		/* file system block size */
53318de8d7fSPeter Avalos	uint64		f_frsize	/* fundamental fs block size */
53418de8d7fSPeter Avalos	uint64		f_blocks	/* number of blocks (unit f_frsize) */
53518de8d7fSPeter Avalos	uint64		f_bfree		/* free blocks in file system */
53618de8d7fSPeter Avalos	uint64		f_bavail	/* free blocks for non-root */
53718de8d7fSPeter Avalos	uint64		f_files		/* total file inodes */
53818de8d7fSPeter Avalos	uint64		f_ffree		/* free file inodes */
53918de8d7fSPeter Avalos	uint64		f_favail	/* free file inodes for to non-root */
54018de8d7fSPeter Avalos	uint64		f_fsid		/* file system id */
54118de8d7fSPeter Avalos	uint64		f_flag		/* bit mask of f_flag values */
54218de8d7fSPeter Avalos	uint64		f_namemax	/* maximum filename length */
54318de8d7fSPeter Avalos
54418de8d7fSPeter AvalosThe values of the f_flag bitmask are as follows:
54518de8d7fSPeter Avalos
54618de8d7fSPeter Avalos	#define SSH_FXE_STATVFS_ST_RDONLY	0x1	/* read-only */
54718de8d7fSPeter Avalos	#define SSH_FXE_STATVFS_ST_NOSUID	0x2	/* no setuid */
54818de8d7fSPeter Avalos
54918de8d7fSPeter AvalosBoth the "statvfs@openssh.com" and "fstatvfs@openssh.com" extensions are
55018de8d7fSPeter Avalosadvertised in the SSH_FXP_VERSION hello with version "2".
55118de8d7fSPeter Avalos
552ee116499SAntonio Huete Jimenez4.5. sftp: Extension request "hardlink@openssh.com"
5539f304aafSPeter Avalos
5549f304aafSPeter AvalosThis request is for creating a hard link to a regular file. This
5559f304aafSPeter Avalosrequest is implemented as a SSH_FXP_EXTENDED request with the
5569f304aafSPeter Avalosfollowing format:
5579f304aafSPeter Avalos
5589f304aafSPeter Avalos	uint32		id
5599f304aafSPeter Avalos	string		"hardlink@openssh.com"
5609f304aafSPeter Avalos	string		oldpath
5619f304aafSPeter Avalos	string		newpath
5629f304aafSPeter Avalos
5639f304aafSPeter AvalosOn receiving this request the server will perform the operation
5649f304aafSPeter Avaloslink(oldpath, newpath) and will respond with a SSH_FXP_STATUS message.
5659f304aafSPeter AvalosThis extension is advertised in the SSH_FXP_VERSION hello with version
5669f304aafSPeter Avalos"1".
5679f304aafSPeter Avalos
568ee116499SAntonio Huete Jimenez4.6. sftp: Extension request "fsync@openssh.com"
56936e94dc5SPeter Avalos
57036e94dc5SPeter AvalosThis request asks the server to call fsync(2) on an open file handle.
57136e94dc5SPeter Avalos
57236e94dc5SPeter Avalos	uint32		id
57336e94dc5SPeter Avalos	string		"fsync@openssh.com"
57436e94dc5SPeter Avalos	string		handle
57536e94dc5SPeter Avalos
576ee116499SAntonio Huete JimenezOn receiving this request, a server will call fsync(handle_fd) and will
57736e94dc5SPeter Avalosrespond with a SSH_FXP_STATUS message.
57836e94dc5SPeter Avalos
57936e94dc5SPeter AvalosThis extension is advertised in the SSH_FXP_VERSION hello with version
58036e94dc5SPeter Avalos"1".
58136e94dc5SPeter Avalos
582ee116499SAntonio Huete Jimenez4.7. sftp: Extension request "lsetstat@openssh.com"
58350a69bb5SSascha Wildner
58450a69bb5SSascha WildnerThis request is like the "setstat" command, but sets file attributes on
58550a69bb5SSascha Wildnersymlinks.  It is implemented as a SSH_FXP_EXTENDED request with the
58650a69bb5SSascha Wildnerfollowing format:
58750a69bb5SSascha Wildner
58850a69bb5SSascha Wildner	uint32		id
58950a69bb5SSascha Wildner	string		"lsetstat@openssh.com"
59050a69bb5SSascha Wildner	string		path
59150a69bb5SSascha Wildner	ATTRS		attrs
59250a69bb5SSascha Wildner
59350a69bb5SSascha WildnerSee the "setstat" command for more details.
59450a69bb5SSascha Wildner
59550a69bb5SSascha WildnerThis extension is advertised in the SSH_FXP_VERSION hello with version
59650a69bb5SSascha Wildner"1".
59750a69bb5SSascha Wildner
598ee116499SAntonio Huete Jimenez4.8. sftp: Extension request "limits@openssh.com"
59950a69bb5SSascha Wildner
60050a69bb5SSascha WildnerThis request is used to determine various limits the server might impose.
60150a69bb5SSascha WildnerClients should not attempt to exceed these limits as the server might sever
60250a69bb5SSascha Wildnerthe connection immediately.
60350a69bb5SSascha Wildner
60450a69bb5SSascha Wildner	uint32		id
60550a69bb5SSascha Wildner	string		"limits@openssh.com"
60650a69bb5SSascha Wildner
60750a69bb5SSascha WildnerThe server will respond with a SSH_FXP_EXTENDED_REPLY reply:
60850a69bb5SSascha Wildner
60950a69bb5SSascha Wildner	uint32		id
61050a69bb5SSascha Wildner	uint64		max-packet-length
61150a69bb5SSascha Wildner	uint64		max-read-length
61250a69bb5SSascha Wildner	uint64		max-write-length
61350a69bb5SSascha Wildner	uint64		max-open-handles
61450a69bb5SSascha Wildner
61550a69bb5SSascha WildnerThe 'max-packet-length' applies to the total number of bytes in a
61650a69bb5SSascha Wildnersingle SFTP packet.  Servers SHOULD set this at least to 34000.
61750a69bb5SSascha Wildner
61850a69bb5SSascha WildnerThe 'max-read-length' is the largest length in a SSH_FXP_READ packet.
61950a69bb5SSascha WildnerEven if the client requests a larger size, servers will usually respond
62050a69bb5SSascha Wildnerwith a shorter SSH_FXP_DATA packet.  Servers SHOULD set this at least to
62150a69bb5SSascha Wildner32768.
62250a69bb5SSascha Wildner
62350a69bb5SSascha WildnerThe 'max-write-length' is the largest length in a SSH_FXP_WRITE packet
62450a69bb5SSascha Wildnerthe server will accept.  Servers SHOULD set this at least to 32768.
62550a69bb5SSascha Wildner
62650a69bb5SSascha WildnerThe 'max-open-handles' is the maximum number of active handles that the
62750a69bb5SSascha Wildnerserver allows (e.g. handles created by SSH_FXP_OPEN and SSH_FXP_OPENDIR
62850a69bb5SSascha Wildnerpackets).  Servers MAY count internal file handles against this limit
62950a69bb5SSascha Wildner(e.g. system logging or stdout/stderr), so clients SHOULD NOT expect to
63050a69bb5SSascha Wildneropen this many handles in practice.
63150a69bb5SSascha Wildner
63250a69bb5SSascha WildnerIf the server doesn't enforce a specific limit, then the field may be
63350a69bb5SSascha Wildnerset to 0.  This implies the server relies on the OS to enforce limits
63450a69bb5SSascha Wildner(e.g. available memory or file handles), and such limits might be
63550a69bb5SSascha Wildnerdynamic.  The client SHOULD take care to not try to exceed reasonable
63650a69bb5SSascha Wildnerlimits.
63750a69bb5SSascha Wildner
63850a69bb5SSascha WildnerThis extension is advertised in the SSH_FXP_VERSION hello with version
63950a69bb5SSascha Wildner"1".
64050a69bb5SSascha Wildner
641ee116499SAntonio Huete Jimenez4.9. sftp: Extension request "expand-path@openssh.com"
64250a69bb5SSascha Wildner
64350a69bb5SSascha WildnerThis request supports canonicalisation of relative paths and
64450a69bb5SSascha Wildnerthose that need tilde-expansion, i.e. "~", "~/..." and "~user/..."
64550a69bb5SSascha WildnerThese paths are expanded using shell-like rules and the resultant
64650a69bb5SSascha Wildnerpath is canonicalised similarly to SSH2_FXP_REALPATH.
64750a69bb5SSascha Wildner
64850a69bb5SSascha WildnerIt is implemented as a SSH_FXP_EXTENDED request with the following
64950a69bb5SSascha Wildnerformat:
65050a69bb5SSascha Wildner
65150a69bb5SSascha Wildner	uint32		id
65250a69bb5SSascha Wildner	string		"expand-path@openssh.com"
65350a69bb5SSascha Wildner	string		path
65450a69bb5SSascha Wildner
65550a69bb5SSascha WildnerIts reply is the same format as that of SSH2_FXP_REALPATH.
65650a69bb5SSascha Wildner
65750a69bb5SSascha WildnerThis extension is advertised in the SSH_FXP_VERSION hello with version
65850a69bb5SSascha Wildner"1".
65950a69bb5SSascha Wildner
660ee116499SAntonio Huete Jimenez4.10. sftp: Extension request "copy-data"
661664f4763Szrj
662ee116499SAntonio Huete JimenezThis request asks the server to copy data from one open file handle and
663ee116499SAntonio Huete Jimenezwrite it to a different open file handle.  This avoids needing to transfer
664ee116499SAntonio Huete Jimenezthe data across the network twice (a download followed by an upload).
665ee116499SAntonio Huete Jimenez
666ee116499SAntonio Huete Jimenez	byte		SSH_FXP_EXTENDED
667ee116499SAntonio Huete Jimenez	uint32		id
668ee116499SAntonio Huete Jimenez	string		"copy-data"
669ee116499SAntonio Huete Jimenez	string		read-from-handle
670ee116499SAntonio Huete Jimenez	uint64		read-from-offset
671ee116499SAntonio Huete Jimenez	uint64		read-data-length
672ee116499SAntonio Huete Jimenez	string		write-to-handle
673ee116499SAntonio Huete Jimenez	uint64		write-to-offset
674ee116499SAntonio Huete Jimenez
675ee116499SAntonio Huete JimenezThe server will copy read-data-length bytes starting from
676ee116499SAntonio Huete Jimenezread-from-offset from the read-from-handle and write them to
677ee116499SAntonio Huete Jimenezwrite-to-handle starting from write-to-offset, and then respond with a
678ee116499SAntonio Huete JimenezSSH_FXP_STATUS message.
679ee116499SAntonio Huete Jimenez
680ee116499SAntonio Huete JimenezIt's equivalent to issuing a series of SSH_FXP_READ requests on
681ee116499SAntonio Huete Jimenezread-from-handle and a series of requests of SSH_FXP_WRITE on
682ee116499SAntonio Huete Jimenezwrite-to-handle.
683ee116499SAntonio Huete Jimenez
684ee116499SAntonio Huete JimenezIf read-from-handle and write-to-handle are the same, the server will
685ee116499SAntonio Huete Jimenezfail the request and respond with a SSH_FX_INVALID_PARAMETER message.
686ee116499SAntonio Huete Jimenez
687ee116499SAntonio Huete JimenezIf read-data-length is 0, then the server will read data from the
688ee116499SAntonio Huete Jimenezread-from-handle until EOF is reached.
689ee116499SAntonio Huete Jimenez
690ee116499SAntonio Huete JimenezThis extension is advertised in the SSH_FXP_VERSION hello with version
691ee116499SAntonio Huete Jimenez"1".
692ee116499SAntonio Huete Jimenez
693ee116499SAntonio Huete JimenezThis request is identical to the "copy-data" request documented in:
694ee116499SAntonio Huete Jimenez
695ee116499SAntonio Huete Jimenezhttps://tools.ietf.org/html/draft-ietf-secsh-filexfer-extensions-00#section-7
696ee116499SAntonio Huete Jimenez
697ee116499SAntonio Huete Jimenez4.11. sftp: Extension request "home-directory"
698ee116499SAntonio Huete Jimenez
699ee116499SAntonio Huete JimenezThis request asks the server to expand the specified user's home directory.
700ee116499SAntonio Huete JimenezAn empty username implies the current user.  This can be used by the client
701ee116499SAntonio Huete Jimenezto expand ~/ type paths locally.
702ee116499SAntonio Huete Jimenez
703ee116499SAntonio Huete Jimenez	byte		SSH_FXP_EXTENDED
704ee116499SAntonio Huete Jimenez	uint32		id
705ee116499SAntonio Huete Jimenez	string		"home-directory"
706ee116499SAntonio Huete Jimenez	string		username
707ee116499SAntonio Huete Jimenez
708ee116499SAntonio Huete JimenezThis extension is advertised in the SSH_FXP_VERSION hello with version
709ee116499SAntonio Huete Jimenez"1".
710ee116499SAntonio Huete Jimenez
711ee116499SAntonio Huete JimenezThis provides similar information as the "expand-path@openssh.com" extension.
712ee116499SAntonio Huete Jimenez
713ee116499SAntonio Huete JimenezThis request is identical to the "home-directory" request documented in:
714ee116499SAntonio Huete Jimenez
715ee116499SAntonio Huete Jimenezhttps://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-extensions-00#section-5
716ee116499SAntonio Huete Jimenez
717ee116499SAntonio Huete Jimenez4.12. sftp: Extension request "users-groups-by-id@openssh.com"
718ee116499SAntonio Huete Jimenez
719*ba1276acSMatthew DillonThis request asks the server to return user and/or group names that
720ee116499SAntonio Huete Jimenezcorrespond to one or more IDs (e.g. as returned from a SSH_FXP_STAT
721ee116499SAntonio Huete Jimenezrequest). This may be used by the client to provide usernames in
722ee116499SAntonio Huete Jimenezdirectory listings.
723ee116499SAntonio Huete Jimenez
724ee116499SAntonio Huete Jimenez	byte		SSH_FXP_EXTENDED
725ee116499SAntonio Huete Jimenez	uint32		id
726ee116499SAntonio Huete Jimenez	string		"users-groups-by-id@openssh.com"
727ee116499SAntonio Huete Jimenez	string		uids
728ee116499SAntonio Huete Jimenez	string		gids
729ee116499SAntonio Huete Jimenez
730ee116499SAntonio Huete JimenezWhere "uids" and "gids" consists of one or more integer user or group
731ee116499SAntonio Huete Jimenezidentifiers:
732ee116499SAntonio Huete Jimenez
733ee116499SAntonio Huete Jimenez	uint32		id-0
734ee116499SAntonio Huete Jimenez	...
735ee116499SAntonio Huete Jimenez
736ee116499SAntonio Huete JimenezThe server will reply with a SSH_FXP_EXTENDED_REPLY:
737ee116499SAntonio Huete Jimenez
738ee116499SAntonio Huete Jimenez	byte		SSH_FXP_EXTENDED_REPLY
739*ba1276acSMatthew Dillon	uint32		id
740ee116499SAntonio Huete Jimenez	string		usernames
741ee116499SAntonio Huete Jimenez	string		groupnames
742ee116499SAntonio Huete Jimenez
743ee116499SAntonio Huete JimenezWhere "username" and "groupnames" consists of names in identical request
744ee116499SAntonio Huete Jimenezorder to "uids" and "gids" respectively:
745ee116499SAntonio Huete Jimenez
746ee116499SAntonio Huete Jimenez	string		name-0
747ee116499SAntonio Huete Jimenez	...
748ee116499SAntonio Huete Jimenez
749ee116499SAntonio Huete JimenezIf a name cannot be identified for a given user or group ID, an empty
750ee116499SAntonio Huete Jimenezstring will be returned in its place.
751ee116499SAntonio Huete Jimenez
752ee116499SAntonio Huete JimenezIt is acceptable for either "uids" or "gids" to be an empty set, in
753ee116499SAntonio Huete Jimenezwhich case the respective "usernames" or "groupnames" list will also
754ee116499SAntonio Huete Jimenezbe empty.
755ee116499SAntonio Huete Jimenez
756ee116499SAntonio Huete JimenezThis extension is advertised in the SSH_FXP_VERSION hello with version
757ee116499SAntonio Huete Jimenez"1".
758ee116499SAntonio Huete Jimenez
759ee116499SAntonio Huete Jimenez5. Miscellaneous changes
760ee116499SAntonio Huete Jimenez
761ee116499SAntonio Huete Jimenez5.1 Public key format
762664f4763Szrj
763664f4763SzrjOpenSSH public keys, as generated by ssh-keygen(1) and appearing in
764664f4763Szrjauthorized_keys files, are formatted as a single line of text consisting
765664f4763Szrjof the public key algorithm name followed by a base64-encoded key blob.
766664f4763SzrjThe public key blob (before base64 encoding) is the same format used for
767664f4763Szrjthe encoding of public keys sent on the wire: as described in RFC4253
768664f4763Szrjsection 6.6 for RSA and DSA keys, RFC5656 section 3.1 for ECDSA keys
769664f4763Szrjand the "New public key formats" section of PROTOCOL.certkeys for the
770664f4763SzrjOpenSSH certificate formats.
771664f4763Szrj
772ee116499SAntonio Huete Jimenez5.2 Private key format
773664f4763Szrj
774664f4763SzrjOpenSSH private keys, as generated by ssh-keygen(1) use the format
775664f4763Szrjdescribed in PROTOCOL.key by default. As a legacy option, PEM format
776664f4763Szrj(RFC7468) private keys are also supported for RSA, DSA and ECDSA keys
777664f4763Szrjand were the default format before OpenSSH 7.8.
778664f4763Szrj
779ee116499SAntonio Huete Jimenez5.3 KRL format
780664f4763Szrj
781664f4763SzrjOpenSSH supports a compact format for Key Revocation Lists (KRLs). This
782664f4763Szrjformat is described in the PROTOCOL.krl file.
783664f4763Szrj
784ee116499SAntonio Huete Jimenez5.4 Connection multiplexing
785664f4763Szrj
786664f4763SzrjOpenSSH's connection multiplexing uses messages as described in
787664f4763SzrjPROTOCOL.mux over a Unix domain socket for communications between a
788664f4763Szrjmaster instance and later clients.
789664f4763Szrj
790ee116499SAntonio Huete Jimenez5.5. Agent protocol extensions
791ee116499SAntonio Huete Jimenez
792ee116499SAntonio Huete JimenezOpenSSH extends the usual agent protocol. These changes are documented
793ee116499SAntonio Huete Jimenezin the PROTOCOL.agent file.
794ee116499SAntonio Huete Jimenez
795*ba1276acSMatthew Dillon$OpenBSD: PROTOCOL,v 1.55 2024/01/08 05:05:15 djm Exp $
796