Go to the latest version of this document.

# ``twisted`.`conch`.`ssh`.`factory`.`SSHFactory``

class documentation

`class SSHFactory(protocol.Factory): (source)`

Known subclasses: `twisted.conch.manhole_ssh.ConchFactory`, `twisted.conch.openssh_compat.factory.OpenSSHFactory`

View In Hierarchy

A Factory for SSH servers.

Method | `buildProtocol` | Create an instance of the server side of the SSH protocol.
Method | `getDHPrime` | Return a tuple of (g, p) for a Diffe-Hellman process, with p being as close to `bits` bits as possible.
Method | `getPrimes` | Called when the factory is started to get Diffie-Hellman generators and primes to use. Returns a dictionary mapping number of bits to lists of tuple of (generator, prime).
Method | `getPrivateKeys` | Called when the factory is started to get the private portions of the servers host keys. Returns a dictionary mapping SSH key types to `twisted.conch.ssh.keys.Key` objects.
Method | `getPublicKeys` | Called when the factory is started to get the public portions of the servers host keys. Returns a dictionary mapping SSH key types to public key strings.
Method | `getService` | Return a class to use as a service for the given transport.
Method | `startFactory` | Check for public and private keys.
Class Variable | `services` | Undocumented
Instance Variable | `primes` | Undocumented
Instance Variable | `privateKeys` | Undocumented
Instance Variable | `publicKeys` | Undocumented
Class Variable | `_log` | Undocumented

Inherited from `Factory`:

Class Method | `forProtocol` | Create a factory for the given protocol.
Method | `doStart` | Make sure startFactory is called.
Method | `doStop` | Make sure stopFactory is called.
Method | `logPrefix` | Describe this factory for log messages.
Method | `stopFactory` | This will be called before I stop listening on all Ports/Connectors.
Class Variable | `noisy` | Undocumented
Class Variable | `protocol` | Undocumented
Instance Variable | `numPorts` | Undocumented

def buildProtocol(self, addr): (source)
from `twisted.internet.interfaces.IProtocolFactory`
overrides `twisted.internet.protocol.Factory.buildProtocol`

Create an instance of the server side of the SSH protocol.

Parameters
addr:`twisted.internet.interfaces.IAddress` provider | The address at which the server will listen.

Returns
`twisted.conch.ssh.transport.SSHServerTransport` | The built transport.

def getDHPrime(self, bits: `int`) -> `tuple[int, int]`: (source)

Return a tuple of (g, p) for a Diffe-Hellman process, with p being as close to `bits` bits as possible.

def getPrimes(self) -> `dict[int, list[tuple[int, int]]] | None`: (source)
overridden in `twisted.conch.openssh_compat.factory.OpenSSHFactory`

Called when the factory is started to get Diffie-Hellman generators and primes to use. Returns a dictionary mapping number of bits to lists of tuple of (generator, prime).

def getPrivateKeys(self): (source)
overridden in `twisted.conch.openssh_compat.factory.OpenSSHFactory`

Called when the factory is started to get the private portions of the servers host keys. Returns a dictionary mapping SSH key types to `twisted.conch.ssh.keys.Key` objects.

Returns
`dict` | Undocumented

def getPublicKeys(self): (source)
overridden in `twisted.conch.openssh_compat.factory.OpenSSHFactory`

Called when the factory is started to get the public portions of the servers host keys. Returns a dictionary mapping SSH key types to public key strings.

Returns
`dict` | Undocumented

def getService(self, transport, service): (source)

Return a class to use as a service for the given transport.

Parameters
transport:`transport.SSHServerTransport` | Undocumented
service:`bytes` | Undocumented

Returns
subclass of `service.SSHService` | Undocumented

def startFactory(self): (source)
overrides `twisted.internet.protocol.Factory.startFactory`

Check for public and private keys.

services = (source)

Undocumented

primes: `dict[int, list[tuple[int, int]]] | None` = (source)

Undocumented

privateKeys = (source)
overridden in `twisted.conch.manhole_ssh.ConchFactory`

Undocumented

publicKeys = (source)
overridden in `twisted.conch.manhole_ssh.ConchFactory`

Undocumented

_log = (source)

Undocumented