⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rfc.nroff

📁 OpenSSL Source code for SFTP, SSH, and many others
💻 NROFF
📖 第 1 页 / 共 5 页
字号:
.ti 0Preparatory OperationsAfter successful authentication, the server waits for a request fromthe client, processes the request, and responds with SSH_SMSG_SUCCESSwhenever a request has been successfully processed.  If it receives amessage that it does not recognize or it fails to honor a request, itreturns SSH_SMSG_FAILURE.  It is expected that new message types mightbe added to this phase in future.The following messages are currently defined for this phase..IP SSH_CMSG_REQUEST_COMPRESSIONRequests that compression be enabled for this session.  Agzip-compatible compression level (1-9) is passed as an argument..IP SSH_CMSG_REQUEST_PTYRequests that a pseudo terminal device be allocated for this session.The user terminal type and terminal modes are supplied as arguments..IP SSH_CMSG_X11_REQUEST_FORWARDINGRequests forwarding of X11 connections from the remote machine to thelocal machine over the secure channel.  Causes an internet-domainsocket to be allocated and the DISPLAY variable to be set on the server.X11 authentication data is automatically passed to the server, and theclient may implement spoofing of authentication data for addedsecurity.  The authentication data is passed as arguments..IP SSH_CMSG_PORT_FORWARD_REQUESTRequests forwarding of a TCP/IP port on the server host over thesecure channel.  What happens is that whenever a connection is made tothe port on the server, a connection will be made from the client endto the specified host/port.  Any user can forward unprivileged ports;only the root can forward privileged ports (as determined byauthentication done earlier)..IP SSH_CMSG_AGENT_REQUEST_FORWARDINGRequests forwarding of the connection to the authentication agent..IP SSH_CMSG_EXEC_SHELLStarts a shell (command interpreter) for the user, and moves intointeractive session mode..IP SSH_CMSG_EXEC_CMDExecutes the given command (actually "<shell> -c <command>" orequivalent) for the user, and moves into interactive session mode..RT.ti 0Interactive Session and Exchange of DataDuring the interactive session, any data written by the shell orcommand running on the server machine is forwarded to stdin orstderr on the client machine, and any input available from stdin onthe client machine is forwarded to the program on the server machine.All exchange is asynchronous; either side can send at any time, andthere are no acknowledgements (TCP/IP already provides reliabletransport, and the packet protocol protects against tampering or IPspoofing).When the client receives EOF from its standard input, it will sendSSH_CMSG_EOF; however, this in no way terminates the exchange.  Theexchange terminates and interactive mode is left when the server sendsSSH_SMSG_EXITSTATUS to indicate that the client program hasterminated.  Alternatively, either side may disconnect at any time bysending SSH_MSG_DISCONNECT or closing the connection.The server may send any of the following messages:.IP SSH_SMSG_STDOUT_DATAData written to stdout by the program running on the server.  The datais passed as a string argument.  The client writes this data tostdout..IP SSH_SMSG_STDERR_DATAData written to stderr by the program running on the server.  The datais passed as a string argument.  The client writes this data tostderr.  (Note that if the program is running on a tty, it is notpossible to separate stdout and stderr data, and all data will be sentas stdout data.).IP SSH_SMSG_EXITSTATUSIndicates that the shell or command has exited.  Exit status is passedas an integer argument.  This message causes termination of theinteractive session..IP SSH_SMSG_AGENT_OPENIndicates that someone on the server side is requesting a connectionto the authentication agent.  The server-side channel number is passedas an argument.  The client must respond with eitherSSH_CHANNEL_OPEN_CONFIRMATION or SSH_CHANNEL_OPEN_FAILURE..IP SSH_SMSG_X11_OPENIndicates that a connection has been made to the X11 socket on theserver side and should be forwarded to the real X server.  An integerargument indicates the channel number allocated for this connection onthe server side.  The client should send back eitherSSH_MSG_CHANNEL_OPEN_CONFIRMATION or SSH_MSG_CHANNEL_OPEN_FAILURE withthe same server side channel number..IP SSH_MSG_PORT_OPENIndicates that a connection has been made to a port on the server sidefor which forwarding has been requested.  Arguments are server sidechannel number, host name to connect to, and port to connect to.  Theclient should send back eitherSSH_MSG_CHANNEL_OPEN_CONFIRMATION or SSH_MSG_CHANNEL_OPEN_FAILURE withthe same server side channel number..IP SSH_MSG_CHANNEL_OPEN_CONFIRMATIONThis is sent by the server to indicate that it has opened a connectionas requested in a previous message.  The first argument indicates theclient side channel number, and the second argument is the channel numberthat the server has allocated for this connection..IP SSH_MSG_CHANNEL_OPEN_FAILUREThis is sent by the server to indicate that it failed to open aconnection as requested in a previous message.  The client-sidechannel number is passed as an argument.  The client will close thedescriptor associated with the channel and free the channel..IP SSH_MSG_CHANNEL_DATAThis packet contains data for a channel from the server.  The firstargument is the client-side channel number, and the second argument (astring) is the data..IP SSH_MSG_CHANNEL_CLOSEThis is sent by the server to indicate that whoever was in the otherend of the channel has closed it.  The argument is the client side channelnumber.  The client will let all buffered data in the channel todrain, and when ready, will close the socket, free the channel, andsend the server a SSH_MSG_CHANNEL_CLOSE_CONFIRMATION message for thechannel..IP SSH_MSG_CHANNEL_CLOSE_CONFIRMATIONThis is send by the server to indicate that a channel previouslyclosed by the client has now been closed on the server side as well.The argument indicates the client channel number.  The client freesthe channel..RTThe client may send any of the following messages:.IP SSH_CMSG_STDIN_DATAThis is data to be sent as input to the program running on the server.The data is passed as a string..IP SSH_CMSG_EOFIndicates that the client has encountered EOF while reading standardinput.  The server will allow any buffered input data to drain, andwill then close the input to the program..IP SSH_CMSG_WINDOW_SIZEIndicates that window size on the client has been changed.  The serverupdates the window size of the tty and causes SIGWINCH to be sent tothe program.  The new window size is passed as four integer arguments:row, col, xpixel, ypixel..IP SSH_MSG_PORT_OPENIndicates that a connection has been made to a port on the client sidefor which forwarding has been requested.  Arguments are client sidechannel number, host name to connect to, and port to connect to.  Theserver should send back either SSH_MSG_CHANNEL_OPEN_CONFIRMATION orSSH_MSG_CHANNEL_OPEN_FAILURE with the same client side channel number..IP SSH_MSG_CHANNEL_OPEN_CONFIRMATIONThis is sent by the client to indicate that it has opened a connectionas requested in a previous message.  The first argument indicates theserver side channel number, and the second argument is the channelnumber that the client has allocated for this connection..IP SSH_MSG_CHANNEL_OPEN_FAILUREThis is sent by the client to indicate that it failed to open aconnection as requested in a previous message.  The server sidechannel number is passed as an argument.  The server will close thedescriptor associated with the channel and free the channel..IP SSH_MSG_CHANNEL_DATAThis packet contains data for a channel from the client.  The firstargument is the server side channel number, and the second argument (astring) is the data..IP SSH_MSG_CHANNEL_CLOSEThis is sent by the client to indicate that whoever was in the otherend of the channel has closed it.  The argument is the server channelnumber.  The server will allow buffered data to drain, and when ready,will close the socket, free the channel, and send the client aSSH_MSG_CHANNEL_CLOSE_CONFIRMATION message for the channel..IP SSH_MSG_CHANNEL_CLOSE_CONFIRMATIONThis is send by the client to indicate that a channel previouslyclosed by the server has now been closed on the client side as well.The argument indicates the server channel number.  The server freesthe channel..RTAny unsupported messages during interactive mode cause the connectionto be terminated with SSH_MSG_DISCONNECT and an error message.Compatible protocol upgrades should agree about any extensions duringthe preparation phase or earlier..ti 0Termination of the ConnectionNormal termination of the connection is always initiated by the serverby sending SSH_SMSG_EXITSTATUS after the program has exited.  Theclient responds to this message by sending SSH_CMSG_EXIT_CONFIRMATIONand closes the socket; the server then closes the socket.  There aretwo purposes for the confirmation: some systems may lose previouslysent data when the socket is closed, and closing the client side firstcauses any TCP/IP TIME_WAIT [RFC0793] waits to occur on the client side, notconsuming server resources.If the program terminates due to a signal, the server will sendSSH_MSG_DISCONNECT with an appropriate message.  If the connection isclosed, all file descriptors to the program will be closed and theserver will exit.  If the program runs on a tty, the kernel sends itthe SIGHUP signal when the pty master side is closed..ti 0Protocol FlagsBoth the server and the client pass 32 bits of protocol flags to theother side.  The flags are intended for compatible protocol extension;the server first announces which added capabilities it supports, andthe client then sends the capabilities that it supports.The following flags are currently defined (the values are bit masks):.IP "1 SSH_PROTOFLAG_SCREEN_NUMBER"This flag can only be sent by the client.  It indicates that the X11forwarding requests it sends will include the screen number..IP "2 SSH_PROTOFLAG_HOST_IN_FWD_OPEN"If both sides specify this flag, SSH_SMSG_X11_OPEN andSSH_MSG_PORT_OPEN messages will contain an additional field containinga description of the host at the other end of the connection..RT.ti 0Detailed Description of Packet Types and FormatsThe supported packet types and the corresponding message numbers aregiven in the following table.  Messages with _MSG_ in their name maybe sent by either side.  Messages with _CMSG_ are only sent by theclient, and messages with _SMSG_ only by the server.A packet may contain additional data after the arguments specifiedbelow.  Any such data should be ignored by the receiver.  However, itis recommended that no such data be stored without good reason.  (Thishelps build compatible extensions.).IP "0 SSH_MSG_NONE"This code is reserved.  This message type is never sent..IP "1 SSH_MSG_DISCONNECT".TS;l l.string	Cause of disconnection.TEThis message may be sent by either party at any time.  It causes theimmediate disconnection of the connection.  The message is intended tobe displayed to a human, and describes the reason for disconnection..IP "2 SSH_SMSG_PUBLIC_KEY".TS;l l.8 bytes	anti_spoofing_cookie32-bit int	server_key_bitsmp-int	server_key_public_exponentmp-int	server_key_public_modulus32-bit int	host_key_bitsmp-int	host_key_public_exponentmp-int	host_key_public_modulus32-bit int	protocol_flags32-bit int	supported_ciphers_mask32-bit int	supported_authentications_mask.TESent as the first message by the server.  This message gives theserver's host key, server key, protocol flags (intended for compatibleprotocol extension), supported_ciphers_mask (which is thebitwise or of (1 << cipher_number), where << is the left shiftoperator, for all supported ciphers), andsupported_authentications_mask (which is the bitwise or of (1 <<authentication_type) for all supported authentication types).  Theanti_spoofing_cookie is 64 random bytes, and must be sent backverbatim by the client in its reply.  It is used to make IP-spoofingmore difficult (encryption and host keys are the real defense againstspoofing)..IP "3 SSH_CMSG_SESSION_KEY".TS;l l.1 byte	cipher_type (must be one of the supported values)8 bytes	anti_spoofing_cookie (must match data sent by the server)mp-int	double-encrypted session key32-bit int	protocol_flags.TESent by the client as the first message in the session.  Selects thecipher to use, and sends the encrypted session key to the server.  Theanti_spoofing_cookie must be the same bytes that were sent by theserver.  Protocol_flags is intended for negotiating compatibleprotocol extensions..IP "4 SSH_CMSG_USER".TS;l l.string	user login name on server.TESent by the client to begin authentication.  Specifies the user nameon the server to log in as.  The server responds with SSH_SMSG_SUCCESSif no authentication is needed for this user, or SSH_SMSG_FAILURE ifauthentication is needed (or the user does not exist).  [Note to theimplementator: the user name is of arbitrary size.  The implementationmust be careful not to overflow internal buffers.].IP "5 SSH_CMSG_AUTH_RHOSTS".TS;l l.string	client-side user name.TERequests authentication using /etc/hosts.equiv and .rhosts (orequivalent mechanisms).  This authentication method is normallydisabled in the server because it is not secure (but this is themethod used by rsh and rlogin).  The server responds withSSH_SMSG_SUCCESS if authentication was successful, andSSH_SMSG_FAILURE if access was not granted.  The server should checkthat the client side port number is less than 1024 (a privilegedport), and immediately reject authentication if it is not.  Supportingthis authentication method is optional.  This method should normallynot be enabled in the server because it is not safe.  (However, notenabling this only helps if rlogind and rshd are disabled.).IP "6 SSH_CMSG_AUTH_RSA".TS;l l.mp-int	identity_public_modulus.TERequests authentication using pure RSA authentication.  The serverchecks if the given key is permitted to log in, and if so, respondswith SSH_SMSG_AUTH_RSA_CHALLENGE.  Otherwise, it responds withSSH_SMSG_FAILURE.  The client often tries several different keys insequence until one supported by the server is found.  Authenticationis accepted if the client gives the correct response to the challenge.The server is free to add other criteria for authentication, such as arequirement that the connection must come from a certain host.  Such

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -