1d4af9e69SDag-Erling SmørgravThis documents OpenSSH's deviations and extensions to the published SSH 2d4af9e69SDag-Erling Smørgravprotocol. 3d4af9e69SDag-Erling Smørgrav 4d4af9e69SDag-Erling SmørgravNote that OpenSSH's sftp and sftp-server implement revision 3 of the SSH 5d4af9e69SDag-Erling Smørgravfilexfer protocol described in: 6d4af9e69SDag-Erling Smørgrav 7ca86bcf2SDag-Erling Smørgravhttps://www.openssh.com/txt/draft-ietf-secsh-filexfer-02.txt 8d4af9e69SDag-Erling Smørgrav 9b15c8340SDag-Erling SmørgravNewer versions of the draft will not be supported, though some features 10b15c8340SDag-Erling Smørgravare individually implemented as extensions described below. 11d4af9e69SDag-Erling Smørgrav 12d4af9e69SDag-Erling SmørgravThe protocol used by OpenSSH's ssh-agent is described in the file 13d4af9e69SDag-Erling SmørgravPROTOCOL.agent 14d4af9e69SDag-Erling Smørgrav 154a421b63SDag-Erling Smørgrav1. Transport protocol changes 164a421b63SDag-Erling Smørgrav 174a421b63SDag-Erling Smørgrav1.1. transport: Protocol 2 MAC algorithm "umac-64@openssh.com" 18d4af9e69SDag-Erling Smørgrav 19d4af9e69SDag-Erling SmørgravThis is a new transport-layer MAC method using the UMAC algorithm 20d4af9e69SDag-Erling Smørgrav(rfc4418). This method is identical to the "umac-64" method documented 21d4af9e69SDag-Erling Smørgravin: 22d4af9e69SDag-Erling Smørgrav 23ca86bcf2SDag-Erling Smørgravhttps://www.openssh.com/txt/draft-miller-secsh-umac-01.txt 24d4af9e69SDag-Erling Smørgrav 254a421b63SDag-Erling Smørgrav1.2. transport: Protocol 2 compression algorithm "zlib@openssh.com" 26d4af9e69SDag-Erling Smørgrav 27d4af9e69SDag-Erling SmørgravThis transport-layer compression method uses the zlib compression 28d4af9e69SDag-Erling Smørgravalgorithm (identical to the "zlib" method in rfc4253), but delays the 29d4af9e69SDag-Erling Smørgravstart of compression until after authentication has completed. This 30d4af9e69SDag-Erling Smørgravavoids exposing compression code to attacks from unauthenticated users. 31d4af9e69SDag-Erling Smørgrav 32d4af9e69SDag-Erling SmørgravThe method is documented in: 33d4af9e69SDag-Erling Smørgrav 34ca86bcf2SDag-Erling Smørgravhttps://www.openssh.com/txt/draft-miller-secsh-compression-delayed-00.txt 35d4af9e69SDag-Erling Smørgrav 364f52dfbbSDag-Erling Smørgrav1.3. transport: New public key algorithms "ssh-rsa-cert-v01@openssh.com", 374f52dfbbSDag-Erling Smørgrav "ssh-dsa-cert-v01@openssh.com", 384a421b63SDag-Erling Smørgrav "ecdsa-sha2-nistp256-cert-v01@openssh.com", 394a421b63SDag-Erling Smørgrav "ecdsa-sha2-nistp384-cert-v01@openssh.com" and 404a421b63SDag-Erling Smørgrav "ecdsa-sha2-nistp521-cert-v01@openssh.com" 41b15c8340SDag-Erling Smørgrav 424a421b63SDag-Erling SmørgravOpenSSH introduces new public key algorithms to support certificate 43bc5531deSDag-Erling Smørgravauthentication for users and host keys. These methods are documented 44bc5531deSDag-Erling Smørgravin the file PROTOCOL.certkeys 45b15c8340SDag-Erling Smørgrav 464a421b63SDag-Erling Smørgrav1.4. transport: Elliptic Curve cryptography 474a421b63SDag-Erling Smørgrav 484a421b63SDag-Erling SmørgravOpenSSH supports ECC key exchange and public key authentication as 494a421b63SDag-Erling Smørgravspecified in RFC5656. Only the ecdsa-sha2-nistp256, ecdsa-sha2-nistp384 504a421b63SDag-Erling Smørgravand ecdsa-sha2-nistp521 curves over GF(p) are supported. Elliptic 514a421b63SDag-Erling Smørgravcurve points encoded using point compression are NOT accepted or 524a421b63SDag-Erling Smørgravgenerated. 534a421b63SDag-Erling Smørgrav 546888a9beSDag-Erling Smørgrav1.5 transport: Protocol 2 Encrypt-then-MAC MAC algorithms 556888a9beSDag-Erling Smørgrav 566888a9beSDag-Erling SmørgravOpenSSH supports MAC algorithms, whose names contain "-etm", that 576888a9beSDag-Erling Smørgravperform the calculations in a different order to that defined in RFC 586888a9beSDag-Erling Smørgrav4253. These variants use the so-called "encrypt then MAC" ordering, 596888a9beSDag-Erling Smørgravcalculating the MAC over the packet ciphertext rather than the 606888a9beSDag-Erling Smørgravplaintext. This ordering closes a security flaw in the SSH transport 616888a9beSDag-Erling Smørgravprotocol, where decryption of unauthenticated ciphertext provided a 626888a9beSDag-Erling Smørgrav"decryption oracle" that could, in conjunction with cipher flaws, reveal 636888a9beSDag-Erling Smørgravsession plaintext. 646888a9beSDag-Erling Smørgrav 656888a9beSDag-Erling SmørgravSpecifically, the "-etm" MAC algorithms modify the transport protocol 666888a9beSDag-Erling Smørgravto calculate the MAC over the packet ciphertext and to send the packet 676888a9beSDag-Erling Smørgravlength unencrypted. This is necessary for the transport to obtain the 686888a9beSDag-Erling Smørgravlength of the packet and location of the MAC tag so that it may be 696888a9beSDag-Erling Smørgravverified without decrypting unauthenticated data. 706888a9beSDag-Erling Smørgrav 716888a9beSDag-Erling SmørgravAs such, the MAC covers: 726888a9beSDag-Erling Smørgrav 736888a9beSDag-Erling Smørgrav mac = MAC(key, sequence_number || packet_length || encrypted_packet) 746888a9beSDag-Erling Smørgrav 756888a9beSDag-Erling Smørgravwhere "packet_length" is encoded as a uint32 and "encrypted_packet" 766888a9beSDag-Erling Smørgravcontains: 776888a9beSDag-Erling Smørgrav 786888a9beSDag-Erling Smørgrav byte padding_length 796888a9beSDag-Erling Smørgrav byte[n1] payload; n1 = packet_length - padding_length - 1 806888a9beSDag-Erling Smørgrav byte[n2] random padding; n2 = padding_length 816888a9beSDag-Erling Smørgrav 826888a9beSDag-Erling Smørgrav1.6 transport: AES-GCM 836888a9beSDag-Erling Smørgrav 846888a9beSDag-Erling SmørgravOpenSSH supports the AES-GCM algorithm as specified in RFC 5647. 856888a9beSDag-Erling SmørgravBecause of problems with the specification of the key exchange 866888a9beSDag-Erling Smørgravthe behaviour of OpenSSH differs from the RFC as follows: 876888a9beSDag-Erling Smørgrav 886888a9beSDag-Erling SmørgravAES-GCM is only negotiated as the cipher algorithms 896888a9beSDag-Erling Smørgrav"aes128-gcm@openssh.com" or "aes256-gcm@openssh.com" and never as 906888a9beSDag-Erling Smørgravan MAC algorithm. Additionally, if AES-GCM is selected as the cipher 916888a9beSDag-Erling Smørgravthe exchanged MAC algorithms are ignored and there doesn't have to be 926888a9beSDag-Erling Smørgrava matching MAC. 936888a9beSDag-Erling Smørgrav 94f7167e0eSDag-Erling Smørgrav1.7 transport: chacha20-poly1305@openssh.com authenticated encryption 95f7167e0eSDag-Erling Smørgrav 96f7167e0eSDag-Erling SmørgravOpenSSH supports authenticated encryption using ChaCha20 and Poly1305 97f7167e0eSDag-Erling Smørgravas described in PROTOCOL.chacha20poly1305. 98f7167e0eSDag-Erling Smørgrav 99f7167e0eSDag-Erling Smørgrav1.8 transport: curve25519-sha256@libssh.org key exchange algorithm 100f7167e0eSDag-Erling Smørgrav 101f7167e0eSDag-Erling SmørgravOpenSSH supports the use of ECDH in Curve25519 for key exchange as 102f7167e0eSDag-Erling Smørgravdescribed at: 103f7167e0eSDag-Erling Smørgravhttp://git.libssh.org/users/aris/libssh.git/plain/doc/curve25519-sha256@libssh.org.txt?h=curve25519 104f7167e0eSDag-Erling Smørgrav 10538a52bd3SEd MasteThis is identical to curve25519-sha256 as later published in RFC8731. 10638a52bd3SEd Maste 107edf85781SEd Maste1.9 transport: ping facility 108edf85781SEd Maste 109edf85781SEd MasteOpenSSH implements a transport level ping message SSH2_MSG_PING 110edf85781SEd Masteand a corresponding SSH2_MSG_PONG reply. 111edf85781SEd Maste 112edf85781SEd Maste#define SSH2_MSG_PING 192 113edf85781SEd Maste#define SSH2_MSG_PONG 193 114edf85781SEd Maste 115edf85781SEd MasteThe ping message is simply: 116edf85781SEd Maste 117edf85781SEd Maste byte SSH_MSG_PING 118edf85781SEd Maste string data 119edf85781SEd Maste 120edf85781SEd MasteThe reply copies the data (which may be the empty string) from the 121edf85781SEd Masteping: 122edf85781SEd Maste 123edf85781SEd Maste byte SSH_MSG_PONG 124edf85781SEd Maste string data 125edf85781SEd Maste 126edf85781SEd MasteReplies are sent in order. They are sent immediately except when rekeying 127edf85781SEd Masteis in progress, in which case they are queued until rekeying completes. 128edf85781SEd Maste 129edf85781SEd MasteThe server advertises support for these messages using the 130edf85781SEd MasteSSH2_MSG_EXT_INFO mechanism (RFC8308), with the following message: 131edf85781SEd Maste 132edf85781SEd Maste string "ping@openssh.com" 133edf85781SEd Maste string "0" (version) 134edf85781SEd Maste 135edf85781SEd MasteThe ping/reply message is implemented at the transport layer rather 136edf85781SEd Mastethan as a named global or channel request to allow pings with very 137edf85781SEd Masteshort packet lengths, which would not be possible with other 138edf85781SEd Masteapproaches. 139edf85781SEd Maste 140069ac184SEd Maste1.10 transport: strict key exchange extension 14192f58c69SGordon Tetlow 14292f58c69SGordon TetlowOpenSSH supports a number of transport-layer hardening measures under 14392f58c69SGordon Tetlowa "strict KEX" feature. This feature is signalled similarly to the 14492f58c69SGordon TetlowRFC8308 ext-info feature: by including a additional algorithm in the 145*a91a2465SEd Masteinitial SSH2_MSG_KEXINIT kex_algorithms field. The client may append 14692f58c69SGordon Tetlow"kex-strict-c-v00@openssh.com" to its kex_algorithms and the server 14792f58c69SGordon Tetlowmay append "kex-strict-s-v00@openssh.com". These pseudo-algorithms 14892f58c69SGordon Tetloware only valid in the initial SSH2_MSG_KEXINIT and MUST be ignored 14992f58c69SGordon Tetlowif they are present in subsequent SSH2_MSG_KEXINIT packets. 15092f58c69SGordon Tetlow 15192f58c69SGordon TetlowWhen an endpoint that supports this extension observes this algorithm 15292f58c69SGordon Tetlowname in a peer's KEXINIT packet, it MUST make the following changes to 153*a91a2465SEd Mastethe protocol: 15492f58c69SGordon Tetlow 155*a91a2465SEd Mastea) During initial KEX, terminate the connection if out-of-sequence 156*a91a2465SEd Maste packet or any message that is not strictly required by KEX is 157*a91a2465SEd Maste received. This includes terminating the connection if the first 158*a91a2465SEd Maste packet received is not SSH2_MSG_KEXINIT. Unexpected packets for 159*a91a2465SEd Maste the purpose of strict KEX include messages that are otherwise 160*a91a2465SEd Maste valid at any time during the connection such as SSH2_MSG_DEBUG, 161*a91a2465SEd Maste SSH2_MSG_IGNORE or SSH2_MSG_UNIMPLEMENTED. 16292f58c69SGordon Tetlowb) After sending or receiving a SSH2_MSG_NEWKEYS message, reset the 16392f58c69SGordon Tetlow packet sequence number to zero. This behaviour persists for the 16492f58c69SGordon Tetlow duration of the connection (i.e. not just the first 16592f58c69SGordon Tetlow SSH2_MSG_NEWKEYS). 16692f58c69SGordon Tetlow 167069ac184SEd Maste1.11 transport: SSH2_MSG_EXT_INFO during user authentication 168069ac184SEd Maste 169069ac184SEd MasteThis protocol extension allows the SSH2_MSG_EXT_INFO to be sent 170069ac184SEd Masteduring user authentication. RFC8308 does allow a second 171069ac184SEd MasteSSH2_MSG_EXT_INFO notification, but it may only be sent at the end 172069ac184SEd Masteof user authentication and this is too late to signal per-user 173069ac184SEd Masteserver signature algorithms. 174069ac184SEd Maste 175069ac184SEd MasteSupport for receiving the SSH2_MSG_EXT_INFO message during user 176069ac184SEd Masteauthentication is signalled by the client including a 177069ac184SEd Maste"ext-info-in-auth@openssh.com" key via its initial SSH2_MSG_EXT_INFO 178069ac184SEd Masteset after the SSH2_MSG_NEWKEYS message. 179069ac184SEd Maste 180069ac184SEd MasteA server that supports this extension MAY send a second 181069ac184SEd MasteSSH2_MSG_EXT_INFO message any time after the client's first 182069ac184SEd MasteSSH2_MSG_USERAUTH_REQUEST, regardless of whether it succeed or fails. 183069ac184SEd MasteThe client SHOULD be prepared to update the server-sig-algs that 184069ac184SEd Masteit received during an earlier SSH2_MSG_EXT_INFO with the later one. 185069ac184SEd Maste 1864a421b63SDag-Erling Smørgrav2. Connection protocol changes 1874a421b63SDag-Erling Smørgrav 1884a421b63SDag-Erling Smørgrav2.1. connection: Channel write close extension "eow@openssh.com" 189d4af9e69SDag-Erling Smørgrav 190d4af9e69SDag-Erling SmørgravThe SSH connection protocol (rfc4254) provides the SSH_MSG_CHANNEL_EOF 191d4af9e69SDag-Erling Smørgravmessage to allow an endpoint to signal its peer that it will send no 192d4af9e69SDag-Erling Smørgravmore data over a channel. Unfortunately, there is no symmetric way for 193d4af9e69SDag-Erling Smørgravan endpoint to request that its peer should cease sending data to it 194d4af9e69SDag-Erling Smørgravwhile still keeping the channel open for the endpoint to send data to 195d4af9e69SDag-Erling Smørgravthe peer. 196d4af9e69SDag-Erling Smørgrav 197d4af9e69SDag-Erling SmørgravThis is desirable, since it saves the transmission of data that would 198d4af9e69SDag-Erling Smørgravotherwise need to be discarded and it allows an endpoint to signal local 199d4af9e69SDag-Erling Smørgravprocesses of the condition, e.g. by closing the corresponding file 200d4af9e69SDag-Erling Smørgravdescriptor. 201d4af9e69SDag-Erling Smørgrav 202d4af9e69SDag-Erling SmørgravOpenSSH implements a channel extension message to perform this 203d4af9e69SDag-Erling Smørgravsignalling: "eow@openssh.com" (End Of Write). This message is sent by 204d4af9e69SDag-Erling Smørgravan endpoint when the local output of a session channel is closed or 205d4af9e69SDag-Erling Smørgravexperiences a write error. The message is formatted as follows: 206d4af9e69SDag-Erling Smørgrav 207d4af9e69SDag-Erling Smørgrav byte SSH_MSG_CHANNEL_REQUEST 208d4af9e69SDag-Erling Smørgrav uint32 recipient channel 209d4af9e69SDag-Erling Smørgrav string "eow@openssh.com" 210d4af9e69SDag-Erling Smørgrav boolean FALSE 211d4af9e69SDag-Erling Smørgrav 212d4af9e69SDag-Erling SmørgravOn receiving this message, the peer SHOULD cease sending data of 213d4af9e69SDag-Erling Smørgravthe channel and MAY signal the process from which the channel data 214d4af9e69SDag-Erling Smørgravoriginates (e.g. by closing its read file descriptor). 215d4af9e69SDag-Erling Smørgrav 216d4af9e69SDag-Erling SmørgravAs with the symmetric SSH_MSG_CHANNEL_EOF message, the channel does 217d4af9e69SDag-Erling Smørgravremain open after a "eow@openssh.com" has been sent and more data may 218d4af9e69SDag-Erling Smørgravstill be sent in the other direction. This message does not consume 219d4af9e69SDag-Erling Smørgravwindow space and may be sent even if no window space is available. 220d4af9e69SDag-Erling Smørgrav 221cce7d346SDag-Erling SmørgravNB. due to certain broken SSH implementations aborting upon receipt 222cce7d346SDag-Erling Smørgravof this message (in contravention of RFC4254 section 5.4), this 223cce7d346SDag-Erling Smørgravmessage is only sent to OpenSSH peers (identified by banner). 22419261079SEd MasteOther SSH implementations may be listed to receive this message 225cce7d346SDag-Erling Smørgravupon request. 226cce7d346SDag-Erling Smørgrav 2274a421b63SDag-Erling Smørgrav2.2. connection: disallow additional sessions extension 228d4af9e69SDag-Erling Smørgrav "no-more-sessions@openssh.com" 229d4af9e69SDag-Erling Smørgrav 230d4af9e69SDag-Erling SmørgravMost SSH connections will only ever request a single session, but a 231d4af9e69SDag-Erling Smørgravattacker may abuse a running ssh client to surreptitiously open 232d4af9e69SDag-Erling Smørgravadditional sessions under their control. OpenSSH provides a global 233d4af9e69SDag-Erling Smørgravrequest "no-more-sessions@openssh.com" to mitigate this attack. 234d4af9e69SDag-Erling Smørgrav 235d4af9e69SDag-Erling SmørgravWhen an OpenSSH client expects that it will never open another session 236d4af9e69SDag-Erling Smørgrav(i.e. it has been started with connection multiplexing disabled), it 237d4af9e69SDag-Erling Smørgravwill send the following global request: 238d4af9e69SDag-Erling Smørgrav 239d4af9e69SDag-Erling Smørgrav byte SSH_MSG_GLOBAL_REQUEST 240d4af9e69SDag-Erling Smørgrav string "no-more-sessions@openssh.com" 241d4af9e69SDag-Erling Smørgrav char want-reply 242d4af9e69SDag-Erling Smørgrav 243d4af9e69SDag-Erling SmørgravOn receipt of such a message, an OpenSSH server will refuse to open 244d4af9e69SDag-Erling Smørgravfuture channels of type "session" and instead immediately abort the 245d4af9e69SDag-Erling Smørgravconnection. 246d4af9e69SDag-Erling Smørgrav 247d4af9e69SDag-Erling SmørgravNote that this is not a general defence against compromised clients 248d4af9e69SDag-Erling Smørgrav(that is impossible), but it thwarts a simple attack. 249d4af9e69SDag-Erling Smørgrav 250cce7d346SDag-Erling SmørgravNB. due to certain broken SSH implementations aborting upon receipt 251cce7d346SDag-Erling Smørgravof this message, the no-more-sessions request is only sent to OpenSSH 252cce7d346SDag-Erling Smørgravservers (identified by banner). Other SSH implementations may be 25319261079SEd Mastelisted to receive this message upon request. 254cce7d346SDag-Erling Smørgrav 2554a421b63SDag-Erling Smørgrav2.3. connection: Tunnel forward extension "tun@openssh.com" 256d4af9e69SDag-Erling Smørgrav 257d4af9e69SDag-Erling SmørgravOpenSSH supports layer 2 and layer 3 tunnelling via the "tun@openssh.com" 258d4af9e69SDag-Erling Smørgravchannel type. This channel type supports forwarding of network packets 259d4af9e69SDag-Erling Smørgravwith datagram boundaries intact between endpoints equipped with 260d4af9e69SDag-Erling Smørgravinterfaces like the BSD tun(4) device. Tunnel forwarding channels are 261d4af9e69SDag-Erling Smørgravrequested by the client with the following packet: 262d4af9e69SDag-Erling Smørgrav 263d4af9e69SDag-Erling Smørgrav byte SSH_MSG_CHANNEL_OPEN 264d4af9e69SDag-Erling Smørgrav string "tun@openssh.com" 265d4af9e69SDag-Erling Smørgrav uint32 sender channel 266d4af9e69SDag-Erling Smørgrav uint32 initial window size 267d4af9e69SDag-Erling Smørgrav uint32 maximum packet size 268d4af9e69SDag-Erling Smørgrav uint32 tunnel mode 269d4af9e69SDag-Erling Smørgrav uint32 remote unit number 270d4af9e69SDag-Erling Smørgrav 271d4af9e69SDag-Erling SmørgravThe "tunnel mode" parameter specifies whether the tunnel should forward 272d4af9e69SDag-Erling Smørgravlayer 2 frames or layer 3 packets. It may take one of the following values: 273d4af9e69SDag-Erling Smørgrav 274d4af9e69SDag-Erling Smørgrav SSH_TUNMODE_POINTOPOINT 1 /* layer 3 packets */ 275d4af9e69SDag-Erling Smørgrav SSH_TUNMODE_ETHERNET 2 /* layer 2 frames */ 276d4af9e69SDag-Erling Smørgrav 277d4af9e69SDag-Erling SmørgravThe "tunnel unit number" specifies the remote interface number, or may 27819261079SEd Mastebe 0x7fffffff to allow the server to automatically choose an interface. A 279b15c8340SDag-Erling Smørgravserver that is not willing to open a client-specified unit should refuse 280b15c8340SDag-Erling Smørgravthe request with a SSH_MSG_CHANNEL_OPEN_FAILURE error. On successful 281b15c8340SDag-Erling Smørgravopen, the server should reply with SSH_MSG_CHANNEL_OPEN_SUCCESS. 282d4af9e69SDag-Erling Smørgrav 283d4af9e69SDag-Erling SmørgravOnce established the client and server may exchange packet or frames 284d4af9e69SDag-Erling Smørgravover the tunnel channel by encapsulating them in SSH protocol strings 285d4af9e69SDag-Erling Smørgravand sending them as channel data. This ensures that packet boundaries 286d4af9e69SDag-Erling Smørgravare kept intact. Specifically, packets are transmitted using normal 287d4af9e69SDag-Erling SmørgravSSH_MSG_CHANNEL_DATA packets: 288d4af9e69SDag-Erling Smørgrav 289d4af9e69SDag-Erling Smørgrav byte SSH_MSG_CHANNEL_DATA 290d4af9e69SDag-Erling Smørgrav uint32 recipient channel 291d4af9e69SDag-Erling Smørgrav string data 292d4af9e69SDag-Erling Smørgrav 293d4af9e69SDag-Erling SmørgravThe contents of the "data" field for layer 3 packets is: 294d4af9e69SDag-Erling Smørgrav 295d4af9e69SDag-Erling Smørgrav uint32 packet length 296d4af9e69SDag-Erling Smørgrav uint32 address family 297d4af9e69SDag-Erling Smørgrav byte[packet length - 4] packet data 298d4af9e69SDag-Erling Smørgrav 299d4af9e69SDag-Erling SmørgravThe "address family" field identifies the type of packet in the message. 300d4af9e69SDag-Erling SmørgravIt may be one of: 301d4af9e69SDag-Erling Smørgrav 302d4af9e69SDag-Erling Smørgrav SSH_TUN_AF_INET 2 /* IPv4 */ 303d4af9e69SDag-Erling Smørgrav SSH_TUN_AF_INET6 24 /* IPv6 */ 304d4af9e69SDag-Erling Smørgrav 305d4af9e69SDag-Erling SmørgravThe "packet data" field consists of the IPv4/IPv6 datagram itself 306d4af9e69SDag-Erling Smørgravwithout any link layer header. 307d4af9e69SDag-Erling Smørgrav 308b15c8340SDag-Erling SmørgravThe contents of the "data" field for layer 2 packets is: 309d4af9e69SDag-Erling Smørgrav 310d4af9e69SDag-Erling Smørgrav uint32 packet length 311d4af9e69SDag-Erling Smørgrav byte[packet length] frame 312d4af9e69SDag-Erling Smørgrav 313d4af9e69SDag-Erling SmørgravThe "frame" field contains an IEEE 802.3 Ethernet frame, including 314d4af9e69SDag-Erling Smørgravheader. 315d4af9e69SDag-Erling Smørgrav 316a0ee8cc6SDag-Erling Smørgrav2.4. connection: Unix domain socket forwarding 317a0ee8cc6SDag-Erling Smørgrav 318a0ee8cc6SDag-Erling SmørgravOpenSSH supports local and remote Unix domain socket forwarding 319a0ee8cc6SDag-Erling Smørgravusing the "streamlocal" extension. Forwarding is initiated as per 320a0ee8cc6SDag-Erling SmørgravTCP sockets but with a single path instead of a host and port. 321a0ee8cc6SDag-Erling Smørgrav 322a0ee8cc6SDag-Erling SmørgravSimilar to direct-tcpip, direct-streamlocal is sent by the client 323a0ee8cc6SDag-Erling Smørgravto request that the server make a connection to a Unix domain socket. 324a0ee8cc6SDag-Erling Smørgrav 325a0ee8cc6SDag-Erling Smørgrav byte SSH_MSG_CHANNEL_OPEN 326a0ee8cc6SDag-Erling Smørgrav string "direct-streamlocal@openssh.com" 327a0ee8cc6SDag-Erling Smørgrav uint32 sender channel 328a0ee8cc6SDag-Erling Smørgrav uint32 initial window size 329a0ee8cc6SDag-Erling Smørgrav uint32 maximum packet size 330a0ee8cc6SDag-Erling Smørgrav string socket path 331076ad2f8SDag-Erling Smørgrav string reserved 332076ad2f8SDag-Erling Smørgrav uint32 reserved 333a0ee8cc6SDag-Erling Smørgrav 334a0ee8cc6SDag-Erling SmørgravSimilar to forwarded-tcpip, forwarded-streamlocal is sent by the 335a0ee8cc6SDag-Erling Smørgravserver when the client has previously send the server a streamlocal-forward 336a0ee8cc6SDag-Erling SmørgravGLOBAL_REQUEST. 337a0ee8cc6SDag-Erling Smørgrav 338a0ee8cc6SDag-Erling Smørgrav byte SSH_MSG_CHANNEL_OPEN 339a0ee8cc6SDag-Erling Smørgrav string "forwarded-streamlocal@openssh.com" 340a0ee8cc6SDag-Erling Smørgrav uint32 sender channel 341a0ee8cc6SDag-Erling Smørgrav uint32 initial window size 342a0ee8cc6SDag-Erling Smørgrav uint32 maximum packet size 343a0ee8cc6SDag-Erling Smørgrav string socket path 344a0ee8cc6SDag-Erling Smørgrav string reserved for future use 345a0ee8cc6SDag-Erling Smørgrav 346a0ee8cc6SDag-Erling SmørgravThe reserved field is not currently defined and is ignored on the 347a0ee8cc6SDag-Erling Smørgravremote end. It is intended to be used in the future to pass 348a0ee8cc6SDag-Erling Smørgravinformation about the socket file, such as ownership and mode. 349a0ee8cc6SDag-Erling SmørgravThe client currently sends the empty string for this field. 350a0ee8cc6SDag-Erling Smørgrav 351a0ee8cc6SDag-Erling SmørgravSimilar to tcpip-forward, streamlocal-forward is sent by the client 352a0ee8cc6SDag-Erling Smørgravto request remote forwarding of a Unix domain socket. 353a0ee8cc6SDag-Erling Smørgrav 354a0ee8cc6SDag-Erling Smørgrav byte SSH2_MSG_GLOBAL_REQUEST 355a0ee8cc6SDag-Erling Smørgrav string "streamlocal-forward@openssh.com" 356a0ee8cc6SDag-Erling Smørgrav boolean TRUE 357a0ee8cc6SDag-Erling Smørgrav string socket path 358a0ee8cc6SDag-Erling Smørgrav 359a0ee8cc6SDag-Erling SmørgravSimilar to cancel-tcpip-forward, cancel-streamlocal-forward is sent 360a0ee8cc6SDag-Erling Smørgravby the client cancel the forwarding of a Unix domain socket. 361a0ee8cc6SDag-Erling Smørgrav 362a0ee8cc6SDag-Erling Smørgrav byte SSH2_MSG_GLOBAL_REQUEST 363a0ee8cc6SDag-Erling Smørgrav string "cancel-streamlocal-forward@openssh.com" 364a0ee8cc6SDag-Erling Smørgrav boolean FALSE 365a0ee8cc6SDag-Erling Smørgrav string socket path 366a0ee8cc6SDag-Erling Smørgrav 367bc5531deSDag-Erling Smørgrav2.5. connection: hostkey update and rotation "hostkeys-00@openssh.com" 368bc5531deSDag-Erling Smørgravand "hostkeys-prove-00@openssh.com" 369bc5531deSDag-Erling Smørgrav 370bc5531deSDag-Erling SmørgravOpenSSH supports a protocol extension allowing a server to inform 371bc5531deSDag-Erling Smørgrava client of all its protocol v.2 host keys after user-authentication 372bc5531deSDag-Erling Smørgravhas completed. 373bc5531deSDag-Erling Smørgrav 374bc5531deSDag-Erling Smørgrav byte SSH_MSG_GLOBAL_REQUEST 375bc5531deSDag-Erling Smørgrav string "hostkeys-00@openssh.com" 37619261079SEd Maste char 0 /* want-reply */ 377bc5531deSDag-Erling Smørgrav string[] hostkeys 378bc5531deSDag-Erling Smørgrav 379bc5531deSDag-Erling SmørgravUpon receiving this message, a client should check which of the 38047dd1d1bSDag-Erling Smørgravsupplied host keys are present in known_hosts. 38147dd1d1bSDag-Erling Smørgrav 38247dd1d1bSDag-Erling SmørgravNote that the server may send key types that the client does not 38319261079SEd Mastesupport. The client should disregard such keys if they are received. 38447dd1d1bSDag-Erling Smørgrav 38547dd1d1bSDag-Erling SmørgravIf the client identifies any keys that are not present for the host, 38647dd1d1bSDag-Erling Smørgravit should send a "hostkeys-prove@openssh.com" message to request the 38747dd1d1bSDag-Erling Smørgravserver prove ownership of the private half of the key. 388bc5531deSDag-Erling Smørgrav 389bc5531deSDag-Erling Smørgrav byte SSH_MSG_GLOBAL_REQUEST 390bc5531deSDag-Erling Smørgrav string "hostkeys-prove-00@openssh.com" 391bc5531deSDag-Erling Smørgrav char 1 /* want-reply */ 392bc5531deSDag-Erling Smørgrav string[] hostkeys 393bc5531deSDag-Erling Smørgrav 394bc5531deSDag-Erling SmørgravWhen a server receives this message, it should generate a signature 395bc5531deSDag-Erling Smørgravusing each requested key over the following: 396bc5531deSDag-Erling Smørgrav 397bc5531deSDag-Erling Smørgrav string "hostkeys-prove-00@openssh.com" 398bc5531deSDag-Erling Smørgrav string session identifier 399bc5531deSDag-Erling Smørgrav string hostkey 400bc5531deSDag-Erling Smørgrav 401bc5531deSDag-Erling SmørgravThese signatures should be included in the reply, in the order matching 402bc5531deSDag-Erling Smørgravthe hostkeys in the request: 403bc5531deSDag-Erling Smørgrav 404bc5531deSDag-Erling Smørgrav byte SSH_MSG_REQUEST_SUCCESS 405bc5531deSDag-Erling Smørgrav string[] signatures 406bc5531deSDag-Erling Smørgrav 407bc5531deSDag-Erling SmørgravWhen the client receives this reply (and not a failure), it should 408bc5531deSDag-Erling Smørgravvalidate the signatures and may update its known_hosts file, adding keys 409bc5531deSDag-Erling Smørgravthat it has not seen before and deleting keys for the server host that 410bc5531deSDag-Erling Smørgravare no longer offered. 411bc5531deSDag-Erling Smørgrav 412bc5531deSDag-Erling SmørgravThese extensions let a client learn key types that it had not previously 413bc5531deSDag-Erling Smørgravencountered, thereby allowing it to potentially upgrade from weaker 414bc5531deSDag-Erling Smørgravkey algorithms to better ones. It also supports graceful key rotation: 415bc5531deSDag-Erling Smørgrava server may offer multiple keys of the same type for a period (to 416bc5531deSDag-Erling Smørgravgive clients an opportunity to learn them using this extension) before 417bc5531deSDag-Erling Smørgravremoving the deprecated key from those offered. 418bc5531deSDag-Erling Smørgrav 4192f513db7SEd Maste2.6. connection: SIGINFO support for "signal" channel request 4202f513db7SEd Maste 4212f513db7SEd MasteThe SSH channels protocol (RFC4254 section 6.9) supports sending a 4222f513db7SEd Mastesignal to a session attached to a channel. OpenSSH supports one 4232f513db7SEd Masteextension signal "INFO@openssh.com" that allows sending SIGINFO on 4242f513db7SEd MasteBSD-derived systems. 4252f513db7SEd Maste 4261323ec57SEd Maste3. Authentication protocol changes 4274a421b63SDag-Erling Smørgrav 4281323ec57SEd Maste3.1. Host-bound public key authentication 4291323ec57SEd Maste 4301323ec57SEd MasteThis is trivial change to the traditional "publickey" authentication 4311323ec57SEd Mastemethod. The authentication request is identical to the original method 4321323ec57SEd Mastebut for the name and one additional field: 4331323ec57SEd Maste 4341323ec57SEd Maste byte SSH2_MSG_USERAUTH_REQUEST 4351323ec57SEd Maste string username 4361323ec57SEd Maste string "ssh-connection" 4371323ec57SEd Maste string "publickey-hostbound-v00@openssh.com" 4381323ec57SEd Maste bool has_signature 4391323ec57SEd Maste string pkalg 4401323ec57SEd Maste string public key 4411323ec57SEd Maste string server host key 4421323ec57SEd Maste 4431323ec57SEd MasteBecause the entire SSH2_MSG_USERAUTH_REQUEST message is included in 4441323ec57SEd Mastethe signed data, this ensures that a binding between the destination 4451323ec57SEd Masteuser, the server identity and the session identifier is visible to the 4461323ec57SEd Mastesigner. OpenSSH uses this binding via signed data to implement per-key 4471323ec57SEd Masterestrictions in ssh-agent. 4481323ec57SEd Maste 4491323ec57SEd MasteA server may advertise this method using the SSH2_MSG_EXT_INFO 4501323ec57SEd Mastemechanism (RFC8308), with the following message: 4511323ec57SEd Maste 4521323ec57SEd Maste string "publickey-hostbound@openssh.com" 4531323ec57SEd Maste string "0" (version) 4541323ec57SEd Maste 4551323ec57SEd MasteClients should prefer host-bound authentication when advertised by 4561323ec57SEd Masteserver. 4571323ec57SEd Maste 4581323ec57SEd Maste4. SFTP protocol changes 4591323ec57SEd Maste 4601323ec57SEd Maste4.1. sftp: Reversal of arguments to SSH_FXP_SYMLINK 461d4af9e69SDag-Erling Smørgrav 462d4af9e69SDag-Erling SmørgravWhen OpenSSH's sftp-server was implemented, the order of the arguments 463d4af9e69SDag-Erling Smørgravto the SSH_FXP_SYMLINK method was inadvertently reversed. Unfortunately, 464d4af9e69SDag-Erling Smørgravthe reversal was not noticed until the server was widely deployed. Since 465d4af9e69SDag-Erling Smørgravfixing this to follow the specification would cause incompatibility, the 466d4af9e69SDag-Erling Smørgravcurrent order was retained. For correct operation, clients should send 467d4af9e69SDag-Erling SmørgravSSH_FXP_SYMLINK as follows: 468d4af9e69SDag-Erling Smørgrav 469d4af9e69SDag-Erling Smørgrav uint32 id 470d4af9e69SDag-Erling Smørgrav string targetpath 471d4af9e69SDag-Erling Smørgrav string linkpath 472d4af9e69SDag-Erling Smørgrav 4731323ec57SEd Maste4.2. sftp: Server extension announcement in SSH_FXP_VERSION 474d4af9e69SDag-Erling Smørgrav 475d4af9e69SDag-Erling SmørgravOpenSSH's sftp-server lists the extensions it supports using the 476d4af9e69SDag-Erling Smørgravstandard extension announcement mechanism in the SSH_FXP_VERSION server 477d4af9e69SDag-Erling Smørgravhello packet: 478d4af9e69SDag-Erling Smørgrav 479d4af9e69SDag-Erling Smørgrav uint32 3 /* protocol version */ 480d4af9e69SDag-Erling Smørgrav string ext1-name 481d4af9e69SDag-Erling Smørgrav string ext1-version 482d4af9e69SDag-Erling Smørgrav string ext2-name 483d4af9e69SDag-Erling Smørgrav string ext2-version 484d4af9e69SDag-Erling Smørgrav ... 485d4af9e69SDag-Erling Smørgrav string extN-name 486d4af9e69SDag-Erling Smørgrav string extN-version 487d4af9e69SDag-Erling Smørgrav 488d4af9e69SDag-Erling SmørgravEach extension reports its integer version number as an ASCII encoded 489d4af9e69SDag-Erling Smørgravstring, e.g. "1". The version will be incremented if the extension is 490d4af9e69SDag-Erling Smørgravever changed in an incompatible way. The server MAY advertise the same 491d4af9e69SDag-Erling Smørgravextension with multiple versions (though this is unlikely). Clients MUST 492d4af9e69SDag-Erling Smørgravcheck the version number before attempting to use the extension. 493d4af9e69SDag-Erling Smørgrav 4941323ec57SEd Maste4.3. sftp: Extension request "posix-rename@openssh.com" 495d4af9e69SDag-Erling Smørgrav 496d4af9e69SDag-Erling SmørgravThis operation provides a rename operation with POSIX semantics, which 497d4af9e69SDag-Erling Smørgravare different to those provided by the standard SSH_FXP_RENAME in 498d4af9e69SDag-Erling Smørgravdraft-ietf-secsh-filexfer-02.txt. This request is implemented as a 499d4af9e69SDag-Erling SmørgravSSH_FXP_EXTENDED request with the following format: 500d4af9e69SDag-Erling Smørgrav 501d4af9e69SDag-Erling Smørgrav uint32 id 502d4af9e69SDag-Erling Smørgrav string "posix-rename@openssh.com" 503d4af9e69SDag-Erling Smørgrav string oldpath 504d4af9e69SDag-Erling Smørgrav string newpath 505d4af9e69SDag-Erling Smørgrav 506d4af9e69SDag-Erling SmørgravOn receiving this request the server will perform the POSIX operation 507d4af9e69SDag-Erling Smørgravrename(oldpath, newpath) and will respond with a SSH_FXP_STATUS message. 508d4af9e69SDag-Erling SmørgravThis extension is advertised in the SSH_FXP_VERSION hello with version 509d4af9e69SDag-Erling Smørgrav"1". 510d4af9e69SDag-Erling Smørgrav 5111323ec57SEd Maste4.4. sftp: Extension requests "statvfs@openssh.com" and 512d4af9e69SDag-Erling Smørgrav "fstatvfs@openssh.com" 513d4af9e69SDag-Erling Smørgrav 514d4af9e69SDag-Erling SmørgravThese requests correspond to the statvfs and fstatvfs POSIX system 515d4af9e69SDag-Erling Smørgravinterfaces. The "statvfs@openssh.com" request operates on an explicit 516d4af9e69SDag-Erling Smørgravpathname, and is formatted as follows: 517d4af9e69SDag-Erling Smørgrav 518d4af9e69SDag-Erling Smørgrav uint32 id 519d4af9e69SDag-Erling Smørgrav string "statvfs@openssh.com" 520d4af9e69SDag-Erling Smørgrav string path 521d4af9e69SDag-Erling Smørgrav 522d4af9e69SDag-Erling SmørgravThe "fstatvfs@openssh.com" operates on an open file handle: 523d4af9e69SDag-Erling Smørgrav 524d4af9e69SDag-Erling Smørgrav uint32 id 525d4af9e69SDag-Erling Smørgrav string "fstatvfs@openssh.com" 526d4af9e69SDag-Erling Smørgrav string handle 527d4af9e69SDag-Erling Smørgrav 528d4af9e69SDag-Erling SmørgravThese requests return a SSH_FXP_STATUS reply on failure. On success they 529d4af9e69SDag-Erling Smørgravreturn the following SSH_FXP_EXTENDED_REPLY reply: 530d4af9e69SDag-Erling Smørgrav 531d4af9e69SDag-Erling Smørgrav uint32 id 532d4af9e69SDag-Erling Smørgrav uint64 f_bsize /* file system block size */ 533d4af9e69SDag-Erling Smørgrav uint64 f_frsize /* fundamental fs block size */ 534d4af9e69SDag-Erling Smørgrav uint64 f_blocks /* number of blocks (unit f_frsize) */ 535d4af9e69SDag-Erling Smørgrav uint64 f_bfree /* free blocks in file system */ 536d4af9e69SDag-Erling Smørgrav uint64 f_bavail /* free blocks for non-root */ 537d4af9e69SDag-Erling Smørgrav uint64 f_files /* total file inodes */ 538d4af9e69SDag-Erling Smørgrav uint64 f_ffree /* free file inodes */ 539d4af9e69SDag-Erling Smørgrav uint64 f_favail /* free file inodes for to non-root */ 540d4af9e69SDag-Erling Smørgrav uint64 f_fsid /* file system id */ 541d4af9e69SDag-Erling Smørgrav uint64 f_flag /* bit mask of f_flag values */ 542d4af9e69SDag-Erling Smørgrav uint64 f_namemax /* maximum filename length */ 543d4af9e69SDag-Erling Smørgrav 544d4af9e69SDag-Erling SmørgravThe values of the f_flag bitmask are as follows: 545d4af9e69SDag-Erling Smørgrav 546d4af9e69SDag-Erling Smørgrav #define SSH_FXE_STATVFS_ST_RDONLY 0x1 /* read-only */ 547d4af9e69SDag-Erling Smørgrav #define SSH_FXE_STATVFS_ST_NOSUID 0x2 /* no setuid */ 548d4af9e69SDag-Erling Smørgrav 549d4af9e69SDag-Erling SmørgravBoth the "statvfs@openssh.com" and "fstatvfs@openssh.com" extensions are 550d4af9e69SDag-Erling Smørgravadvertised in the SSH_FXP_VERSION hello with version "2". 551d4af9e69SDag-Erling Smørgrav 5521323ec57SEd Maste4.5. sftp: Extension request "hardlink@openssh.com" 5534a421b63SDag-Erling Smørgrav 5544a421b63SDag-Erling SmørgravThis request is for creating a hard link to a regular file. This 5554a421b63SDag-Erling Smørgravrequest is implemented as a SSH_FXP_EXTENDED request with the 5564a421b63SDag-Erling Smørgravfollowing format: 5574a421b63SDag-Erling Smørgrav 5584a421b63SDag-Erling Smørgrav uint32 id 5594a421b63SDag-Erling Smørgrav string "hardlink@openssh.com" 5604a421b63SDag-Erling Smørgrav string oldpath 5614a421b63SDag-Erling Smørgrav string newpath 5624a421b63SDag-Erling Smørgrav 5634a421b63SDag-Erling SmørgravOn receiving this request the server will perform the operation 5644a421b63SDag-Erling Smørgravlink(oldpath, newpath) and will respond with a SSH_FXP_STATUS message. 5654a421b63SDag-Erling SmørgravThis extension is advertised in the SSH_FXP_VERSION hello with version 5664a421b63SDag-Erling Smørgrav"1". 5674a421b63SDag-Erling Smørgrav 5681323ec57SEd Maste4.6. sftp: Extension request "fsync@openssh.com" 569f7167e0eSDag-Erling Smørgrav 570f7167e0eSDag-Erling SmørgravThis request asks the server to call fsync(2) on an open file handle. 571f7167e0eSDag-Erling Smørgrav 572f7167e0eSDag-Erling Smørgrav uint32 id 573f7167e0eSDag-Erling Smørgrav string "fsync@openssh.com" 574f7167e0eSDag-Erling Smørgrav string handle 575f7167e0eSDag-Erling Smørgrav 57687c1498dSEd MasteOn receiving this request, a server will call fsync(handle_fd) and will 577f7167e0eSDag-Erling Smørgravrespond with a SSH_FXP_STATUS message. 578f7167e0eSDag-Erling Smørgrav 579f7167e0eSDag-Erling SmørgravThis extension is advertised in the SSH_FXP_VERSION hello with version 580f7167e0eSDag-Erling Smørgrav"1". 581f7167e0eSDag-Erling Smørgrav 5821323ec57SEd Maste4.7. sftp: Extension request "lsetstat@openssh.com" 58319261079SEd Maste 58419261079SEd MasteThis request is like the "setstat" command, but sets file attributes on 58519261079SEd Mastesymlinks. It is implemented as a SSH_FXP_EXTENDED request with the 58619261079SEd Mastefollowing format: 58719261079SEd Maste 58819261079SEd Maste uint32 id 58919261079SEd Maste string "lsetstat@openssh.com" 59019261079SEd Maste string path 59119261079SEd Maste ATTRS attrs 59219261079SEd Maste 59319261079SEd MasteSee the "setstat" command for more details. 59419261079SEd Maste 59519261079SEd MasteThis extension is advertised in the SSH_FXP_VERSION hello with version 59619261079SEd Maste"1". 59719261079SEd Maste 5981323ec57SEd Maste4.8. sftp: Extension request "limits@openssh.com" 59919261079SEd Maste 60019261079SEd MasteThis request is used to determine various limits the server might impose. 60119261079SEd MasteClients should not attempt to exceed these limits as the server might sever 60219261079SEd Mastethe connection immediately. 60319261079SEd Maste 60419261079SEd Maste uint32 id 60519261079SEd Maste string "limits@openssh.com" 60619261079SEd Maste 60719261079SEd MasteThe server will respond with a SSH_FXP_EXTENDED_REPLY reply: 60819261079SEd Maste 60919261079SEd Maste uint32 id 61019261079SEd Maste uint64 max-packet-length 61119261079SEd Maste uint64 max-read-length 61219261079SEd Maste uint64 max-write-length 61319261079SEd Maste uint64 max-open-handles 61419261079SEd Maste 61519261079SEd MasteThe 'max-packet-length' applies to the total number of bytes in a 61619261079SEd Mastesingle SFTP packet. Servers SHOULD set this at least to 34000. 61719261079SEd Maste 61819261079SEd MasteThe 'max-read-length' is the largest length in a SSH_FXP_READ packet. 61919261079SEd MasteEven if the client requests a larger size, servers will usually respond 62019261079SEd Mastewith a shorter SSH_FXP_DATA packet. Servers SHOULD set this at least to 62119261079SEd Maste32768. 62219261079SEd Maste 62319261079SEd MasteThe 'max-write-length' is the largest length in a SSH_FXP_WRITE packet 62419261079SEd Mastethe server will accept. Servers SHOULD set this at least to 32768. 62519261079SEd Maste 62619261079SEd MasteThe 'max-open-handles' is the maximum number of active handles that the 62719261079SEd Masteserver allows (e.g. handles created by SSH_FXP_OPEN and SSH_FXP_OPENDIR 62819261079SEd Mastepackets). Servers MAY count internal file handles against this limit 62919261079SEd Maste(e.g. system logging or stdout/stderr), so clients SHOULD NOT expect to 63019261079SEd Masteopen this many handles in practice. 63119261079SEd Maste 63219261079SEd MasteIf the server doesn't enforce a specific limit, then the field may be 63319261079SEd Masteset to 0. This implies the server relies on the OS to enforce limits 63419261079SEd Maste(e.g. available memory or file handles), and such limits might be 63519261079SEd Mastedynamic. The client SHOULD take care to not try to exceed reasonable 63619261079SEd Mastelimits. 63719261079SEd Maste 63819261079SEd MasteThis extension is advertised in the SSH_FXP_VERSION hello with version 63919261079SEd Maste"1". 64019261079SEd Maste 6411323ec57SEd Maste4.9. sftp: Extension request "expand-path@openssh.com" 64219261079SEd Maste 64319261079SEd MasteThis request supports canonicalisation of relative paths and 64419261079SEd Mastethose that need tilde-expansion, i.e. "~", "~/..." and "~user/..." 64519261079SEd MasteThese paths are expanded using shell-like rules and the resultant 64619261079SEd Mastepath is canonicalised similarly to SSH2_FXP_REALPATH. 64719261079SEd Maste 64819261079SEd MasteIt is implemented as a SSH_FXP_EXTENDED request with the following 64919261079SEd Masteformat: 65019261079SEd Maste 65119261079SEd Maste uint32 id 65219261079SEd Maste string "expand-path@openssh.com" 65319261079SEd Maste string path 65419261079SEd Maste 65519261079SEd MasteIts reply is the same format as that of SSH2_FXP_REALPATH. 65619261079SEd Maste 65719261079SEd MasteThis extension is advertised in the SSH_FXP_VERSION hello with version 65819261079SEd Maste"1". 65919261079SEd Maste 66087c1498dSEd Maste4.10. sftp: Extension request "copy-data" 66187c1498dSEd Maste 66287c1498dSEd MasteThis request asks the server to copy data from one open file handle and 66387c1498dSEd Mastewrite it to a different open file handle. This avoids needing to transfer 66487c1498dSEd Mastethe data across the network twice (a download followed by an upload). 66587c1498dSEd Maste 66687c1498dSEd Maste byte SSH_FXP_EXTENDED 66787c1498dSEd Maste uint32 id 66887c1498dSEd Maste string "copy-data" 66987c1498dSEd Maste string read-from-handle 67087c1498dSEd Maste uint64 read-from-offset 67187c1498dSEd Maste uint64 read-data-length 67287c1498dSEd Maste string write-to-handle 67387c1498dSEd Maste uint64 write-to-offset 67487c1498dSEd Maste 67587c1498dSEd MasteThe server will copy read-data-length bytes starting from 67687c1498dSEd Masteread-from-offset from the read-from-handle and write them to 67787c1498dSEd Mastewrite-to-handle starting from write-to-offset, and then respond with a 67887c1498dSEd MasteSSH_FXP_STATUS message. 67987c1498dSEd Maste 68087c1498dSEd MasteIt's equivalent to issuing a series of SSH_FXP_READ requests on 68187c1498dSEd Masteread-from-handle and a series of requests of SSH_FXP_WRITE on 68287c1498dSEd Mastewrite-to-handle. 68387c1498dSEd Maste 68487c1498dSEd MasteIf read-from-handle and write-to-handle are the same, the server will 68587c1498dSEd Mastefail the request and respond with a SSH_FX_INVALID_PARAMETER message. 68687c1498dSEd Maste 68787c1498dSEd MasteIf read-data-length is 0, then the server will read data from the 68887c1498dSEd Masteread-from-handle until EOF is reached. 68987c1498dSEd Maste 69087c1498dSEd MasteThis extension is advertised in the SSH_FXP_VERSION hello with version 69187c1498dSEd Maste"1". 69287c1498dSEd Maste 69387c1498dSEd MasteThis request is identical to the "copy-data" request documented in: 69487c1498dSEd Maste 69587c1498dSEd Mastehttps://tools.ietf.org/html/draft-ietf-secsh-filexfer-extensions-00#section-7 69687c1498dSEd Maste 69738a52bd3SEd Maste4.11. sftp: Extension request "home-directory" 69838a52bd3SEd Maste 69938a52bd3SEd MasteThis request asks the server to expand the specified user's home directory. 70038a52bd3SEd MasteAn empty username implies the current user. This can be used by the client 70138a52bd3SEd Masteto expand ~/ type paths locally. 70238a52bd3SEd Maste 70338a52bd3SEd Maste byte SSH_FXP_EXTENDED 70438a52bd3SEd Maste uint32 id 70538a52bd3SEd Maste string "home-directory" 70638a52bd3SEd Maste string username 70738a52bd3SEd Maste 70838a52bd3SEd MasteThis extension is advertised in the SSH_FXP_VERSION hello with version 70938a52bd3SEd Maste"1". 71038a52bd3SEd Maste 71138a52bd3SEd MasteThis provides similar information as the "expand-path@openssh.com" extension. 71238a52bd3SEd Maste 71338a52bd3SEd MasteThis request is identical to the "home-directory" request documented in: 71438a52bd3SEd Maste 71538a52bd3SEd Mastehttps://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-extensions-00#section-5 71638a52bd3SEd Maste 71738a52bd3SEd Maste4.12. sftp: Extension request "users-groups-by-id@openssh.com" 71838a52bd3SEd Maste 719f374ba41SEd MasteThis request asks the server to return user and/or group names that 72038a52bd3SEd Mastecorrespond to one or more IDs (e.g. as returned from a SSH_FXP_STAT 72138a52bd3SEd Masterequest). This may be used by the client to provide usernames in 72238a52bd3SEd Mastedirectory listings. 72338a52bd3SEd Maste 72438a52bd3SEd Maste byte SSH_FXP_EXTENDED 72538a52bd3SEd Maste uint32 id 72638a52bd3SEd Maste string "users-groups-by-id@openssh.com" 72738a52bd3SEd Maste string uids 72838a52bd3SEd Maste string gids 72938a52bd3SEd Maste 73038a52bd3SEd MasteWhere "uids" and "gids" consists of one or more integer user or group 73138a52bd3SEd Masteidentifiers: 73238a52bd3SEd Maste 73338a52bd3SEd Maste uint32 id-0 73438a52bd3SEd Maste ... 73538a52bd3SEd Maste 73638a52bd3SEd MasteThe server will reply with a SSH_FXP_EXTENDED_REPLY: 73738a52bd3SEd Maste 73838a52bd3SEd Maste byte SSH_FXP_EXTENDED_REPLY 739*a91a2465SEd Maste uint32 id 74038a52bd3SEd Maste string usernames 74138a52bd3SEd Maste string groupnames 74238a52bd3SEd Maste 74338a52bd3SEd MasteWhere "username" and "groupnames" consists of names in identical request 74438a52bd3SEd Masteorder to "uids" and "gids" respectively: 74538a52bd3SEd Maste 74638a52bd3SEd Maste string name-0 74738a52bd3SEd Maste ... 74838a52bd3SEd Maste 74938a52bd3SEd MasteIf a name cannot be identified for a given user or group ID, an empty 75038a52bd3SEd Mastestring will be returned in its place. 75138a52bd3SEd Maste 75238a52bd3SEd MasteIt is acceptable for either "uids" or "gids" to be an empty set, in 75338a52bd3SEd Mastewhich case the respective "usernames" or "groupnames" list will also 75438a52bd3SEd Mastebe empty. 75538a52bd3SEd Maste 75638a52bd3SEd MasteThis extension is advertised in the SSH_FXP_VERSION hello with version 75738a52bd3SEd Maste"1". 75838a52bd3SEd Maste 7591323ec57SEd Maste5. Miscellaneous changes 760190cef3dSDag-Erling Smørgrav 7611323ec57SEd Maste5.1 Public key format 762190cef3dSDag-Erling Smørgrav 763190cef3dSDag-Erling SmørgravOpenSSH public keys, as generated by ssh-keygen(1) and appearing in 764190cef3dSDag-Erling Smørgravauthorized_keys files, are formatted as a single line of text consisting 765190cef3dSDag-Erling Smørgravof the public key algorithm name followed by a base64-encoded key blob. 766190cef3dSDag-Erling SmørgravThe public key blob (before base64 encoding) is the same format used for 767190cef3dSDag-Erling Smørgravthe encoding of public keys sent on the wire: as described in RFC4253 768190cef3dSDag-Erling Smørgravsection 6.6 for RSA and DSA keys, RFC5656 section 3.1 for ECDSA keys 769190cef3dSDag-Erling Smørgravand the "New public key formats" section of PROTOCOL.certkeys for the 770190cef3dSDag-Erling SmørgravOpenSSH certificate formats. 771190cef3dSDag-Erling Smørgrav 7721323ec57SEd Maste5.2 Private key format 773190cef3dSDag-Erling Smørgrav 774190cef3dSDag-Erling SmørgravOpenSSH private keys, as generated by ssh-keygen(1) use the format 775190cef3dSDag-Erling Smørgravdescribed in PROTOCOL.key by default. As a legacy option, PEM format 776190cef3dSDag-Erling Smørgrav(RFC7468) private keys are also supported for RSA, DSA and ECDSA keys 777190cef3dSDag-Erling Smørgravand were the default format before OpenSSH 7.8. 778190cef3dSDag-Erling Smørgrav 7791323ec57SEd Maste5.3 KRL format 780190cef3dSDag-Erling Smørgrav 781190cef3dSDag-Erling SmørgravOpenSSH supports a compact format for Key Revocation Lists (KRLs). This 782190cef3dSDag-Erling Smørgravformat is described in the PROTOCOL.krl file. 783190cef3dSDag-Erling Smørgrav 7841323ec57SEd Maste5.4 Connection multiplexing 785190cef3dSDag-Erling Smørgrav 786190cef3dSDag-Erling SmørgravOpenSSH's connection multiplexing uses messages as described in 787190cef3dSDag-Erling SmørgravPROTOCOL.mux over a Unix domain socket for communications between a 788190cef3dSDag-Erling Smørgravmaster instance and later clients. 789190cef3dSDag-Erling Smørgrav 7901323ec57SEd Maste5.5. Agent protocol extensions 7911323ec57SEd Maste 7921323ec57SEd MasteOpenSSH extends the usual agent protocol. These changes are documented 7931323ec57SEd Mastein the PROTOCOL.agent file. 7941323ec57SEd Maste 795*a91a2465SEd Maste$OpenBSD: PROTOCOL,v 1.55 2024/01/08 05:05:15 djm Exp $ 796