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 36644b4646SEd Maste1.3. transport: Certificate key algorithms 37b15c8340SDag-Erling Smørgrav 384a421b63SDag-Erling SmørgravOpenSSH introduces new public key algorithms to support certificate 39bc5531deSDag-Erling Smørgravauthentication for users and host keys. These methods are documented 40644b4646SEd Mastein at https://datatracker.ietf.org/doc/draft-miller-ssh-cert/ 41b15c8340SDag-Erling Smørgrav 424a421b63SDag-Erling Smørgrav1.4. transport: Elliptic Curve cryptography 434a421b63SDag-Erling Smørgrav 444a421b63SDag-Erling SmørgravOpenSSH supports ECC key exchange and public key authentication as 454a421b63SDag-Erling Smørgravspecified in RFC5656. Only the ecdsa-sha2-nistp256, ecdsa-sha2-nistp384 464a421b63SDag-Erling Smørgravand ecdsa-sha2-nistp521 curves over GF(p) are supported. Elliptic 474a421b63SDag-Erling Smørgravcurve points encoded using point compression are NOT accepted or 484a421b63SDag-Erling Smørgravgenerated. 494a421b63SDag-Erling Smørgrav 506888a9beSDag-Erling Smørgrav1.5 transport: Protocol 2 Encrypt-then-MAC MAC algorithms 516888a9beSDag-Erling Smørgrav 526888a9beSDag-Erling SmørgravOpenSSH supports MAC algorithms, whose names contain "-etm", that 536888a9beSDag-Erling Smørgravperform the calculations in a different order to that defined in RFC 546888a9beSDag-Erling Smørgrav4253. These variants use the so-called "encrypt then MAC" ordering, 556888a9beSDag-Erling Smørgravcalculating the MAC over the packet ciphertext rather than the 566888a9beSDag-Erling Smørgravplaintext. This ordering closes a security flaw in the SSH transport 576888a9beSDag-Erling Smørgravprotocol, where decryption of unauthenticated ciphertext provided a 586888a9beSDag-Erling Smørgrav"decryption oracle" that could, in conjunction with cipher flaws, reveal 596888a9beSDag-Erling Smørgravsession plaintext. 606888a9beSDag-Erling Smørgrav 616888a9beSDag-Erling SmørgravSpecifically, the "-etm" MAC algorithms modify the transport protocol 626888a9beSDag-Erling Smørgravto calculate the MAC over the packet ciphertext and to send the packet 636888a9beSDag-Erling Smørgravlength unencrypted. This is necessary for the transport to obtain the 646888a9beSDag-Erling Smørgravlength of the packet and location of the MAC tag so that it may be 656888a9beSDag-Erling Smørgravverified without decrypting unauthenticated data. 666888a9beSDag-Erling Smørgrav 676888a9beSDag-Erling SmørgravAs such, the MAC covers: 686888a9beSDag-Erling Smørgrav 696888a9beSDag-Erling Smørgrav mac = MAC(key, sequence_number || packet_length || encrypted_packet) 706888a9beSDag-Erling Smørgrav 716888a9beSDag-Erling Smørgravwhere "packet_length" is encoded as a uint32 and "encrypted_packet" 726888a9beSDag-Erling Smørgravcontains: 736888a9beSDag-Erling Smørgrav 746888a9beSDag-Erling Smørgrav byte padding_length 756888a9beSDag-Erling Smørgrav byte[n1] payload; n1 = packet_length - padding_length - 1 766888a9beSDag-Erling Smørgrav byte[n2] random padding; n2 = padding_length 776888a9beSDag-Erling Smørgrav 786888a9beSDag-Erling Smørgrav1.6 transport: AES-GCM 796888a9beSDag-Erling Smørgrav 806888a9beSDag-Erling SmørgravOpenSSH supports the AES-GCM algorithm as specified in RFC 5647. 81644b4646SEd MasteBecause of problems with the design of the algorithm negotiation in this 82644b4646SEd MasteRFC, OpenSSH (and other SSH implementations) use different rules as 83644b4646SEd Mastedescribed in: 846888a9beSDag-Erling Smørgrav 85644b4646SEd Mastehttps://datatracker.ietf.org/doc/draft-miller-sshm-aes-gcm/ 866888a9beSDag-Erling Smørgrav 87f7167e0eSDag-Erling Smørgrav1.7 transport: chacha20-poly1305@openssh.com authenticated encryption 88f7167e0eSDag-Erling Smørgrav 89f7167e0eSDag-Erling SmørgravOpenSSH supports authenticated encryption using ChaCha20 and Poly1305 90644b4646SEd Masteas described in: 91f7167e0eSDag-Erling Smørgrav 92644b4646SEd Mastehttps://datatracker.ietf.org/doc/draft-ietf-sshm-chacha20-poly1305/ 93f7167e0eSDag-Erling Smørgrav 94644b4646SEd Maste1.8 transport: ping facility 95edf85781SEd Maste 96edf85781SEd MasteOpenSSH implements a transport level ping message SSH2_MSG_PING 97edf85781SEd Masteand a corresponding SSH2_MSG_PONG reply. 98edf85781SEd Maste 99edf85781SEd Maste#define SSH2_MSG_PING 192 100edf85781SEd Maste#define SSH2_MSG_PONG 193 101edf85781SEd Maste 102edf85781SEd MasteThe ping message is simply: 103edf85781SEd Maste 104edf85781SEd Maste byte SSH_MSG_PING 105edf85781SEd Maste string data 106edf85781SEd Maste 107edf85781SEd MasteThe reply copies the data (which may be the empty string) from the 108edf85781SEd Masteping: 109edf85781SEd Maste 110edf85781SEd Maste byte SSH_MSG_PONG 111edf85781SEd Maste string data 112edf85781SEd Maste 113edf85781SEd MasteReplies are sent in order. They are sent immediately except when rekeying 114edf85781SEd Masteis in progress, in which case they are queued until rekeying completes. 115edf85781SEd Maste 116edf85781SEd MasteThe server advertises support for these messages using the 117edf85781SEd MasteSSH2_MSG_EXT_INFO mechanism (RFC8308), with the following message: 118edf85781SEd Maste 119edf85781SEd Maste string "ping@openssh.com" 120edf85781SEd Maste string "0" (version) 121edf85781SEd Maste 122edf85781SEd MasteThe ping/reply message is implemented at the transport layer rather 123edf85781SEd Mastethan as a named global or channel request to allow pings with very 124edf85781SEd Masteshort packet lengths, which would not be possible with other 125edf85781SEd Masteapproaches. 126edf85781SEd Maste 127644b4646SEd Maste1.9 transport: strict key exchange extension 12892f58c69SGordon Tetlow 129644b4646SEd MasteOpenSSH supports a number of transport-layer hardening measures 130644b4646SEd Mastedesigned to thwart the so-called "Terrapin" attack against the 131644b4646SEd Masteearly SSH protocol. These are collectively referred to as 132644b4646SEd Maste"strict KEX" and documented in an Internet-Draft: 13392f58c69SGordon Tetlow 134644b4646SEd Mastehttps://datatracker.ietf.org/doc/draft-miller-sshm-strict-kex/ 13592f58c69SGordon Tetlow 136644b4646SEd Maste1.10 transport: SSH2_MSG_EXT_INFO during user authentication 137069ac184SEd Maste 138069ac184SEd MasteThis protocol extension allows the SSH2_MSG_EXT_INFO to be sent 139069ac184SEd Masteduring user authentication. RFC8308 does allow a second 140069ac184SEd MasteSSH2_MSG_EXT_INFO notification, but it may only be sent at the end 141069ac184SEd Masteof user authentication and this is too late to signal per-user 142069ac184SEd Masteserver signature algorithms. 143069ac184SEd Maste 144069ac184SEd MasteSupport for receiving the SSH2_MSG_EXT_INFO message during user 145069ac184SEd Masteauthentication is signalled by the client including a 146069ac184SEd Maste"ext-info-in-auth@openssh.com" key via its initial SSH2_MSG_EXT_INFO 147069ac184SEd Masteset after the SSH2_MSG_NEWKEYS message. 148069ac184SEd Maste 149069ac184SEd MasteA server that supports this extension MAY send a second 150069ac184SEd MasteSSH2_MSG_EXT_INFO message any time after the client's first 151069ac184SEd MasteSSH2_MSG_USERAUTH_REQUEST, regardless of whether it succeed or fails. 152069ac184SEd MasteThe client SHOULD be prepared to update the server-sig-algs that 153069ac184SEd Masteit received during an earlier SSH2_MSG_EXT_INFO with the later one. 154069ac184SEd Maste 1554a421b63SDag-Erling Smørgrav2. Connection protocol changes 1564a421b63SDag-Erling Smørgrav 1574a421b63SDag-Erling Smørgrav2.1. connection: Channel write close extension "eow@openssh.com" 158d4af9e69SDag-Erling Smørgrav 159d4af9e69SDag-Erling SmørgravThe SSH connection protocol (rfc4254) provides the SSH_MSG_CHANNEL_EOF 160d4af9e69SDag-Erling Smørgravmessage to allow an endpoint to signal its peer that it will send no 161d4af9e69SDag-Erling Smørgravmore data over a channel. Unfortunately, there is no symmetric way for 162d4af9e69SDag-Erling Smørgravan endpoint to request that its peer should cease sending data to it 163d4af9e69SDag-Erling Smørgravwhile still keeping the channel open for the endpoint to send data to 164d4af9e69SDag-Erling Smørgravthe peer. 165d4af9e69SDag-Erling Smørgrav 166d4af9e69SDag-Erling SmørgravThis is desirable, since it saves the transmission of data that would 167d4af9e69SDag-Erling Smørgravotherwise need to be discarded and it allows an endpoint to signal local 168d4af9e69SDag-Erling Smørgravprocesses of the condition, e.g. by closing the corresponding file 169d4af9e69SDag-Erling Smørgravdescriptor. 170d4af9e69SDag-Erling Smørgrav 171d4af9e69SDag-Erling SmørgravOpenSSH implements a channel extension message to perform this 172d4af9e69SDag-Erling Smørgravsignalling: "eow@openssh.com" (End Of Write). This message is sent by 173d4af9e69SDag-Erling Smørgravan endpoint when the local output of a session channel is closed or 174d4af9e69SDag-Erling Smørgravexperiences a write error. The message is formatted as follows: 175d4af9e69SDag-Erling Smørgrav 176d4af9e69SDag-Erling Smørgrav byte SSH_MSG_CHANNEL_REQUEST 177d4af9e69SDag-Erling Smørgrav uint32 recipient channel 178d4af9e69SDag-Erling Smørgrav string "eow@openssh.com" 179d4af9e69SDag-Erling Smørgrav boolean FALSE 180d4af9e69SDag-Erling Smørgrav 181d4af9e69SDag-Erling SmørgravOn receiving this message, the peer SHOULD cease sending data of 182d4af9e69SDag-Erling Smørgravthe channel and MAY signal the process from which the channel data 183d4af9e69SDag-Erling Smørgravoriginates (e.g. by closing its read file descriptor). 184d4af9e69SDag-Erling Smørgrav 185d4af9e69SDag-Erling SmørgravAs with the symmetric SSH_MSG_CHANNEL_EOF message, the channel does 186d4af9e69SDag-Erling Smørgravremain open after a "eow@openssh.com" has been sent and more data may 187d4af9e69SDag-Erling Smørgravstill be sent in the other direction. This message does not consume 188d4af9e69SDag-Erling Smørgravwindow space and may be sent even if no window space is available. 189d4af9e69SDag-Erling Smørgrav 190cce7d346SDag-Erling SmørgravNB. due to certain broken SSH implementations aborting upon receipt 191cce7d346SDag-Erling Smørgravof this message (in contravention of RFC4254 section 5.4), this 192cce7d346SDag-Erling Smørgravmessage is only sent to OpenSSH peers (identified by banner). 19319261079SEd MasteOther SSH implementations may be listed to receive this message 194cce7d346SDag-Erling Smørgravupon request. 195cce7d346SDag-Erling Smørgrav 1964a421b63SDag-Erling Smørgrav2.2. connection: disallow additional sessions extension 197d4af9e69SDag-Erling Smørgrav "no-more-sessions@openssh.com" 198d4af9e69SDag-Erling Smørgrav 199d4af9e69SDag-Erling SmørgravMost SSH connections will only ever request a single session, but a 200d4af9e69SDag-Erling Smørgravattacker may abuse a running ssh client to surreptitiously open 201d4af9e69SDag-Erling Smørgravadditional sessions under their control. OpenSSH provides a global 202d4af9e69SDag-Erling Smørgravrequest "no-more-sessions@openssh.com" to mitigate this attack. 203d4af9e69SDag-Erling Smørgrav 204d4af9e69SDag-Erling SmørgravWhen an OpenSSH client expects that it will never open another session 205d4af9e69SDag-Erling Smørgrav(i.e. it has been started with connection multiplexing disabled), it 206d4af9e69SDag-Erling Smørgravwill send the following global request: 207d4af9e69SDag-Erling Smørgrav 208d4af9e69SDag-Erling Smørgrav byte SSH_MSG_GLOBAL_REQUEST 209d4af9e69SDag-Erling Smørgrav string "no-more-sessions@openssh.com" 210d4af9e69SDag-Erling Smørgrav char want-reply 211d4af9e69SDag-Erling Smørgrav 212d4af9e69SDag-Erling SmørgravOn receipt of such a message, an OpenSSH server will refuse to open 213d4af9e69SDag-Erling Smørgravfuture channels of type "session" and instead immediately abort the 214d4af9e69SDag-Erling Smørgravconnection. 215d4af9e69SDag-Erling Smørgrav 216d4af9e69SDag-Erling SmørgravNote that this is not a general defence against compromised clients 217d4af9e69SDag-Erling Smørgrav(that is impossible), but it thwarts a simple attack. 218d4af9e69SDag-Erling Smørgrav 219cce7d346SDag-Erling SmørgravNB. due to certain broken SSH implementations aborting upon receipt 220cce7d346SDag-Erling Smørgravof this message, the no-more-sessions request is only sent to OpenSSH 221cce7d346SDag-Erling Smørgravservers (identified by banner). Other SSH implementations may be 22219261079SEd Mastelisted to receive this message upon request. 223cce7d346SDag-Erling Smørgrav 2244a421b63SDag-Erling Smørgrav2.3. connection: Tunnel forward extension "tun@openssh.com" 225d4af9e69SDag-Erling Smørgrav 226d4af9e69SDag-Erling SmørgravOpenSSH supports layer 2 and layer 3 tunnelling via the "tun@openssh.com" 227d4af9e69SDag-Erling Smørgravchannel type. This channel type supports forwarding of network packets 228d4af9e69SDag-Erling Smørgravwith datagram boundaries intact between endpoints equipped with 229d4af9e69SDag-Erling Smørgravinterfaces like the BSD tun(4) device. Tunnel forwarding channels are 230d4af9e69SDag-Erling Smørgravrequested by the client with the following packet: 231d4af9e69SDag-Erling Smørgrav 232d4af9e69SDag-Erling Smørgrav byte SSH_MSG_CHANNEL_OPEN 233d4af9e69SDag-Erling Smørgrav string "tun@openssh.com" 234d4af9e69SDag-Erling Smørgrav uint32 sender channel 235d4af9e69SDag-Erling Smørgrav uint32 initial window size 236d4af9e69SDag-Erling Smørgrav uint32 maximum packet size 237d4af9e69SDag-Erling Smørgrav uint32 tunnel mode 238d4af9e69SDag-Erling Smørgrav uint32 remote unit number 239d4af9e69SDag-Erling Smørgrav 240d4af9e69SDag-Erling SmørgravThe "tunnel mode" parameter specifies whether the tunnel should forward 241d4af9e69SDag-Erling Smørgravlayer 2 frames or layer 3 packets. It may take one of the following values: 242d4af9e69SDag-Erling Smørgrav 243d4af9e69SDag-Erling Smørgrav SSH_TUNMODE_POINTOPOINT 1 /* layer 3 packets */ 244d4af9e69SDag-Erling Smørgrav SSH_TUNMODE_ETHERNET 2 /* layer 2 frames */ 245d4af9e69SDag-Erling Smørgrav 246d4af9e69SDag-Erling SmørgravThe "tunnel unit number" specifies the remote interface number, or may 24719261079SEd Mastebe 0x7fffffff to allow the server to automatically choose an interface. A 248b15c8340SDag-Erling Smørgravserver that is not willing to open a client-specified unit should refuse 249b15c8340SDag-Erling Smørgravthe request with a SSH_MSG_CHANNEL_OPEN_FAILURE error. On successful 250b15c8340SDag-Erling Smørgravopen, the server should reply with SSH_MSG_CHANNEL_OPEN_SUCCESS. 251d4af9e69SDag-Erling Smørgrav 252d4af9e69SDag-Erling SmørgravOnce established the client and server may exchange packet or frames 253d4af9e69SDag-Erling Smørgravover the tunnel channel by encapsulating them in SSH protocol strings 254d4af9e69SDag-Erling Smørgravand sending them as channel data. This ensures that packet boundaries 255d4af9e69SDag-Erling Smørgravare kept intact. Specifically, packets are transmitted using normal 256d4af9e69SDag-Erling SmørgravSSH_MSG_CHANNEL_DATA packets: 257d4af9e69SDag-Erling Smørgrav 258d4af9e69SDag-Erling Smørgrav byte SSH_MSG_CHANNEL_DATA 259d4af9e69SDag-Erling Smørgrav uint32 recipient channel 260d4af9e69SDag-Erling Smørgrav string data 261d4af9e69SDag-Erling Smørgrav 262d4af9e69SDag-Erling SmørgravThe contents of the "data" field for layer 3 packets is: 263d4af9e69SDag-Erling Smørgrav 264d4af9e69SDag-Erling Smørgrav uint32 packet length 265d4af9e69SDag-Erling Smørgrav uint32 address family 266d4af9e69SDag-Erling Smørgrav byte[packet length - 4] packet data 267d4af9e69SDag-Erling Smørgrav 268d4af9e69SDag-Erling SmørgravThe "address family" field identifies the type of packet in the message. 269d4af9e69SDag-Erling SmørgravIt may be one of: 270d4af9e69SDag-Erling Smørgrav 271d4af9e69SDag-Erling Smørgrav SSH_TUN_AF_INET 2 /* IPv4 */ 272d4af9e69SDag-Erling Smørgrav SSH_TUN_AF_INET6 24 /* IPv6 */ 273d4af9e69SDag-Erling Smørgrav 274d4af9e69SDag-Erling SmørgravThe "packet data" field consists of the IPv4/IPv6 datagram itself 275d4af9e69SDag-Erling Smørgravwithout any link layer header. 276d4af9e69SDag-Erling Smørgrav 277b15c8340SDag-Erling SmørgravThe contents of the "data" field for layer 2 packets is: 278d4af9e69SDag-Erling Smørgrav 279d4af9e69SDag-Erling Smørgrav uint32 packet length 280d4af9e69SDag-Erling Smørgrav byte[packet length] frame 281d4af9e69SDag-Erling Smørgrav 282d4af9e69SDag-Erling SmørgravThe "frame" field contains an IEEE 802.3 Ethernet frame, including 283d4af9e69SDag-Erling Smørgravheader. 284d4af9e69SDag-Erling Smørgrav 285a0ee8cc6SDag-Erling Smørgrav2.4. connection: Unix domain socket forwarding 286a0ee8cc6SDag-Erling Smørgrav 287a0ee8cc6SDag-Erling SmørgravOpenSSH supports local and remote Unix domain socket forwarding 288a0ee8cc6SDag-Erling Smørgravusing the "streamlocal" extension. Forwarding is initiated as per 289a0ee8cc6SDag-Erling SmørgravTCP sockets but with a single path instead of a host and port. 290a0ee8cc6SDag-Erling Smørgrav 291a0ee8cc6SDag-Erling SmørgravSimilar to direct-tcpip, direct-streamlocal is sent by the client 292a0ee8cc6SDag-Erling Smørgravto request that the server make a connection to a Unix domain socket. 293a0ee8cc6SDag-Erling Smørgrav 294a0ee8cc6SDag-Erling Smørgrav byte SSH_MSG_CHANNEL_OPEN 295a0ee8cc6SDag-Erling Smørgrav string "direct-streamlocal@openssh.com" 296a0ee8cc6SDag-Erling Smørgrav uint32 sender channel 297a0ee8cc6SDag-Erling Smørgrav uint32 initial window size 298a0ee8cc6SDag-Erling Smørgrav uint32 maximum packet size 299a0ee8cc6SDag-Erling Smørgrav string socket path 300076ad2f8SDag-Erling Smørgrav string reserved 301076ad2f8SDag-Erling Smørgrav uint32 reserved 302a0ee8cc6SDag-Erling Smørgrav 303a0ee8cc6SDag-Erling SmørgravSimilar to forwarded-tcpip, forwarded-streamlocal is sent by the 304a0ee8cc6SDag-Erling Smørgravserver when the client has previously send the server a streamlocal-forward 305a0ee8cc6SDag-Erling SmørgravGLOBAL_REQUEST. 306a0ee8cc6SDag-Erling Smørgrav 307a0ee8cc6SDag-Erling Smørgrav byte SSH_MSG_CHANNEL_OPEN 308a0ee8cc6SDag-Erling Smørgrav string "forwarded-streamlocal@openssh.com" 309a0ee8cc6SDag-Erling Smørgrav uint32 sender channel 310a0ee8cc6SDag-Erling Smørgrav uint32 initial window size 311a0ee8cc6SDag-Erling Smørgrav uint32 maximum packet size 312a0ee8cc6SDag-Erling Smørgrav string socket path 313a0ee8cc6SDag-Erling Smørgrav string reserved for future use 314a0ee8cc6SDag-Erling Smørgrav 315a0ee8cc6SDag-Erling SmørgravThe reserved field is not currently defined and is ignored on the 316a0ee8cc6SDag-Erling Smørgravremote end. It is intended to be used in the future to pass 317a0ee8cc6SDag-Erling Smørgravinformation about the socket file, such as ownership and mode. 318a0ee8cc6SDag-Erling SmørgravThe client currently sends the empty string for this field. 319a0ee8cc6SDag-Erling Smørgrav 320a0ee8cc6SDag-Erling SmørgravSimilar to tcpip-forward, streamlocal-forward is sent by the client 321a0ee8cc6SDag-Erling Smørgravto request remote forwarding of a Unix domain socket. 322a0ee8cc6SDag-Erling Smørgrav 323a0ee8cc6SDag-Erling Smørgrav byte SSH2_MSG_GLOBAL_REQUEST 324a0ee8cc6SDag-Erling Smørgrav string "streamlocal-forward@openssh.com" 325a0ee8cc6SDag-Erling Smørgrav boolean TRUE 326a0ee8cc6SDag-Erling Smørgrav string socket path 327a0ee8cc6SDag-Erling Smørgrav 328a0ee8cc6SDag-Erling SmørgravSimilar to cancel-tcpip-forward, cancel-streamlocal-forward is sent 329a0ee8cc6SDag-Erling Smørgravby the client cancel the forwarding of a Unix domain socket. 330a0ee8cc6SDag-Erling Smørgrav 331a0ee8cc6SDag-Erling Smørgrav byte SSH2_MSG_GLOBAL_REQUEST 332a0ee8cc6SDag-Erling Smørgrav string "cancel-streamlocal-forward@openssh.com" 333a0ee8cc6SDag-Erling Smørgrav boolean FALSE 334a0ee8cc6SDag-Erling Smørgrav string socket path 335a0ee8cc6SDag-Erling Smørgrav 336bc5531deSDag-Erling Smørgrav2.5. connection: hostkey update and rotation "hostkeys-00@openssh.com" 337bc5531deSDag-Erling Smørgravand "hostkeys-prove-00@openssh.com" 338bc5531deSDag-Erling Smørgrav 339bc5531deSDag-Erling SmørgravOpenSSH supports a protocol extension allowing a server to inform 340bc5531deSDag-Erling Smørgrava client of all its protocol v.2 host keys after user-authentication 341644b4646SEd Mastehas completed. This is documented in an Internet-Draft 342bc5531deSDag-Erling Smørgrav 343644b4646SEd Mastehttps://datatracker.ietf.org/doc/draft-miller-sshm-hostkey-update/ 344bc5531deSDag-Erling Smørgrav 3452f513db7SEd Maste2.6. connection: SIGINFO support for "signal" channel request 3462f513db7SEd Maste 3472f513db7SEd MasteThe SSH channels protocol (RFC4254 section 6.9) supports sending a 3482f513db7SEd Mastesignal to a session attached to a channel. OpenSSH supports one 3492f513db7SEd Masteextension signal "INFO@openssh.com" that allows sending SIGINFO on 3502f513db7SEd MasteBSD-derived systems. 3512f513db7SEd Maste 3521323ec57SEd Maste3. Authentication protocol changes 3534a421b63SDag-Erling Smørgrav 3541323ec57SEd Maste3.1. Host-bound public key authentication 3551323ec57SEd Maste 3561323ec57SEd MasteThis is trivial change to the traditional "publickey" authentication 3571323ec57SEd Mastemethod. The authentication request is identical to the original method 3581323ec57SEd Mastebut for the name and one additional field: 3591323ec57SEd Maste 3601323ec57SEd Maste byte SSH2_MSG_USERAUTH_REQUEST 3611323ec57SEd Maste string username 3621323ec57SEd Maste string "ssh-connection" 3631323ec57SEd Maste string "publickey-hostbound-v00@openssh.com" 3641323ec57SEd Maste bool has_signature 3651323ec57SEd Maste string pkalg 3661323ec57SEd Maste string public key 3671323ec57SEd Maste string server host key 3681323ec57SEd Maste 3691323ec57SEd MasteBecause the entire SSH2_MSG_USERAUTH_REQUEST message is included in 3701323ec57SEd Mastethe signed data, this ensures that a binding between the destination 3711323ec57SEd Masteuser, the server identity and the session identifier is visible to the 3721323ec57SEd Mastesigner. OpenSSH uses this binding via signed data to implement per-key 3731323ec57SEd Masterestrictions in ssh-agent. 3741323ec57SEd Maste 3751323ec57SEd MasteA server may advertise this method using the SSH2_MSG_EXT_INFO 3761323ec57SEd Mastemechanism (RFC8308), with the following message: 3771323ec57SEd Maste 3781323ec57SEd Maste string "publickey-hostbound@openssh.com" 3791323ec57SEd Maste string "0" (version) 3801323ec57SEd Maste 3811323ec57SEd MasteClients should prefer host-bound authentication when advertised by 3821323ec57SEd Masteserver. 3831323ec57SEd Maste 3841323ec57SEd Maste4. SFTP protocol changes 3851323ec57SEd Maste 3861323ec57SEd Maste4.1. sftp: Reversal of arguments to SSH_FXP_SYMLINK 387d4af9e69SDag-Erling Smørgrav 388d4af9e69SDag-Erling SmørgravWhen OpenSSH's sftp-server was implemented, the order of the arguments 389d4af9e69SDag-Erling Smørgravto the SSH_FXP_SYMLINK method was inadvertently reversed. Unfortunately, 390d4af9e69SDag-Erling Smørgravthe reversal was not noticed until the server was widely deployed. Since 391d4af9e69SDag-Erling Smørgravfixing this to follow the specification would cause incompatibility, the 392d4af9e69SDag-Erling Smørgravcurrent order was retained. For correct operation, clients should send 393d4af9e69SDag-Erling SmørgravSSH_FXP_SYMLINK as follows: 394d4af9e69SDag-Erling Smørgrav 395d4af9e69SDag-Erling Smørgrav uint32 id 396d4af9e69SDag-Erling Smørgrav string targetpath 397d4af9e69SDag-Erling Smørgrav string linkpath 398d4af9e69SDag-Erling Smørgrav 3991323ec57SEd Maste4.2. sftp: Server extension announcement in SSH_FXP_VERSION 400d4af9e69SDag-Erling Smørgrav 401d4af9e69SDag-Erling SmørgravOpenSSH's sftp-server lists the extensions it supports using the 402d4af9e69SDag-Erling Smørgravstandard extension announcement mechanism in the SSH_FXP_VERSION server 403d4af9e69SDag-Erling Smørgravhello packet: 404d4af9e69SDag-Erling Smørgrav 405d4af9e69SDag-Erling Smørgrav uint32 3 /* protocol version */ 406d4af9e69SDag-Erling Smørgrav string ext1-name 407d4af9e69SDag-Erling Smørgrav string ext1-version 408d4af9e69SDag-Erling Smørgrav string ext2-name 409d4af9e69SDag-Erling Smørgrav string ext2-version 410d4af9e69SDag-Erling Smørgrav ... 411d4af9e69SDag-Erling Smørgrav string extN-name 412d4af9e69SDag-Erling Smørgrav string extN-version 413d4af9e69SDag-Erling Smørgrav 414d4af9e69SDag-Erling SmørgravEach extension reports its integer version number as an ASCII encoded 415d4af9e69SDag-Erling Smørgravstring, e.g. "1". The version will be incremented if the extension is 416d4af9e69SDag-Erling Smørgravever changed in an incompatible way. The server MAY advertise the same 417d4af9e69SDag-Erling Smørgravextension with multiple versions (though this is unlikely). Clients MUST 418d4af9e69SDag-Erling Smørgravcheck the version number before attempting to use the extension. 419d4af9e69SDag-Erling Smørgrav 4201323ec57SEd Maste4.3. sftp: Extension request "posix-rename@openssh.com" 421d4af9e69SDag-Erling Smørgrav 422d4af9e69SDag-Erling SmørgravThis operation provides a rename operation with POSIX semantics, which 423d4af9e69SDag-Erling Smørgravare different to those provided by the standard SSH_FXP_RENAME in 424d4af9e69SDag-Erling Smørgravdraft-ietf-secsh-filexfer-02.txt. This request is implemented as a 425d4af9e69SDag-Erling SmørgravSSH_FXP_EXTENDED request with the following format: 426d4af9e69SDag-Erling Smørgrav 427d4af9e69SDag-Erling Smørgrav uint32 id 428d4af9e69SDag-Erling Smørgrav string "posix-rename@openssh.com" 429d4af9e69SDag-Erling Smørgrav string oldpath 430d4af9e69SDag-Erling Smørgrav string newpath 431d4af9e69SDag-Erling Smørgrav 432d4af9e69SDag-Erling SmørgravOn receiving this request the server will perform the POSIX operation 433d4af9e69SDag-Erling Smørgravrename(oldpath, newpath) and will respond with a SSH_FXP_STATUS message. 434d4af9e69SDag-Erling SmørgravThis extension is advertised in the SSH_FXP_VERSION hello with version 435d4af9e69SDag-Erling Smørgrav"1". 436d4af9e69SDag-Erling Smørgrav 4371323ec57SEd Maste4.4. sftp: Extension requests "statvfs@openssh.com" and 438d4af9e69SDag-Erling Smørgrav "fstatvfs@openssh.com" 439d4af9e69SDag-Erling Smørgrav 440d4af9e69SDag-Erling SmørgravThese requests correspond to the statvfs and fstatvfs POSIX system 441d4af9e69SDag-Erling Smørgravinterfaces. The "statvfs@openssh.com" request operates on an explicit 442d4af9e69SDag-Erling Smørgravpathname, and is formatted as follows: 443d4af9e69SDag-Erling Smørgrav 444d4af9e69SDag-Erling Smørgrav uint32 id 445d4af9e69SDag-Erling Smørgrav string "statvfs@openssh.com" 446d4af9e69SDag-Erling Smørgrav string path 447d4af9e69SDag-Erling Smørgrav 448d4af9e69SDag-Erling SmørgravThe "fstatvfs@openssh.com" operates on an open file handle: 449d4af9e69SDag-Erling Smørgrav 450d4af9e69SDag-Erling Smørgrav uint32 id 451d4af9e69SDag-Erling Smørgrav string "fstatvfs@openssh.com" 452d4af9e69SDag-Erling Smørgrav string handle 453d4af9e69SDag-Erling Smørgrav 454d4af9e69SDag-Erling SmørgravThese requests return a SSH_FXP_STATUS reply on failure. On success they 455d4af9e69SDag-Erling Smørgravreturn the following SSH_FXP_EXTENDED_REPLY reply: 456d4af9e69SDag-Erling Smørgrav 457d4af9e69SDag-Erling Smørgrav uint32 id 458d4af9e69SDag-Erling Smørgrav uint64 f_bsize /* file system block size */ 459d4af9e69SDag-Erling Smørgrav uint64 f_frsize /* fundamental fs block size */ 460d4af9e69SDag-Erling Smørgrav uint64 f_blocks /* number of blocks (unit f_frsize) */ 461d4af9e69SDag-Erling Smørgrav uint64 f_bfree /* free blocks in file system */ 462d4af9e69SDag-Erling Smørgrav uint64 f_bavail /* free blocks for non-root */ 463d4af9e69SDag-Erling Smørgrav uint64 f_files /* total file inodes */ 464d4af9e69SDag-Erling Smørgrav uint64 f_ffree /* free file inodes */ 465d4af9e69SDag-Erling Smørgrav uint64 f_favail /* free file inodes for to non-root */ 466d4af9e69SDag-Erling Smørgrav uint64 f_fsid /* file system id */ 467d4af9e69SDag-Erling Smørgrav uint64 f_flag /* bit mask of f_flag values */ 468d4af9e69SDag-Erling Smørgrav uint64 f_namemax /* maximum filename length */ 469d4af9e69SDag-Erling Smørgrav 470d4af9e69SDag-Erling SmørgravThe values of the f_flag bitmask are as follows: 471d4af9e69SDag-Erling Smørgrav 472d4af9e69SDag-Erling Smørgrav #define SSH_FXE_STATVFS_ST_RDONLY 0x1 /* read-only */ 473d4af9e69SDag-Erling Smørgrav #define SSH_FXE_STATVFS_ST_NOSUID 0x2 /* no setuid */ 474d4af9e69SDag-Erling Smørgrav 475d4af9e69SDag-Erling SmørgravBoth the "statvfs@openssh.com" and "fstatvfs@openssh.com" extensions are 476d4af9e69SDag-Erling Smørgravadvertised in the SSH_FXP_VERSION hello with version "2". 477d4af9e69SDag-Erling Smørgrav 4781323ec57SEd Maste4.5. sftp: Extension request "hardlink@openssh.com" 4794a421b63SDag-Erling Smørgrav 4804a421b63SDag-Erling SmørgravThis request is for creating a hard link to a regular file. This 4814a421b63SDag-Erling Smørgravrequest is implemented as a SSH_FXP_EXTENDED request with the 4824a421b63SDag-Erling Smørgravfollowing format: 4834a421b63SDag-Erling Smørgrav 4844a421b63SDag-Erling Smørgrav uint32 id 4854a421b63SDag-Erling Smørgrav string "hardlink@openssh.com" 4864a421b63SDag-Erling Smørgrav string oldpath 4874a421b63SDag-Erling Smørgrav string newpath 4884a421b63SDag-Erling Smørgrav 4894a421b63SDag-Erling SmørgravOn receiving this request the server will perform the operation 4904a421b63SDag-Erling Smørgravlink(oldpath, newpath) and will respond with a SSH_FXP_STATUS message. 4914a421b63SDag-Erling SmørgravThis extension is advertised in the SSH_FXP_VERSION hello with version 4924a421b63SDag-Erling Smørgrav"1". 4934a421b63SDag-Erling Smørgrav 4941323ec57SEd Maste4.6. sftp: Extension request "fsync@openssh.com" 495f7167e0eSDag-Erling Smørgrav 496f7167e0eSDag-Erling SmørgravThis request asks the server to call fsync(2) on an open file handle. 497f7167e0eSDag-Erling Smørgrav 498f7167e0eSDag-Erling Smørgrav uint32 id 499f7167e0eSDag-Erling Smørgrav string "fsync@openssh.com" 500f7167e0eSDag-Erling Smørgrav string handle 501f7167e0eSDag-Erling Smørgrav 50287c1498dSEd MasteOn receiving this request, a server will call fsync(handle_fd) and will 503f7167e0eSDag-Erling Smørgravrespond with a SSH_FXP_STATUS message. 504f7167e0eSDag-Erling Smørgrav 505f7167e0eSDag-Erling SmørgravThis extension is advertised in the SSH_FXP_VERSION hello with version 506f7167e0eSDag-Erling Smørgrav"1". 507f7167e0eSDag-Erling Smørgrav 5081323ec57SEd Maste4.7. sftp: Extension request "lsetstat@openssh.com" 50919261079SEd Maste 51019261079SEd MasteThis request is like the "setstat" command, but sets file attributes on 51119261079SEd Mastesymlinks. It is implemented as a SSH_FXP_EXTENDED request with the 51219261079SEd Mastefollowing format: 51319261079SEd Maste 51419261079SEd Maste uint32 id 51519261079SEd Maste string "lsetstat@openssh.com" 51619261079SEd Maste string path 51719261079SEd Maste ATTRS attrs 51819261079SEd Maste 51919261079SEd MasteSee the "setstat" command for more details. 52019261079SEd Maste 52119261079SEd MasteThis extension is advertised in the SSH_FXP_VERSION hello with version 52219261079SEd Maste"1". 52319261079SEd Maste 5241323ec57SEd Maste4.8. sftp: Extension request "limits@openssh.com" 52519261079SEd Maste 52619261079SEd MasteThis request is used to determine various limits the server might impose. 52719261079SEd MasteClients should not attempt to exceed these limits as the server might sever 52819261079SEd Mastethe connection immediately. 52919261079SEd Maste 53019261079SEd Maste uint32 id 53119261079SEd Maste string "limits@openssh.com" 53219261079SEd Maste 53319261079SEd MasteThe server will respond with a SSH_FXP_EXTENDED_REPLY reply: 53419261079SEd Maste 53519261079SEd Maste uint32 id 53619261079SEd Maste uint64 max-packet-length 53719261079SEd Maste uint64 max-read-length 53819261079SEd Maste uint64 max-write-length 53919261079SEd Maste uint64 max-open-handles 54019261079SEd Maste 54119261079SEd MasteThe 'max-packet-length' applies to the total number of bytes in a 54219261079SEd Mastesingle SFTP packet. Servers SHOULD set this at least to 34000. 54319261079SEd Maste 54419261079SEd MasteThe 'max-read-length' is the largest length in a SSH_FXP_READ packet. 54519261079SEd MasteEven if the client requests a larger size, servers will usually respond 54619261079SEd Mastewith a shorter SSH_FXP_DATA packet. Servers SHOULD set this at least to 54719261079SEd Maste32768. 54819261079SEd Maste 54919261079SEd MasteThe 'max-write-length' is the largest length in a SSH_FXP_WRITE packet 55019261079SEd Mastethe server will accept. Servers SHOULD set this at least to 32768. 55119261079SEd Maste 55219261079SEd MasteThe 'max-open-handles' is the maximum number of active handles that the 55319261079SEd Masteserver allows (e.g. handles created by SSH_FXP_OPEN and SSH_FXP_OPENDIR 55419261079SEd Mastepackets). Servers MAY count internal file handles against this limit 55519261079SEd Maste(e.g. system logging or stdout/stderr), so clients SHOULD NOT expect to 55619261079SEd Masteopen this many handles in practice. 55719261079SEd Maste 55819261079SEd MasteIf the server doesn't enforce a specific limit, then the field may be 55919261079SEd Masteset to 0. This implies the server relies on the OS to enforce limits 56019261079SEd Maste(e.g. available memory or file handles), and such limits might be 56119261079SEd Mastedynamic. The client SHOULD take care to not try to exceed reasonable 56219261079SEd Mastelimits. 56319261079SEd Maste 56419261079SEd MasteThis extension is advertised in the SSH_FXP_VERSION hello with version 56519261079SEd Maste"1". 56619261079SEd Maste 5671323ec57SEd Maste4.9. sftp: Extension request "expand-path@openssh.com" 56819261079SEd Maste 56919261079SEd MasteThis request supports canonicalisation of relative paths and 57019261079SEd Mastethose that need tilde-expansion, i.e. "~", "~/..." and "~user/..." 57119261079SEd MasteThese paths are expanded using shell-like rules and the resultant 57219261079SEd Mastepath is canonicalised similarly to SSH2_FXP_REALPATH. 57319261079SEd Maste 57419261079SEd MasteIt is implemented as a SSH_FXP_EXTENDED request with the following 57519261079SEd Masteformat: 57619261079SEd Maste 57719261079SEd Maste uint32 id 57819261079SEd Maste string "expand-path@openssh.com" 57919261079SEd Maste string path 58019261079SEd Maste 58119261079SEd MasteIts reply is the same format as that of SSH2_FXP_REALPATH. 58219261079SEd Maste 58319261079SEd MasteThis extension is advertised in the SSH_FXP_VERSION hello with version 58419261079SEd Maste"1". 58519261079SEd Maste 58687c1498dSEd Maste4.10. sftp: Extension request "copy-data" 58787c1498dSEd Maste 58887c1498dSEd MasteThis request asks the server to copy data from one open file handle and 58987c1498dSEd Mastewrite it to a different open file handle. This avoids needing to transfer 59087c1498dSEd Mastethe data across the network twice (a download followed by an upload). 59187c1498dSEd Maste 59287c1498dSEd Maste byte SSH_FXP_EXTENDED 59387c1498dSEd Maste uint32 id 59487c1498dSEd Maste string "copy-data" 59587c1498dSEd Maste string read-from-handle 59687c1498dSEd Maste uint64 read-from-offset 59787c1498dSEd Maste uint64 read-data-length 59887c1498dSEd Maste string write-to-handle 59987c1498dSEd Maste uint64 write-to-offset 60087c1498dSEd Maste 60187c1498dSEd MasteThe server will copy read-data-length bytes starting from 60287c1498dSEd Masteread-from-offset from the read-from-handle and write them to 60387c1498dSEd Mastewrite-to-handle starting from write-to-offset, and then respond with a 60487c1498dSEd MasteSSH_FXP_STATUS message. 60587c1498dSEd Maste 60687c1498dSEd MasteIt's equivalent to issuing a series of SSH_FXP_READ requests on 60787c1498dSEd Masteread-from-handle and a series of requests of SSH_FXP_WRITE on 60887c1498dSEd Mastewrite-to-handle. 60987c1498dSEd Maste 61087c1498dSEd MasteIf read-from-handle and write-to-handle are the same, the server will 61187c1498dSEd Mastefail the request and respond with a SSH_FX_INVALID_PARAMETER message. 61287c1498dSEd Maste 61387c1498dSEd MasteIf read-data-length is 0, then the server will read data from the 61487c1498dSEd Masteread-from-handle until EOF is reached. 61587c1498dSEd Maste 61687c1498dSEd MasteThis extension is advertised in the SSH_FXP_VERSION hello with version 61787c1498dSEd Maste"1". 61887c1498dSEd Maste 61987c1498dSEd MasteThis request is identical to the "copy-data" request documented in: 62087c1498dSEd Maste 62187c1498dSEd Mastehttps://tools.ietf.org/html/draft-ietf-secsh-filexfer-extensions-00#section-7 62287c1498dSEd Maste 62338a52bd3SEd Maste4.11. sftp: Extension request "home-directory" 62438a52bd3SEd Maste 62538a52bd3SEd MasteThis request asks the server to expand the specified user's home directory. 62638a52bd3SEd MasteAn empty username implies the current user. This can be used by the client 62738a52bd3SEd Masteto expand ~/ type paths locally. 62838a52bd3SEd Maste 62938a52bd3SEd Maste byte SSH_FXP_EXTENDED 63038a52bd3SEd Maste uint32 id 63138a52bd3SEd Maste string "home-directory" 63238a52bd3SEd Maste string username 63338a52bd3SEd Maste 63438a52bd3SEd MasteThis extension is advertised in the SSH_FXP_VERSION hello with version 63538a52bd3SEd Maste"1". 63638a52bd3SEd Maste 63738a52bd3SEd MasteThis provides similar information as the "expand-path@openssh.com" extension. 63838a52bd3SEd Maste 63938a52bd3SEd MasteThis request is identical to the "home-directory" request documented in: 64038a52bd3SEd Maste 64138a52bd3SEd Mastehttps://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-extensions-00#section-5 64238a52bd3SEd Maste 64338a52bd3SEd Maste4.12. sftp: Extension request "users-groups-by-id@openssh.com" 64438a52bd3SEd Maste 645f374ba41SEd MasteThis request asks the server to return user and/or group names that 64638a52bd3SEd Mastecorrespond to one or more IDs (e.g. as returned from a SSH_FXP_STAT 64738a52bd3SEd Masterequest). This may be used by the client to provide usernames in 64838a52bd3SEd Mastedirectory listings. 64938a52bd3SEd Maste 65038a52bd3SEd Maste byte SSH_FXP_EXTENDED 65138a52bd3SEd Maste uint32 id 65238a52bd3SEd Maste string "users-groups-by-id@openssh.com" 65338a52bd3SEd Maste string uids 65438a52bd3SEd Maste string gids 65538a52bd3SEd Maste 65638a52bd3SEd MasteWhere "uids" and "gids" consists of one or more integer user or group 65738a52bd3SEd Masteidentifiers: 65838a52bd3SEd Maste 65938a52bd3SEd Maste uint32 id-0 66038a52bd3SEd Maste ... 66138a52bd3SEd Maste 66238a52bd3SEd MasteThe server will reply with a SSH_FXP_EXTENDED_REPLY: 66338a52bd3SEd Maste 66438a52bd3SEd Maste byte SSH_FXP_EXTENDED_REPLY 665a91a2465SEd Maste uint32 id 66638a52bd3SEd Maste string usernames 66738a52bd3SEd Maste string groupnames 66838a52bd3SEd Maste 66938a52bd3SEd MasteWhere "username" and "groupnames" consists of names in identical request 67038a52bd3SEd Masteorder to "uids" and "gids" respectively: 67138a52bd3SEd Maste 67238a52bd3SEd Maste string name-0 67338a52bd3SEd Maste ... 67438a52bd3SEd Maste 67538a52bd3SEd MasteIf a name cannot be identified for a given user or group ID, an empty 67638a52bd3SEd Mastestring will be returned in its place. 67738a52bd3SEd Maste 67838a52bd3SEd MasteIt is acceptable for either "uids" or "gids" to be an empty set, in 67938a52bd3SEd Mastewhich case the respective "usernames" or "groupnames" list will also 68038a52bd3SEd Mastebe empty. 68138a52bd3SEd Maste 68238a52bd3SEd MasteThis extension is advertised in the SSH_FXP_VERSION hello with version 68338a52bd3SEd Maste"1". 68438a52bd3SEd Maste 6851323ec57SEd Maste5. Miscellaneous changes 686190cef3dSDag-Erling Smørgrav 6871323ec57SEd Maste5.1 Public key format 688190cef3dSDag-Erling Smørgrav 689190cef3dSDag-Erling SmørgravOpenSSH public keys, as generated by ssh-keygen(1) and appearing in 690190cef3dSDag-Erling Smørgravauthorized_keys files, are formatted as a single line of text consisting 691190cef3dSDag-Erling Smørgravof the public key algorithm name followed by a base64-encoded key blob. 692190cef3dSDag-Erling SmørgravThe public key blob (before base64 encoding) is the same format used for 693190cef3dSDag-Erling Smørgravthe encoding of public keys sent on the wire: as described in RFC4253 694644b4646SEd Mastesection 6.6 for RSA keys, RFC5656 section 3.1 for ECDSA keys and 695644b4646SEd Mastehttps://datatracker.ietf.org/doc/draft-miller-ssh-cert/ 696644b4646SEd Mastefor the OpenSSH certificate formats. 697190cef3dSDag-Erling Smørgrav 6981323ec57SEd Maste5.2 Private key format 699190cef3dSDag-Erling Smørgrav 700190cef3dSDag-Erling SmørgravOpenSSH private keys, as generated by ssh-keygen(1) use the format 701190cef3dSDag-Erling Smørgravdescribed in PROTOCOL.key by default. As a legacy option, PEM format 702644b4646SEd Maste(RFC7468) private keys are also supported for RSA and ECDSA keys 703190cef3dSDag-Erling Smørgravand were the default format before OpenSSH 7.8. 704190cef3dSDag-Erling Smørgrav 7051323ec57SEd Maste5.3 KRL format 706190cef3dSDag-Erling Smørgrav 707190cef3dSDag-Erling SmørgravOpenSSH supports a compact format for Key Revocation Lists (KRLs). This 708190cef3dSDag-Erling Smørgravformat is described in the PROTOCOL.krl file. 709190cef3dSDag-Erling Smørgrav 7101323ec57SEd Maste5.4 Connection multiplexing 711190cef3dSDag-Erling Smørgrav 712190cef3dSDag-Erling SmørgravOpenSSH's connection multiplexing uses messages as described in 713190cef3dSDag-Erling SmørgravPROTOCOL.mux over a Unix domain socket for communications between a 714190cef3dSDag-Erling Smørgravmaster instance and later clients. 715190cef3dSDag-Erling Smørgrav 7161323ec57SEd Maste5.5. Agent protocol extensions 7171323ec57SEd Maste 7181323ec57SEd MasteOpenSSH extends the usual agent protocol. These changes are documented 7191323ec57SEd Mastein the PROTOCOL.agent file. 7201323ec57SEd Maste 721*25749746SEd Maste$OpenBSD: PROTOCOL,v 1.60 2026/02/09 22:09:48 dtucker Exp $ 722