-
Notifications
You must be signed in to change notification settings - Fork 19
005: RFC 4253
RFC 4253 is the primary document used to describe the core connection and key exchange mechanisms of SSH. I will be grabbing quotes from this document to help clarify parts that I found confusing.
The first sections we want to look at is 4.2. Protocol Version Exchange. This is states that once a client connects, both sides must send an identification string in the format of:
SSH-protoversion-softwareversion SP comments CR LF
In this case, protoversion should be 2.0, as that is the version being documented and used and the softwareversion can be any UTF-8 encoded string to identify the server, but it should not include a dash or space. Finally the SP means a space character and then comments can be an valid string. Finally the message must end in a carriage return and line feed, or CR/LF.
This means valid strings are:
SSH-2.0-billsSSH_3.6.3q3[CR][LF] SSH-2.0-MySSHServer_1.0 Some Comment Allowed here[CR][LF]
So, our first task in our server is send our Protocol Version Exchange message to the client, and also read the Protocol Version Exchange from the client's socket.
I have read the full RFC, and I know that most of the SSH data is sent as raw byte data and will require special processing, but until we should read from the socket for the first [CR][LF] and save this value off. Once we have received that, we'll then need to start reading the socket as a binary data stream.
Let's continue add Reading Protocol Version Exchange
If you'd like to give me a tip, donate at:
- Bitcoin (BTC): 1NdnffxFC7G7qMrvUYc1x4R5sqXuJhVFR7
- Etherium (ETH): 0xcF0a3f130ba0f8c4CC3A02F782805A448D45388f
- Litecoin (LTC): LV7JL8yA4fAZ3Lib9VoX1tuFPmPVrfFueT