|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.maverick.nio.ProtocolContext
com.maverick.sshd.SshContext
This class defines an SSH context for listening interfaces on the
Daemon.
| Field Summary | |
static int |
ANY
|
static java.lang.String |
CIPHER_BLOWFISH_CBC
The Blowfish CBC cipher |
static java.lang.String |
CIPHER_TRIPLEDES_CBC
The 3DES CBC cipher |
static java.lang.String |
COMPRESSION_NONE
Compression off |
static java.lang.String |
COMPRESSION_ZLIB
ZLIB compression |
static java.lang.String |
HMAC_MD5
MD5 message authentication |
static java.lang.String |
HMAC_SHA1
SHA1 message authentication |
static java.lang.String |
KEX_DIFFIE_HELLMAN_GROUP1_SHA1
Currently the one and only key exchange mechanism |
static int |
PASSWORD
|
static java.lang.String |
PASSWORD_AUTHENTICATION
Identifier for password authentication |
static int |
PUBLIC_KEY
|
static java.lang.String |
PUBLIC_KEY_SSHDSS
SSH2 DSA Public Key |
static java.lang.String |
PUBLIC_KEY_SSHRSA
SSH2 RSA Public Key |
static int |
PUBLIC_KEYandPASSWORD
|
static java.lang.String |
PUBLICKEY_AUTHENTICATION
Identifier for public key authentication |
| Fields inherited from class com.maverick.nio.ProtocolContext |
keepAlive, receiveBufferSize, reuseAddress, sendBufferSize, tcpNoDelay |
| Constructor Summary | |
SshContext()
Constructs a default context but does not set the daemon |
|
SshContext(Daemon daemon)
Constructs a default context |
|
| Method Summary | |
void |
addCommand(java.lang.String name,
java.lang.Class cls)
Add an com.maverick.sshd.ExecutableCommand to the configuration. |
void |
addGlobalRequestHandler(GlobalRequestHandler handler)
|
void |
addHostKey(SshKeyPair keyPair)
Add a host key to the configuration. |
void |
addRequiredAuthentication(java.lang.String method)
Set an authentication method as required. |
boolean |
containsCommand(java.lang.String name)
Determine whether a command is configured. |
ProtocolEngine |
createEngine()
Create a protocol engine. |
static SshKeyPair |
GenerateKeyFiles(java.io.File keyFilename,
java.lang.String type,
int bitlength,
int privateKeyFormat,
int publicKeyFormat)
Generate a public and private key pair, save them to keyFilename and keyFilename.pub, return the key pair |
AccessManager |
getAccessManager()
Get the current AccessManager for this configuration. |
boolean |
getAllowDeniedKEX()
|
AuthenticationProvider |
getAuthenticationProvider()
Get the NativeAuthenticationProvider for
this SSHD instance. |
java.lang.String |
getBannerMessage()
Get the authentication banner to display to connecting clients. |
int |
getChannelLimit()
Get the maximum number of open channels allowed by each client. |
java.lang.String |
getCiphersCS()
|
java.lang.String |
getCiphersSC()
Get the ciphers for the Server->Client stream. |
java.lang.Class |
getCommand(java.lang.String name)
Get the Class implementation for a given command. |
int |
getCompressionLevel()
Get the current compression level |
java.lang.String |
getDefaultTerminal()
Get the default terminal to execute when the user requests to start a shell. |
java.lang.Class |
getFileSystemProvider_KeyStore()
|
java.lang.Class |
getFileSystemProvider()
Get the NativeFileSystemProvider for
this SSHD instance. |
ForwardingCallback |
getForwardingCallback()
Get the forwarding callback implementation for this server context. |
GlobalRequestHandler |
getGlobalRequestHandler(java.lang.String requestname)
|
SshKeyPair |
getHostKey(java.lang.String algorithm)
Get the SSHD host key for a given algorithm. |
SshKeyPair[] |
getHostKeys()
Get all the hosts keys. |
int |
getKeyExchangePacketLimit()
Get the number of packets to send before a key exchange is forced |
java.lang.String |
getKeyExchanges()
Get the ciphers for the Server->Client stream. |
int |
getKeyExchangeTransferLimit()
Get the number of bytes to transfer before a key exchange is forced. |
java.lang.String |
getMacsCS()
Get the ciphers for the Client->Server stream. |
java.lang.String |
getMacsSC()
Get the ciphers for the Server->Client stream. |
int |
getMaxAuthentications()
Get the maximum number of failed authentications allowed for each connection. |
int |
getMaximumConnections()
Get the maximum number of connections allowed at any one time. |
int |
getMaximumPacketLength()
Get the maximum supported length of an SSH packet. |
int |
getMaximumPublicKeyVerificationAttempts()
Get the number of public keys that each user can attempt to verify for public key authentication. |
int |
getMaximumSocketsBacklogPerRemotelyForwardedConnection()
|
java.lang.String |
getPreferredCipherCS()
Get the currently preferred cipher for the Client->Server stream. |
java.lang.String |
getPreferredCipherSC()
Get the currently preferred cipher for the Server->Client stream. |
java.lang.String |
getPreferredCompressionCS()
Get the currently preferred compression for the Client->Server stream. |
java.lang.String |
getPreferredCompressionSC()
Get the currently preferred compression for the Server->Client stream. |
java.lang.String |
getPreferredKeyExchange()
Get the currently preferred key exchange method. |
java.lang.String |
getPreferredMacCS()
Get the currently preferred mac for the Client->Server stream. |
java.lang.String |
getPreferredMacSC()
Get the currently supported mac for the Server-Client stream. |
java.lang.String |
getPreferredPublicKey()
Get the currently preferred public key algorithm. |
java.lang.String |
getPublicKeys()
Get the ciphers for the Server->Client stream. |
PublicKeyStore |
getPublicKeyStore()
Get the currently configured public key store for authorizing public keys |
boolean |
getRemoteForwardingCancelKillsTunnels()
Determines whether the cancellation of a remote forwarding drops currently active tunnels |
java.lang.Class |
getRemoteForwardingFactoryImpl()
|
java.lang.Class |
getRemoteForwardingManagerImpl()
|
java.lang.String[] |
getRequiredAuthentications()
Lists the required authentication methods. |
Daemon |
getServer()
Get the instance of the SSHD for this context. |
int |
getSessionTimeout()
Returns the session timeout in seconds |
java.lang.String |
getSFTPCharsetEncoding()
Get the current encoding value for filenames in SFTP sessions. |
java.lang.Class |
getShellCommand()
Get an ExecutableCommand implementation
that provides the default shell. |
java.lang.String |
getSoftwareVersionComments()
Get the software/version/comments field that is to be used in the SSH protocols negotiation procedure. |
java.lang.String |
getSupportedPublicKeys()
Returns a comma delimited string containing installed public key types. |
java.lang.String |
getTooManyConnectionsText()
|
boolean |
hasPublicKey(java.lang.String algorithm)
Determine if the server has a host key configured. |
void |
init(Daemon daemon)
Initialise the SshContext by setting the daemon |
boolean |
isFileSystemAsynchronous()
Get the file system operation mode; asynchronous (spawn a thread for each SFTP session so that file operations are not performed on the selector thread) or synchronous (use the selector thread - may affect performance on slow file systems (e.g. |
SshKeyPair |
loadKey(java.io.File key,
java.lang.String passPhrase)
|
void |
loadKeystore(java.io.File keystoreFile,
java.lang.String alias,
java.lang.String storePassphrase,
java.lang.String keyPassphrase)
Load a keystore for use as an SSH host key. |
void |
loadOrGenerateHostKey(java.io.File key,
java.lang.String type,
int bitlength)
Load a host key from file, if the file does not exist then generate the key. |
void |
loadOrGenerateHostKey(java.io.File key,
java.lang.String type,
int bitlength,
int privateKeyFormat,
int publicKeyFormat,
java.lang.String passPhrase)
Load a host key from file, if the file does not exist then generate the key. |
void |
loadOrGenerateHostKey(java.io.File key,
java.lang.String type,
int bitlength,
java.lang.String passPhrase)
|
void |
setAccessManager(AccessManager accessManager)
If you want to control access to individual SSH features then add an instance of the AccessManager here. |
void |
setAllowDeniedKEX(boolean allowKeyExchangeForDeniedConnection)
|
void |
setAsynchronousFileOperations(boolean asynchronousFileOperations)
Tell the server which file system operation mode to use; asynchronous (spawn a thread for each SFTP session so that file operations are not performed on the selector thread) or synchronous (use the selector thread - may affect performance on slow file systems (e.g networked)) |
void |
setAuthenticationProvider(AuthenticationProvider nativeAuthenticationProvider)
Set the NativeAuthenticationProvider for this SSHD instance. |
void |
setBannerMessage(java.lang.String authenticationBanner)
Set the banner message that is displayed to all connecing clients prior to authentication. |
void |
setChannelLimit(int maxChannels)
Set the maximum number of open channels allowed by each client (defaults to 100). |
void |
setCipherPreferredPositionCS(java.lang.String name,
int position)
|
void |
setCipherPreferredPositionSC(java.lang.String name,
int position)
|
void |
setCompressionLevel(int compressionLevel)
Set the compression level to use if compression is enabled |
void |
setDefaultTerminal(java.lang.String defaultTerminal)
Set the default terminal to execute when the user requests to start a shell. |
void |
setFileSystemProvider_KeyStore(java.lang.Class filesystemProvider_KeyStore)
Set the NFS for the KeyStore. |
void |
setFileSystemProvider(java.lang.Class filesystemProvider)
Set the NativeFileSystemProvider for
this SSHD instance. |
void |
setForwardingCallback(ForwardingCallback forwardingCallback)
Set the forwarding callback implementation for this server context. |
void |
setKeyExchangePacketLimit(int MAX_NUM_PACKETS_BEFORE_REKEY)
This tells the server how many packets to use before a key exchange. |
void |
setKeyExchangePreferredPosition(java.lang.String name,
int position)
|
void |
setKeyExchangeTransferLimit(int MAX_NUM_BYTES_BEFORE_REKEY)
This limit tells the server when to force a key exchange. |
void |
setMacPreferredPositionCS(java.lang.String name,
int position)
|
void |
setMacPreferredPositionSC(java.lang.String name,
int position)
|
void |
setMaxAuthentications(int maxAuthentications)
Set the maximum number of failed authentications allowed for each connection. |
void |
setMaximumConnections(int maximumConnections)
Set the maximum number of connections allowed at any one time. |
void |
setMaximumPacketLength(int maximumPacketLength)
Set the maximum supported length of an SSH packet. |
void |
setMaximumPublicKeyVerificationAttempts(int maximumPublicKeyVerificationAttempts)
Set the number of public keys that a user can verify for public key authentication. |
void |
setMaximumSocketsBacklogPerRemotelyForwardedConnection(int maximumSocketsBacklogPerRemotelyForwardedConnection)
|
void |
setPreferredCipherCS(int[] order)
Set the preferred SC cipher order |
void |
setPreferredCipherCS(java.lang.String name)
Set the preferred cipher for the Client->Server stream. |
void |
setPreferredCipherSC(int[] order)
Set the preferred SC cipher order |
void |
setPreferredCipherSC(java.lang.String name)
Set the preferred cipher for the Server->Client stream. |
void |
setPreferredCompressionCS(java.lang.String name)
Set the preferred compression for the Client->Server stream. |
void |
setPreferredCompressionSC(java.lang.String name)
Set the preferred compression for the Server->Client stream. |
void |
setPreferredKeyExchange(java.lang.String name)
Set the preferred key exchange method. |
void |
setPreferredMacCS(int[] order)
Set the preferred CS Mac order |
void |
setPreferredMacCS(java.lang.String name)
Set the preferred MAC for the Client->Server stream. |
void |
setPreferredMacSC(int[] order)
Set the preferred SC Mac order |
void |
setPreferredMacSC(java.lang.String name)
Set the preferred mac for the Server->Client stream. |
void |
setPreferredPublicKey(java.lang.String name)
Set the preferred public key algorithm. |
void |
setPublicKeyPreferredPosition(java.lang.String name,
int position)
|
void |
setPublicKeyStore(PublicKeyStore publicKeyStore)
For publickey authentication you can optionally provide an alternative key store implementation. |
void |
setRemoteForwardingCancelKillsTunnels(boolean killTunnelsOnRemoteForwardingCancel)
When the user cancels a remote forwarding should active tunnels be dropped? |
void |
setRemoteForwardingFactoryImpl(java.lang.Class remoteForwardingChannelFactory)
|
void |
setRemoteForwardingManagerImpl(java.lang.Class remoteForwardingManagerImpl)
|
void |
setRequiredAuthenticationMethods(int authmethods)
|
void |
setSessionProvider(java.lang.Class sessionProvider)
Set the session provider for this configuration. |
void |
setSessionTimeout(int sessionTimeoutSeconds)
Sets the session timeout in seconds |
void |
setSFTPCharsetEncoding(java.lang.String sftpCharsetEncoding)
Set the default encoding for filenames in SFTP sessions. |
void |
setShellCommand(java.lang.Class shellCommand)
Set an ExecutableCommand implementation
that provides the default shell. |
void |
setSoftwareVersionComments(java.lang.String softwareVersionComments)
Set the current implementations software/version/comments field that is used during the SSH protocols negotiation procedure. |
void |
setTooManyConnectionsText(java.lang.String tooManyConnectionsText)
|
ComponentFactory |
supportedAuthenticationMechanisms()
Get the supported authentication mechanisms. |
ComponentFactory |
supportedChannels()
Get the supported Channel's for this SSHD instance. |
ComponentFactory |
supportedCiphersCS()
Returns a factory implementation that enables configuration of the available ciphers. |
ComponentFactory |
supportedCiphersSC()
|
ComponentFactory |
supportedCompressionsCS()
Get the supported compression algorithms. |
ComponentFactory |
supportedCompressionsSC()
|
ComponentFactory |
supportedKeyExchanges()
Get the supported key exchange methods. |
ComponentFactory |
supportedMacsCS()
Get the supported message authentication algorithms. |
ComponentFactory |
supportedMacsSC()
|
ComponentFactory |
supportedPublicKeys()
|
ComponentFactory |
supportedSubsystems()
Get the supported Subsystem's for this
SSHD instance. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String CIPHER_TRIPLEDES_CBC
public static final java.lang.String CIPHER_BLOWFISH_CBC
public static final java.lang.String HMAC_SHA1
public static final java.lang.String HMAC_MD5
public static final java.lang.String COMPRESSION_NONE
public static final java.lang.String COMPRESSION_ZLIB
public static final java.lang.String KEX_DIFFIE_HELLMAN_GROUP1_SHA1
public static final java.lang.String PUBLIC_KEY_SSHDSS
public static final java.lang.String PUBLIC_KEY_SSHRSA
public static final java.lang.String PASSWORD_AUTHENTICATION
public static final java.lang.String PUBLICKEY_AUTHENTICATION
public static final int ANY
public static final int PUBLIC_KEY
public static final int PASSWORD
public static final int PUBLIC_KEYandPASSWORD
| Constructor Detail |
public SshContext()
throws java.io.IOException
public SshContext(Daemon daemon)
throws java.io.IOException
java.io.IOException| Method Detail |
public ComponentFactory supportedPublicKeys()
public void init(Daemon daemon)
public ProtocolEngine createEngine()
throws java.io.IOException
ProtocolContext
createEngine in class ProtocolContextjava.io.IOException
public void loadOrGenerateHostKey(java.io.File key,
java.lang.String type,
int bitlength)
throws java.io.IOException,
InvalidPassphraseException,
SshException
key - the key filetype - the type of key; acceptable values are SshKeyPairGenerator.SSH2_RSA
or SshKeyPairGenerator.SSH2_DSAbitlength - the bit length of the key
java.io.IOException
SshException
InvalidPassphraseException
public void loadOrGenerateHostKey(java.io.File key,
java.lang.String type,
int bitlength,
java.lang.String passPhrase)
throws java.io.IOException,
InvalidPassphraseException,
SshException
java.io.IOException
InvalidPassphraseException
SshException
public void loadOrGenerateHostKey(java.io.File key,
java.lang.String type,
int bitlength,
int privateKeyFormat,
int publicKeyFormat,
java.lang.String passPhrase)
throws java.io.IOException,
InvalidPassphraseException,
SshException
key - the key filetype - the type of key; acceptable values are SshKeyPairGenerator.SSH2_RSA
or SshKeyPairGenerator.SSH2_DSAbitlength - the bit length of the keyprivateKeyFormat - the format of the private key, SshPrivateKeyFileFactorypublicKeyFormat - the format of the public key, {see com.sshtools.publickey.SshPublicKeyFileFactory}passPhrase - the passPhrase of an existing host key
java.io.IOException
SshException
InvalidPassphraseException
public SshKeyPair loadKey(java.io.File key,
java.lang.String passPhrase)
throws java.io.IOException,
InvalidPassphraseException
java.io.IOException
InvalidPassphraseException
public static SshKeyPair GenerateKeyFiles(java.io.File keyFilename,
java.lang.String type,
int bitlength,
int privateKeyFormat,
int publicKeyFormat)
throws java.io.IOException,
SshException
keyFilename - type - bitlength - privateKeyFormat - publicKeyFormat -
java.io.IOException
SshException
public void loadKeystore(java.io.File keystoreFile,
java.lang.String alias,
java.lang.String storePassphrase,
java.lang.String keyPassphrase)
throws java.io.IOException
keystoreFile - path to the keystore filealias - the alias of the key in the keystorestorePassphrase - the passphrase of the keystorekeyPassphrase - the passphrase of the key
java.io.IOExceptionpublic void addGlobalRequestHandler(GlobalRequestHandler handler)
public GlobalRequestHandler getGlobalRequestHandler(java.lang.String requestname)
public java.lang.Class getRemoteForwardingFactoryImpl()
public java.lang.Class getRemoteForwardingManagerImpl()
public void setRemoteForwardingFactoryImpl(java.lang.Class remoteForwardingChannelFactory)
throws java.io.IOException
java.io.IOException
public void setRemoteForwardingManagerImpl(java.lang.Class remoteForwardingManagerImpl)
throws java.io.IOException
java.io.IOExceptionpublic void setPublicKeyStore(PublicKeyStore publicKeyStore)
publicKeyStore - PublicKeyStorepublic PublicKeyStore getPublicKeyStore()
public java.lang.String[] getRequiredAuthentications()
public void addRequiredAuthentication(java.lang.String method)
Set an authentication method as required. You can have multiple required
authentications but by default none are required, although at least one authentication
MUST be performed. For example to require both password and publickey authentication
use the following statements in the SshDaemon#configure(ConfigurationContext)
method.
context.addRequiredAuthentication(ConfigurationContext.PUBLICKEY_AUTHENTICATION); context.addRequiredAuthentication(ConfigurationContext.PASSWORD_AUTHENTICATION);
method - Stringpublic java.lang.String getBannerMessage()
public Daemon getServer()
public java.lang.String getSFTPCharsetEncoding()
public void setSFTPCharsetEncoding(java.lang.String sftpCharsetEncoding)
sftpCharsetEncoding - Stringpublic int getSessionTimeout()
public void setSessionTimeout(int sessionTimeoutSeconds)
sessionTimeoutSeconds - intpublic void setChannelLimit(int maxChannels)
maxChannels - public int getChannelLimit()
public int getMaxAuthentications()
public void setMaxAuthentications(int maxAuthentications)
maxAuthentications - public void setMaximumConnections(int maximumConnections)
maximumConnections - intpublic int getMaximumConnections()
public ComponentFactory supportedCiphersCS()
Returns a factory implementation that enables configuration of the available ciphers.
The standard default ciphers installed are 3DES and Blowfish, however the
J2SSH Maverick API on which this server is based also supports a number
of optional ciphers AES, CAST and Twofish. These can be installed by
adding the sshtools-cipher.jar to your class path and using
the following code within your SSHD
SshDaemon#configure(ConfigurationContext) method.
// import the cipher package import com.sshtools.cipher.*; // Add AES context.supportedCiphers().add(AES128Cbc.AES128_CBC, AES128Cbc.class); context.supportedCiphers().add(AES192Cbc.AES192_CBC, AES192Cbc.class); context.supportedCiphers().add(AES256Cbc.AES256_CBC, AES256Cbc.class); // Add Twofish - note the 256 bit cipher has two different entries to maintain backwards compatibility context.supportedCiphers().add(Twofish128Cbc.TWOFISH128_CBC, Twofish128Cbc.class); context.supportedCiphers().add(Twofish192Cbc.TWOFISH192_CBC, Twofish192Cbc.class); context.supportedCiphers().add(Twofish256Cbc.TWOFISH256_CBC, Twofish256Cbc.class); context.supportedCiphers().add(Twofish256Cbc.TWOFISH_CBC, Twofish256Cbc.class); // Add CAST context.supportedCiphers().add(CAST128Cbc.CAST128_CBC, CAST128Cbc.class);
public ComponentFactory supportedCiphersSC()
public void setAsynchronousFileOperations(boolean asynchronousFileOperations)
asynchronousFileOperations - public boolean isFileSystemAsynchronous()
public java.lang.String getPreferredCipherCS()
public void setPreferredCipherCS(java.lang.String name)
throws java.io.IOException,
SshException
Set the preferred cipher for the Client->Server stream.
Use the static fields available within this class (or the com.sshtools.cipher classes) to identify the correct cipher.
context.setPreferredCipherCS(ConfigurationContext.CIPHER_BLOWFISH_CBC);
name -
java.io.IOException - if the cipher is not supported
SshExceptionpublic void setAccessManager(AccessManager accessManager)
AccessManager here. The AccessManager is consulted
before a user is allowed to connect, start a shell, execute a command or
start a port forwarding connection.
accessManager - public AccessManager getAccessManager()
AccessManager for this configuration.
public void setBannerMessage(java.lang.String authenticationBanner)
authenticationBanner - public java.lang.String getPreferredCipherSC()
public java.lang.String getSoftwareVersionComments()
public void setSoftwareVersionComments(java.lang.String softwareVersionComments)
softwareVersionComments -
public void setPreferredCipherSC(java.lang.String name)
throws java.io.IOException,
SshException
Set the preferred cipher for the Server->Client stream.
Use the static fields available within this class (or the com.sshtools.cipher classes) to identify the correct cipher.
context.setPreferredCipherSC(ConfigurationContext.CIPHER_BLOWFISH_CBC);
name -
java.io.IOException
SshExceptionpublic ComponentFactory supportedMacsCS()
Get the supported message authentication algorithms.
There are no optional MAC algorithms currently available and this method is supplied in preperation for future enhancements.
public ComponentFactory supportedMacsSC()
public java.lang.String getPreferredMacCS()
public void setPreferredMacCS(java.lang.String name)
throws java.io.IOException,
SshException
Set the preferred MAC for the Client->Server stream.
Use the static fields available within this class to identify the correct MAC.
context.setPreferredMacCS(ConfigurationContext.HMAC_MD5);
name -
java.io.IOException
SshExceptionpublic java.lang.String getPreferredMacSC()
public void setRemoteForwardingCancelKillsTunnels(boolean killTunnelsOnRemoteForwardingCancel)
killTunnelsOnRemoteForwardingCancel - booleanpublic boolean getRemoteForwardingCancelKillsTunnels()
public int getMaximumPublicKeyVerificationAttempts()
public void setMaximumPublicKeyVerificationAttempts(int maximumPublicKeyVerificationAttempts)
maximumPublicKeyVerificationAttempts - int
public void setPreferredMacSC(java.lang.String name)
throws java.io.IOException,
SshException
Set the preferred mac for the Server->Client stream.
Use the static fields available within this class to identify the correct MAC.
context.setPreferredMacCS(ConfigurationContext.HMAC_MD5);
name -
java.io.IOException
SshExceptionpublic ComponentFactory supportedCompressionsCS()
Get the supported compression algorithms.
There are no optional compression algorithms currently available and this method is supplied in preperation for future enhancements.
public ComponentFactory supportedCompressionsSC()
public java.lang.String getPreferredCompressionCS()
public void setPreferredCompressionCS(java.lang.String name)
throws java.io.IOException
Set the preferred compression for the Client->Server stream.
It is recommended that you do not set the preferred compression so that the client has control over the compression selection.
name -
java.io.IOExceptionpublic java.lang.String getPreferredCompressionSC()
public void setPreferredCompressionSC(java.lang.String name)
throws java.io.IOException
Set the preferred compression for the Server->Client stream.
It is recommended that you do not set the preferred compression so that the client has control over the compression selection.
name -
java.io.IOExceptionpublic ComponentFactory supportedKeyExchanges()
Get the supported key exchange methods.
There are no optional key exchange algorithms currently available and this method is supplied in preperation for future enhancements.
public java.lang.String getPreferredKeyExchange()
public void setPreferredKeyExchange(java.lang.String name)
throws java.io.IOException,
SshException
Set the preferred key exchange method.
There is only one supported key exchange algorithm and as such this method is supplied in preperation for future enhancements.
name -
java.io.IOException
SshExceptionpublic java.lang.String getPreferredPublicKey()
public java.lang.String getSupportedPublicKeys()
public void setPreferredPublicKey(java.lang.String name)
throws java.io.IOException,
SshException
Set the preferred public key algorithm.
This value must be one of the installed public key algorithm names.
You will be able to obtain these from the public keys that you installed using ??????
and an example of how to do this is provided in the
ConfigurationContext#addHostKey(SshKeyPair) method description.
name -
java.io.IOException
SshExceptionpublic SshKeyPair[] getHostKeys()
public SshKeyPair getHostKey(java.lang.String algorithm)
throws java.io.IOException
algorithm -
java.io.IOException
public void addHostKey(SshKeyPair keyPair)
throws java.io.IOException
Add a host key to the configuration.
A host key provides a mechanism for a client to authenticate the server. If the client knows the public key of the server it can validate the signature that the server generated using its private key with the known public key of the server. In order for your server to operate you need to generate and install at least one host key.
It is now recommended to use the
SshDaemon#loadOrGenerateHostKey(File, String, int, ConfigurationContext)
method for generating and loading a host key.
keyPair -
java.io.IOException
public void addCommand(java.lang.String name,
java.lang.Class cls)
com.maverick.sshd.ExecutableCommand to the configuration.
If a request to execute a command with the name name is received
an instance of the class is created to handle the command execution.
name - Stringcls - Classpublic boolean containsCommand(java.lang.String name)
name - String
public java.lang.Class getCommand(java.lang.String name)
name - String
public java.lang.Class getShellCommand()
ExecutableCommand implementation
that provides the default shell.
public void setShellCommand(java.lang.Class shellCommand)
ExecutableCommand implementation
that provides the default shell.
shellCommand - public boolean hasPublicKey(java.lang.String algorithm)
algorithm -
public ComponentFactory supportedAuthenticationMechanisms()
Get the supported authentication mechanisms.
If you have implemented your own AuthenticationMechanism you
can add it to the factory object returned by this method.
context.supportedAuthenticationMechanisms().add("secureID",
SecureIDAuthentication.class);
public void setAuthenticationProvider(AuthenticationProvider nativeAuthenticationProvider)
Set the NativeAuthenticationProvider for this SSHD instance.
public AuthenticationProvider getAuthenticationProvider()
NativeAuthenticationProvider for
this SSHD instance.
public void setFileSystemProvider(java.lang.Class filesystemProvider)
Set the NativeFileSystemProvider for
this SSHD instance.
This uses a class object rather so that the server can manage the creation of instances of this class.
filesystemProvider - public void setFileSystemProvider_KeyStore(java.lang.Class filesystemProvider_KeyStore)
filesystemProvider_KeyStore - public java.lang.Class getFileSystemProvider()
NativeFileSystemProvider for
this SSHD instance.
public java.lang.Class getFileSystemProvider_KeyStore()
public void setSessionProvider(java.lang.Class sessionProvider)
sessionProvider - public java.lang.String getDefaultTerminal()
Get the default terminal to execute when the user requests to start a shell.
This setting is not used explicitly by the server but is available from
the context so that a session implementation can obtain it through the
protected ConnectionProtocol instance.
public void setDefaultTerminal(java.lang.String defaultTerminal)
Set the default terminal to execute when the user requests to start a shell.
This setting is not used explicitly by the server but is available from
the context so that a session implementation can obtain it through the
protected ConnectionProtocol instance.
defaultTerminal - public ComponentFactory supportedChannels()
Get the supported Channel's for this SSHD instance.
If you have implemented a custom channel you can use the factory object returned by this method to install the channel.
context.supportedChannels().add("mychannel", MyChannel.class);
public ComponentFactory supportedSubsystems()
Get the supported Subsystem's for this
SSHD instance.
If you have implemented a custom subsystem you can use the factory object returned by this method to install the new subsystem.
context.supportedSubsystems().add("mysubsystem", MySubsystem.class);
public void setCompressionLevel(int compressionLevel)
compressionLevel - intpublic int getCompressionLevel()
public void setAllowDeniedKEX(boolean allowKeyExchangeForDeniedConnection)
public void setRequiredAuthenticationMethods(int authmethods)
public boolean getAllowDeniedKEX()
public int getMaximumSocketsBacklogPerRemotelyForwardedConnection()
public void setMaximumSocketsBacklogPerRemotelyForwardedConnection(int maximumSocketsBacklogPerRemotelyForwardedConnection)
public java.lang.String getTooManyConnectionsText()
public void setTooManyConnectionsText(java.lang.String tooManyConnectionsText)
public java.lang.String getCiphersSC()
public java.lang.String getCiphersCS()
public java.lang.String getMacsCS()
public java.lang.String getMacsSC()
public java.lang.String getPublicKeys()
public java.lang.String getKeyExchanges()
public void setPreferredCipherSC(int[] order)
throws SshException
SshException
public void setPreferredCipherCS(int[] order)
throws SshException
SshException
public void setPreferredMacSC(int[] order)
throws SshException
SshException