t.c.s.t.SSHServerTransport(SSHTransportBase) : class documentation

Part of twisted.conch.ssh.transport View Source View In Hierarchy

SSHServerTransport implements the server side of the SSH protocol.
Instance VariablesisClientsince we are never the client, this is always False.
ignoreNextPacketif True, ignore the next key exchange packet. This is set when the client sends a guessed key exchange packet but with an incorrect guess.
dhGexRequestthe KEX_DH_GEX_REQUEST(_OLD) that the client sent. The key generation needs this to be stored.
gthe Diffie-Hellman group generator.
pthe Diffie-Hellman group prime.
Method ssh_KEXINIT Called when we receive a MSG_KEXINIT message. For a description
Method ssh_KEX_DH_GEX_REQUEST_OLD This represents two different key exchange methods that share the same
Method ssh_KEX_DH_GEX_REQUEST

Called when we receive a MSG_KEX_DH_GEX_REQUEST message. Payload:


Method ssh_KEX_DH_GEX_INIT

Called when we get a MSG_KEX_DH_GEX_INIT message. Payload:


Method ssh_NEWKEYS Called when we get a MSG_NEWKEYS message. No payload.
Method ssh_SERVICE_REQUEST

Called when we get a MSG_SERVICE_REQUEST message. Payload:


Method _ssh_KEXDH_INIT Called to handle the beginning of a diffie-hellman-group1-sha1 key

Inherited from SSHTransportBase:

Method connectionLost Called when the connection is shut down.
Method connectionMade Called when the connection is made to the other side. We sent our
Method sendKexInit Send a KEXINIT message to initiate key exchange or to respond to a
Method sendPacket Sends a packet. If it's been set up, compress the data, encrypt it, and
Method getPacket Try to return a decrypted, authenticated, and decompressed packet
Method dataReceived First, check for the version string (SSH-2.0-*). After that has been
Method dispatchMessage Send a received message to the appropriate method.
Method ssh_DISCONNECT

Called when we receive a MSG_DISCONNECT message. Payload:


Method ssh_IGNORE Called when we receieve a MSG_IGNORE message. No payload.
Method ssh_UNIMPLEMENTED

Called when we receieve a MSG_UNIMPLEMENTED message. Payload:


Method ssh_DEBUG

Called when we receieve a MSG_DEBUG message. Payload:


Method setService Set our service to service and start it running. If we were
Method sendDebug Send a debug message to the other side.
Method sendIgnore Send a message that will be ignored by the other side. This is
Method sendUnimplemented Send a message to the other side that the last packet was not
Method sendDisconnect Send a disconnect message to the other side and then disconnect.
Method isEncrypted Return True if the connection is encrypted in the given direction.
Method isVerified Return True if the connecction is verified/authenticated in the
Method loseConnection Lose the connection to the other side, sending a
Method receiveError Called when we receive a disconnect error message from the other
Method receiveUnimplemented Called when we receive an unimplemented packet message from the other
Method receiveDebug Called when we receive a debug message from the other side.
Method _allowedKeyExchangeMessageType Determine if the given message type may be sent while key exchange is in
Method _unsupportedVersionReceived Called when an unsupported version of the ssh protocol is received from
Method _getKey Get one of the keys for authentication/encryption.
Method _keySetup Set up the keys for the connection and sends MSG_NEWKEYS when
Method _newKeys Called back by a subclass once a MSG_NEWKEYS message has been

Inherited from BaseProtocol (via SSHTransportBase, Protocol):

Method makeConnection Make a connection to a transport and a server.
def ssh_KEXINIT(self, packet): (source)
Called when we receive a MSG_KEXINIT message. For a description of the packet, see SSHTransportBase.ssh_KEXINIT(). Additionally, this method checks if a guessed key exchange packet was sent. If it was sent, and it guessed incorrectly, the next key exchange packet MUST be ignored.
def _ssh_KEXDH_INIT(self, packet): (source)

Called to handle the beginning of a diffie-hellman-group1-sha1 key exchange.

Unlike other message types, this is not dispatched automatically. It is called from ssh_KEX_DH_GEX_REQUEST_OLD because an extra check is required to determine if this is really a KEXDH_INIT message or if it is a KEX_DH_GEX_REQUEST_OLD message.

The KEXDH_INIT (for diffie-hellman-group1-sha1 exchanges) payload:

       integer e (the client's Diffie-Hellman public key)

   We send the KEXDH_REPLY with our host key and signature.
def ssh_KEX_DH_GEX_REQUEST_OLD(self, packet): (source)
This represents two different key exchange methods that share the same integer value. If the message is determined to be a KEXDH_INIT, _ssh_KEXDH_INIT is called to handle it. Otherwise, for KEX_DH_GEX_REQUEST_OLD (for diffie-hellman-group-exchange-sha1) payload:

       integer ideal (ideal size for the Diffie-Hellman prime)

   We send the KEX_DH_GEX_GROUP message with the group that is
   closest in size to ideal.

If we were told to ignore the next key exchange packet by ssh_KEXINIT, drop it on the floor and return.

def ssh_KEX_DH_GEX_REQUEST(self, packet): (source)
Called when we receive a MSG_KEX_DH_GEX_REQUEST message. Payload:

   integer minimum
   integer ideal
   integer maximum

The client is asking for a Diffie-Hellman group between minimum and maximum size, and close to ideal if possible. We reply with a MSG_KEX_DH_GEX_GROUP message.

If we were told to ignore the next key exchange packet by ssh_KEXINIT, drop it on the floor and return.

def ssh_KEX_DH_GEX_INIT(self, packet): (source)
Called when we get a MSG_KEX_DH_GEX_INIT message. Payload:

   integer e (client DH public key)

We send the MSG_KEX_DH_GEX_REPLY message with our host key and signature.

def ssh_NEWKEYS(self, packet): (source)
Called when we get a MSG_NEWKEYS message. No payload. When we get this, the keys have been set on both sides, and we start using them to encrypt and authenticate the connection.
def ssh_SERVICE_REQUEST(self, packet): (source)
Called when we get a MSG_SERVICE_REQUEST message. Payload:

   string serviceName

The client has requested a service. If we can start the service, start it; otherwise, disconnect with DISCONNECT_SERVICE_NOT_AVAILABLE.

API Documentation for Twisted, generated by pydoctor at 2011-04-03 00:32:03.