xref: /openbsd/usr.bin/ssh/PROTOCOL (revision 61185547)
1422225e8SdjmThis documents OpenSSH's deviations and extensions to the published SSH
2422225e8Sdjmprotocol.
3422225e8Sdjm
438d4658eSdjmNote that OpenSSH's sftp and sftp-server implement revision 3 of the SSH
538d4658eSdjmfilexfer protocol described in:
6422225e8Sdjm
7422225e8Sdjmhttp://www.openssh.com/txt/draft-ietf-secsh-filexfer-02.txt
8422225e8Sdjm
9f452f5c5SdjmNewer versions of the draft will not be supported, though some features
10f452f5c5Sdjmare individually implemented as extensions described below.
11422225e8Sdjm
12f0c9babeSdjmThe protocol used by OpenSSH's ssh-agent is described in the file
13f0c9babeSdjmPROTOCOL.agent
14f0c9babeSdjm
15f6c05033Sdjm1. Transport protocol changes
16f6c05033Sdjm
17f6c05033Sdjm1.1. transport: Protocol 2 MAC algorithm "umac-64@openssh.com"
18422225e8Sdjm
19422225e8SdjmThis is a new transport-layer MAC method using the UMAC algorithm
20422225e8Sdjm(rfc4418). This method is identical to the "umac-64" method documented
21422225e8Sdjmin:
22422225e8Sdjm
23422225e8Sdjmhttp://www.openssh.com/txt/draft-miller-secsh-umac-01.txt
24422225e8Sdjm
25f6c05033Sdjm1.2. transport: Protocol 2 compression algorithm "zlib@openssh.com"
26422225e8Sdjm
27422225e8SdjmThis transport-layer compression method uses the zlib compression
28422225e8Sdjmalgorithm (identical to the "zlib" method in rfc4253), but delays the
29422225e8Sdjmstart of compression until after authentication has completed. This
3038d4658eSdjmavoids exposing compression code to attacks from unauthenticated users.
31422225e8Sdjm
32422225e8SdjmThe method is documented in:
33422225e8Sdjm
34422225e8Sdjmhttp://www.openssh.com/txt/draft-miller-secsh-compression-delayed-00.txt
35422225e8Sdjm
369d14aae5Sdjm1.3. transport: New public key algorithms "ssh-rsa-cert-v01@openssh.com",
379d14aae5Sdjm     "ssh-dsa-cert-v01@openssh.com",
38f6c05033Sdjm     "ecdsa-sha2-nistp256-cert-v01@openssh.com",
39f6c05033Sdjm     "ecdsa-sha2-nistp384-cert-v01@openssh.com" and
40f6c05033Sdjm     "ecdsa-sha2-nistp521-cert-v01@openssh.com"
41b94e498eSdjm
42f6c05033SdjmOpenSSH introduces new public key algorithms to support certificate
4383fcfd69Sdjmauthentication for users and host keys. These methods are documented
4483fcfd69Sdjmin the file PROTOCOL.certkeys
45b94e498eSdjm
46f6c05033Sdjm1.4. transport: Elliptic Curve cryptography
47f6c05033Sdjm
48f6c05033SdjmOpenSSH supports ECC key exchange and public key authentication as
49f6c05033Sdjmspecified in RFC5656. Only the ecdsa-sha2-nistp256, ecdsa-sha2-nistp384
50f6c05033Sdjmand ecdsa-sha2-nistp521 curves over GF(p) are supported. Elliptic
51f6c05033Sdjmcurve points encoded using point compression are NOT accepted or
52f6c05033Sdjmgenerated.
53f6c05033Sdjm
54c2ea1f0aSmarkus1.5 transport: Protocol 2 Encrypt-then-MAC MAC algorithms
55c2ea1f0aSmarkus
56c2ea1f0aSmarkusOpenSSH supports MAC algorithms, whose names contain "-etm", that
57c2ea1f0aSmarkusperform the calculations in a different order to that defined in RFC
58c2ea1f0aSmarkus4253. These variants use the so-called "encrypt then MAC" ordering,
59c2ea1f0aSmarkuscalculating the MAC over the packet ciphertext rather than the
60c2ea1f0aSmarkusplaintext. This ordering closes a security flaw in the SSH transport
61c2ea1f0aSmarkusprotocol, where decryption of unauthenticated ciphertext provided a
62c2ea1f0aSmarkus"decryption oracle" that could, in conjunction with cipher flaws, reveal
63c2ea1f0aSmarkussession plaintext.
64c2ea1f0aSmarkus
65c2ea1f0aSmarkusSpecifically, the "-etm" MAC algorithms modify the transport protocol
66c2ea1f0aSmarkusto calculate the MAC over the packet ciphertext and to send the packet
67c2ea1f0aSmarkuslength unencrypted. This is necessary for the transport to obtain the
68c2ea1f0aSmarkuslength of the packet and location of the MAC tag so that it may be
69c2ea1f0aSmarkusverified without decrypting unauthenticated data.
70c2ea1f0aSmarkus
71c2ea1f0aSmarkusAs such, the MAC covers:
72c2ea1f0aSmarkus
734ea77511Sdjm      mac = MAC(key, sequence_number || packet_length || encrypted_packet)
74c2ea1f0aSmarkus
754ea77511Sdjmwhere "packet_length" is encoded as a uint32 and "encrypted_packet"
764ea77511Sdjmcontains:
77c2ea1f0aSmarkus
78c2ea1f0aSmarkus      byte      padding_length
79c2ea1f0aSmarkus      byte[n1]  payload; n1 = packet_length - padding_length - 1
80c2ea1f0aSmarkus      byte[n2]  random padding; n2 = padding_length
81c2ea1f0aSmarkus
8247da1b19Smarkus1.6 transport: AES-GCM
8347da1b19Smarkus
8447da1b19SmarkusOpenSSH supports the AES-GCM algorithm as specified in RFC 5647.
8547da1b19SmarkusBecause of problems with the specification of the key exchange
8647da1b19Smarkusthe behaviour of OpenSSH differs from the RFC as follows:
8747da1b19Smarkus
8847da1b19SmarkusAES-GCM is only negotiated as the cipher algorithms
8947da1b19Smarkus"aes128-gcm@openssh.com" or "aes256-gcm@openssh.com" and never as
9047da1b19Smarkusan MAC algorithm. Additionally, if AES-GCM is selected as the cipher
9147da1b19Smarkusthe exchanged MAC algorithms are ignored and there doesn't have to be
9247da1b19Smarkusa matching MAC.
9347da1b19Smarkus
941edbfe23Sdjm1.7 transport: chacha20-poly1305@openssh.com authenticated encryption
951edbfe23Sdjm
961edbfe23SdjmOpenSSH supports authenticated encryption using ChaCha20 and Poly1305
971edbfe23Sdjmas described in PROTOCOL.chacha20poly1305.
981edbfe23Sdjm
99f4da7defSdjm1.8 transport: curve25519-sha256@libssh.org key exchange algorithm
100f4da7defSdjm
101f4da7defSdjmOpenSSH supports the use of ECDH in Curve25519 for key exchange as
102f4da7defSdjmdescribed at:
103f4da7defSdjmhttp://git.libssh.org/users/aris/libssh.git/plain/doc/curve25519-sha256@libssh.org.txt?h=curve25519
104f4da7defSdjm
105f6c05033Sdjm2. Connection protocol changes
106f6c05033Sdjm
107f6c05033Sdjm2.1. connection: Channel write close extension "eow@openssh.com"
108422225e8Sdjm
109422225e8SdjmThe SSH connection protocol (rfc4254) provides the SSH_MSG_CHANNEL_EOF
110422225e8Sdjmmessage to allow an endpoint to signal its peer that it will send no
111422225e8Sdjmmore data over a channel. Unfortunately, there is no symmetric way for
112422225e8Sdjman endpoint to request that its peer should cease sending data to it
113422225e8Sdjmwhile still keeping the channel open for the endpoint to send data to
114422225e8Sdjmthe peer.
115422225e8Sdjm
11638d4658eSdjmThis is desirable, since it saves the transmission of data that would
117422225e8Sdjmotherwise need to be discarded and it allows an endpoint to signal local
118422225e8Sdjmprocesses of the condition, e.g. by closing the corresponding file
119422225e8Sdjmdescriptor.
120422225e8Sdjm
121422225e8SdjmOpenSSH implements a channel extension message to perform this
1227153c228Sdjmsignalling: "eow@openssh.com" (End Of Write). This message is sent by
1237153c228Sdjman endpoint when the local output of a session channel is closed or
1247153c228Sdjmexperiences a write error. The message is formatted as follows:
125422225e8Sdjm
126422225e8Sdjm	byte		SSH_MSG_CHANNEL_REQUEST
127422225e8Sdjm	uint32		recipient channel
128422225e8Sdjm	string		"eow@openssh.com"
129422225e8Sdjm	boolean		FALSE
130422225e8Sdjm
131422225e8SdjmOn receiving this message, the peer SHOULD cease sending data of
132422225e8Sdjmthe channel and MAY signal the process from which the channel data
133422225e8Sdjmoriginates (e.g. by closing its read file descriptor).
134422225e8Sdjm
135422225e8SdjmAs with the symmetric SSH_MSG_CHANNEL_EOF message, the channel does
136422225e8Sdjmremain open after a "eow@openssh.com" has been sent and more data may
137422225e8Sdjmstill be sent in the other direction. This message does not consume
138422225e8Sdjmwindow space and may be sent even if no window space is available.
139422225e8Sdjm
140e187e146SdjmNB. due to certain broken SSH implementations aborting upon receipt
141e187e146Sdjmof this message (in contravention of RFC4254 section 5.4), this
142e187e146Sdjmmessage is only sent to OpenSSH peers (identified by banner).
143e187e146SdjmOther SSH implementations may be whitelisted to receive this message
144e187e146Sdjmupon request.
145e187e146Sdjm
146f6c05033Sdjm2.2. connection: disallow additional sessions extension
14782046f86Sdjm     "no-more-sessions@openssh.com"
14882046f86Sdjm
14982046f86SdjmMost SSH connections will only ever request a single session, but a
15082046f86Sdjmattacker may abuse a running ssh client to surreptitiously open
15182046f86Sdjmadditional sessions under their control. OpenSSH provides a global
15282046f86Sdjmrequest "no-more-sessions@openssh.com" to mitigate this attack.
15382046f86Sdjm
15482046f86SdjmWhen an OpenSSH client expects that it will never open another session
15582046f86Sdjm(i.e. it has been started with connection multiplexing disabled), it
15682046f86Sdjmwill send the following global request:
15782046f86Sdjm
15882046f86Sdjm	byte		SSH_MSG_GLOBAL_REQUEST
15982046f86Sdjm	string		"no-more-sessions@openssh.com"
16082046f86Sdjm	char		want-reply
16182046f86Sdjm
16282046f86SdjmOn receipt of such a message, an OpenSSH server will refuse to open
16382046f86Sdjmfuture channels of type "session" and instead immediately abort the
16482046f86Sdjmconnection.
16582046f86Sdjm
16682046f86SdjmNote that this is not a general defence against compromised clients
16782046f86Sdjm(that is impossible), but it thwarts a simple attack.
16882046f86Sdjm
169e187e146SdjmNB. due to certain broken SSH implementations aborting upon receipt
170e187e146Sdjmof this message, the no-more-sessions request is only sent to OpenSSH
171e187e146Sdjmservers (identified by banner). Other SSH implementations may be
172e187e146Sdjmwhitelisted to receive this message upon request.
173e187e146Sdjm
174f6c05033Sdjm2.3. connection: Tunnel forward extension "tun@openssh.com"
1750afb9521Sdjm
1766c9c8648SdjmOpenSSH supports layer 2 and layer 3 tunnelling via the "tun@openssh.com"
1770afb9521Sdjmchannel type. This channel type supports forwarding of network packets
1786c9c8648Sdjmwith datagram boundaries intact between endpoints equipped with
1790afb9521Sdjminterfaces like the BSD tun(4) device. Tunnel forwarding channels are
1800afb9521Sdjmrequested by the client with the following packet:
1810afb9521Sdjm
1820afb9521Sdjm	byte		SSH_MSG_CHANNEL_OPEN
1830afb9521Sdjm	string		"tun@openssh.com"
1840afb9521Sdjm	uint32		sender channel
1850afb9521Sdjm	uint32		initial window size
1860afb9521Sdjm	uint32		maximum packet size
1870afb9521Sdjm	uint32		tunnel mode
1880afb9521Sdjm	uint32		remote unit number
1890afb9521Sdjm
1900afb9521SdjmThe "tunnel mode" parameter specifies whether the tunnel should forward
1910afb9521Sdjmlayer 2 frames or layer 3 packets. It may take one of the following values:
1920afb9521Sdjm
1930afb9521Sdjm	SSH_TUNMODE_POINTOPOINT  1		/* layer 3 packets */
1940afb9521Sdjm	SSH_TUNMODE_ETHERNET     2		/* layer 2 frames */
1950afb9521Sdjm
1960afb9521SdjmThe "tunnel unit number" specifies the remote interface number, or may
197c880fb56Sdjmbe 0x7fffffff to allow the server to automatically chose an interface. A
198c880fb56Sdjmserver that is not willing to open a client-specified unit should refuse
199c880fb56Sdjmthe request with a SSH_MSG_CHANNEL_OPEN_FAILURE error. On successful
200c880fb56Sdjmopen, the server should reply with SSH_MSG_CHANNEL_OPEN_SUCCESS.
2010afb9521Sdjm
2020afb9521SdjmOnce established the client and server may exchange packet or frames
2030afb9521Sdjmover the tunnel channel by encapsulating them in SSH protocol strings
2040afb9521Sdjmand sending them as channel data. This ensures that packet boundaries
2050afb9521Sdjmare kept intact. Specifically, packets are transmitted using normal
2060afb9521SdjmSSH_MSG_CHANNEL_DATA packets:
2070afb9521Sdjm
2080afb9521Sdjm	byte		SSH_MSG_CHANNEL_DATA
2090afb9521Sdjm	uint32		recipient channel
2100afb9521Sdjm	string		data
2110afb9521Sdjm
2120afb9521SdjmThe contents of the "data" field for layer 3 packets is:
2130afb9521Sdjm
2140afb9521Sdjm	uint32			packet length
2150afb9521Sdjm	uint32			address family
2160afb9521Sdjm	byte[packet length - 4]	packet data
2170afb9521Sdjm
2180afb9521SdjmThe "address family" field identifies the type of packet in the message.
2190afb9521SdjmIt may be one of:
2200afb9521Sdjm
2210afb9521Sdjm	SSH_TUN_AF_INET		2		/* IPv4 */
2220afb9521Sdjm	SSH_TUN_AF_INET6	24		/* IPv6 */
2230afb9521Sdjm
2240afb9521SdjmThe "packet data" field consists of the IPv4/IPv6 datagram itself
2250afb9521Sdjmwithout any link layer header.
2260afb9521Sdjm
227c880fb56SdjmThe contents of the "data" field for layer 2 packets is:
2280afb9521Sdjm
2290afb9521Sdjm	uint32			packet length
2300afb9521Sdjm	byte[packet length]	frame
2310afb9521Sdjm
2326c9c8648SdjmThe "frame" field contains an IEEE 802.3 Ethernet frame, including
2330afb9521Sdjmheader.
2340afb9521Sdjm
235a0215499Smillert2.4. connection: Unix domain socket forwarding
236a0215499Smillert
237a0215499SmillertOpenSSH supports local and remote Unix domain socket forwarding
238a0215499Smillertusing the "streamlocal" extension.  Forwarding is initiated as per
239a0215499SmillertTCP sockets but with a single path instead of a host and port.
240a0215499Smillert
241a0215499SmillertSimilar to direct-tcpip, direct-streamlocal is sent by the client
242a0215499Smillertto request that the server make a connection to a Unix domain socket.
243a0215499Smillert
244a0215499Smillert	byte		SSH_MSG_CHANNEL_OPEN
245a0215499Smillert	string		"direct-streamlocal@openssh.com"
246a0215499Smillert	uint32		sender channel
247a0215499Smillert	uint32		initial window size
248a0215499Smillert	uint32		maximum packet size
249a0215499Smillert	string		socket path
2503e584310Sdjm	string		reserved
2513e584310Sdjm	uint32		reserved
252a0215499Smillert
253a0215499SmillertSimilar to forwarded-tcpip, forwarded-streamlocal is sent by the
254a0215499Smillertserver when the client has previously send the server a streamlocal-forward
255a0215499SmillertGLOBAL_REQUEST.
256a0215499Smillert
257a0215499Smillert	byte		SSH_MSG_CHANNEL_OPEN
258a0215499Smillert	string		"forwarded-streamlocal@openssh.com"
259a0215499Smillert	uint32		sender channel
260a0215499Smillert	uint32		initial window size
261a0215499Smillert	uint32		maximum packet size
262a0215499Smillert	string		socket path
263a0215499Smillert	string		reserved for future use
264a0215499Smillert
265a0215499SmillertThe reserved field is not currently defined and is ignored on the
266a0215499Smillertremote end.  It is intended to be used in the future to pass
267a0215499Smillertinformation about the socket file, such as ownership and mode.
268a0215499SmillertThe client currently sends the empty string for this field.
269a0215499Smillert
270a0215499SmillertSimilar to tcpip-forward, streamlocal-forward is sent by the client
271a0215499Smillertto request remote forwarding of a Unix domain socket.
272a0215499Smillert
273a0215499Smillert	byte		SSH2_MSG_GLOBAL_REQUEST
274a0215499Smillert	string		"streamlocal-forward@openssh.com"
275a0215499Smillert	boolean		TRUE
276a0215499Smillert	string		socket path
277a0215499Smillert
278a0215499SmillertSimilar to cancel-tcpip-forward, cancel-streamlocal-forward is sent
279a0215499Smillertby the client cancel the forwarding of a Unix domain socket.
280a0215499Smillert
281a0215499Smillert	byte		SSH2_MSG_GLOBAL_REQUEST
282a0215499Smillert	string		"cancel-streamlocal-forward@openssh.com"
283a0215499Smillert	boolean		FALSE
284a0215499Smillert	string		socket path
285a0215499Smillert
2863782b423Sdjm2.5. connection: hostkey update and rotation "hostkeys-00@openssh.com"
2873782b423Sdjmand "hostkeys-prove-00@openssh.com"
28806c9be66Sdjm
28906c9be66SdjmOpenSSH supports a protocol extension allowing a server to inform
29006c9be66Sdjma client of all its protocol v.2 host keys after user-authentication
29106c9be66Sdjmhas completed.
29206c9be66Sdjm
29306c9be66Sdjm	byte		SSH_MSG_GLOBAL_REQUEST
2943782b423Sdjm	string		"hostkeys-00@openssh.com"
29506c9be66Sdjm	string[]	hostkeys
29606c9be66Sdjm
29783fcfd69SdjmUpon receiving this message, a client should check which of the
298*61185547Sdjmsupplied host keys are present in known_hosts.
299*61185547Sdjm
300*61185547SdjmNote that the server may send key types that the client does not
301*61185547Sdjmsupport. The client should disgregard such keys if they are received.
302*61185547Sdjm
303*61185547SdjmIf the client identifies any keys that are not present for the host,
304*61185547Sdjmit should send a "hostkeys-prove@openssh.com" message to request the
305*61185547Sdjmserver prove ownership of the private half of the key.
30606c9be66Sdjm
30783fcfd69Sdjm	byte		SSH_MSG_GLOBAL_REQUEST
3083782b423Sdjm	string		"hostkeys-prove-00@openssh.com"
30983fcfd69Sdjm	char		1 /* want-reply */
31083fcfd69Sdjm	string[]	hostkeys
31183fcfd69Sdjm
31283fcfd69SdjmWhen a server receives this message, it should generate a signature
31383fcfd69Sdjmusing each requested key over the following:
31483fcfd69Sdjm
3153782b423Sdjm	string		"hostkeys-prove-00@openssh.com"
31683fcfd69Sdjm	string		session identifier
31783fcfd69Sdjm	string		hostkey
31883fcfd69Sdjm
31983fcfd69SdjmThese signatures should be included in the reply, in the order matching
32083fcfd69Sdjmthe hostkeys in the request:
32183fcfd69Sdjm
32283fcfd69Sdjm	byte		SSH_MSG_REQUEST_SUCCESS
32383fcfd69Sdjm	string[]	signatures
32483fcfd69Sdjm
32583fcfd69SdjmWhen the client receives this reply (and not a failure), it should
32683fcfd69Sdjmvalidate the signatures and may update its known_hosts file, adding keys
32783fcfd69Sdjmthat it has not seen before and deleting keys for the server host that
32883fcfd69Sdjmare no longer offered.
32983fcfd69Sdjm
33083fcfd69SdjmThese extensions let a client learn key types that it had not previously
33183fcfd69Sdjmencountered, thereby allowing it to potentially upgrade from weaker
33283fcfd69Sdjmkey algorithms to better ones. It also supports graceful key rotation:
33383fcfd69Sdjma server may offer multiple keys of the same type for a period (to
33483fcfd69Sdjmgive clients an opportunity to learn them using this extension) before
33583fcfd69Sdjmremoving the deprecated key from those offered.
33606c9be66Sdjm
337f6c05033Sdjm3. SFTP protocol changes
338f6c05033Sdjm
339f6c05033Sdjm3.1. sftp: Reversal of arguments to SSH_FXP_SYMLINK
340422225e8Sdjm
341422225e8SdjmWhen OpenSSH's sftp-server was implemented, the order of the arguments
3426c9c8648Sdjmto the SSH_FXP_SYMLINK method was inadvertently reversed. Unfortunately,
343422225e8Sdjmthe reversal was not noticed until the server was widely deployed. Since
344422225e8Sdjmfixing this to follow the specification would cause incompatibility, the
345422225e8Sdjmcurrent order was retained. For correct operation, clients should send
346422225e8SdjmSSH_FXP_SYMLINK as follows:
347422225e8Sdjm
348422225e8Sdjm	uint32		id
349422225e8Sdjm	string		targetpath
350422225e8Sdjm	string		linkpath
351422225e8Sdjm
352f6c05033Sdjm3.2. sftp: Server extension announcement in SSH_FXP_VERSION
353422225e8Sdjm
354422225e8SdjmOpenSSH's sftp-server lists the extensions it supports using the
355422225e8Sdjmstandard extension announcement mechanism in the SSH_FXP_VERSION server
356422225e8Sdjmhello packet:
357422225e8Sdjm
358422225e8Sdjm	uint32		3		/* protocol version */
359422225e8Sdjm	string		ext1-name
360422225e8Sdjm	string		ext1-version
361422225e8Sdjm	string		ext2-name
362422225e8Sdjm	string		ext2-version
363422225e8Sdjm	...
364422225e8Sdjm	string		extN-name
365422225e8Sdjm	string		extN-version
366422225e8Sdjm
367422225e8SdjmEach extension reports its integer version number as an ASCII encoded
368422225e8Sdjmstring, e.g. "1". The version will be incremented if the extension is
369422225e8Sdjmever changed in an incompatible way. The server MAY advertise the same
370422225e8Sdjmextension with multiple versions (though this is unlikely). Clients MUST
3716c9c8648Sdjmcheck the version number before attempting to use the extension.
372422225e8Sdjm
373f6c05033Sdjm3.3. sftp: Extension request "posix-rename@openssh.com"
374422225e8Sdjm
375422225e8SdjmThis operation provides a rename operation with POSIX semantics, which
376422225e8Sdjmare different to those provided by the standard SSH_FXP_RENAME in
377422225e8Sdjmdraft-ietf-secsh-filexfer-02.txt. This request is implemented as a
378422225e8SdjmSSH_FXP_EXTENDED request with the following format:
379422225e8Sdjm
380422225e8Sdjm	uint32		id
381422225e8Sdjm	string		"posix-rename@openssh.com"
382422225e8Sdjm	string		oldpath
383422225e8Sdjm	string		newpath
384422225e8Sdjm
385422225e8SdjmOn receiving this request the server will perform the POSIX operation
386422225e8Sdjmrename(oldpath, newpath) and will respond with a SSH_FXP_STATUS message.
387422225e8SdjmThis extension is advertised in the SSH_FXP_VERSION hello with version
388422225e8Sdjm"1".
389422225e8Sdjm
390f6c05033Sdjm3.4. sftp: Extension requests "statvfs@openssh.com" and
391422225e8Sdjm         "fstatvfs@openssh.com"
392422225e8Sdjm
393422225e8SdjmThese requests correspond to the statvfs and fstatvfs POSIX system
394422225e8Sdjminterfaces. The "statvfs@openssh.com" request operates on an explicit
395422225e8Sdjmpathname, and is formatted as follows:
396422225e8Sdjm
397422225e8Sdjm	uint32		id
398422225e8Sdjm	string		"statvfs@openssh.com"
399422225e8Sdjm	string		path
400422225e8Sdjm
401422225e8SdjmThe "fstatvfs@openssh.com" operates on an open file handle:
402422225e8Sdjm
403422225e8Sdjm	uint32		id
40438d4658eSdjm	string		"fstatvfs@openssh.com"
405422225e8Sdjm	string		handle
406422225e8Sdjm
407422225e8SdjmThese requests return a SSH_FXP_STATUS reply on failure. On success they
408422225e8Sdjmreturn the following SSH_FXP_EXTENDED_REPLY reply:
409422225e8Sdjm
410422225e8Sdjm	uint32		id
411f00164cfSdtucker	uint64		f_bsize		/* file system block size */
412f00164cfSdtucker	uint64		f_frsize	/* fundamental fs block size */
413422225e8Sdjm	uint64		f_blocks	/* number of blocks (unit f_frsize) */
414422225e8Sdjm	uint64		f_bfree		/* free blocks in file system */
415422225e8Sdjm	uint64		f_bavail	/* free blocks for non-root */
416422225e8Sdjm	uint64		f_files		/* total file inodes */
417422225e8Sdjm	uint64		f_ffree		/* free file inodes */
418422225e8Sdjm	uint64		f_favail	/* free file inodes for to non-root */
41933745cbfSdjm	uint64		f_fsid		/* file system id */
420f00164cfSdtucker	uint64		f_flag		/* bit mask of f_flag values */
421f00164cfSdtucker	uint64		f_namemax	/* maximum filename length */
422422225e8Sdjm
423422225e8SdjmThe values of the f_flag bitmask are as follows:
424422225e8Sdjm
425422225e8Sdjm	#define SSH_FXE_STATVFS_ST_RDONLY	0x1	/* read-only */
426422225e8Sdjm	#define SSH_FXE_STATVFS_ST_NOSUID	0x2	/* no setuid */
427422225e8Sdjm
428fae5684aSdjmBoth the "statvfs@openssh.com" and "fstatvfs@openssh.com" extensions are
429fae5684aSdjmadvertised in the SSH_FXP_VERSION hello with version "2".
43033745cbfSdjm
4319c120764Sdjm10. sftp: Extension request "hardlink@openssh.com"
4329c120764Sdjm
4339c120764SdjmThis request is for creating a hard link to a regular file. This
4349c120764Sdjmrequest is implemented as a SSH_FXP_EXTENDED request with the
4359c120764Sdjmfollowing format:
4369c120764Sdjm
4379c120764Sdjm	uint32		id
4389c120764Sdjm	string		"hardlink@openssh.com"
4399c120764Sdjm	string		oldpath
4409c120764Sdjm	string		newpath
4419c120764Sdjm
4429c120764SdjmOn receiving this request the server will perform the operation
4439c120764Sdjmlink(oldpath, newpath) and will respond with a SSH_FXP_STATUS message.
4449c120764SdjmThis extension is advertised in the SSH_FXP_VERSION hello with version
4459c120764Sdjm"1".
4469c120764Sdjm
44794e35841Sdjm10. sftp: Extension request "fsync@openssh.com"
44894e35841Sdjm
44994e35841SdjmThis request asks the server to call fsync(2) on an open file handle.
45094e35841Sdjm
45194e35841Sdjm	uint32		id
45294e35841Sdjm	string		"fsync@openssh.com"
45394e35841Sdjm	string		handle
45494e35841Sdjm
45594e35841SdjmOne receiving this request, a server will call fsync(handle_fd) and will
45694e35841Sdjmrespond with a SSH_FXP_STATUS message.
45794e35841Sdjm
45894e35841SdjmThis extension is advertised in the SSH_FXP_VERSION hello with version
45994e35841Sdjm"1".
46094e35841Sdjm
461*61185547Sdjm$OpenBSD: PROTOCOL,v 1.32 2018/02/19 00:55:02 djm Exp $
462