|
|||||||||
| 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
public class SshContext
This class defines an SSH context for listening interfaces on the
Daemon.
| Field Summary |
|---|
| 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(ServerComponentManager componentManager)
|
|
| Method Summary | |
|---|---|
void |
addHostKey(com.maverick.ssh.components.SshKeyPair keyPair)
Add a host key to the configuration. |
boolean |
getAllowDeniedKEX()
|
AuthenticationPolicy |
getAllowedAuthentications()
|
AuthenticationMechanismFactory |
getAuthenticationMechanismFactory()
|
String |
getBannerMessage()
Get the authentication banner to display to connecting clients. |
ChannelFactory |
getChannelFactory()
|
int |
getChannelLimit()
Get the maximum number of open channels allowed by each client. |
String |
getCiphersCS()
|
String |
getCiphersSC()
Get the ciphers for the Server->Client stream. |
ServerComponentManager |
getComponentManager()
|
int |
getCompressionLevel()
Get the current compression level |
String |
getDefaultTerminal()
Get the default terminal to execute when the user requests to start a shell. |
FileSystemFactory |
getFileSystemProvider()
Get the FileSystem for
this SSHD instance. |
ForwardingManager |
getForwardingManager()
|
GlobalRequestFactory |
getGlobalRequestFactory()
|
com.maverick.ssh.components.SshKeyPair |
getHostKey(String algorithm)
Get the SSHD host key for a given algorithm. |
com.maverick.ssh.components.SshKeyPair[] |
getHostKeys()
Get all the hosts keys. |
int |
getIdleConnectionTimeoutSeconds()
Should the connection be disconnected on session timeout? |
int |
getKeepAliveDataMaxLength()
Get the maximum data length for the keep-alive packet. |
int |
getKeepAliveInterval()
Get the current keep-alive interval (in seconds). |
Configuration |
getKerberosConfiguration()
Get the custom Kerberos configuration. |
String |
getKerberosDC()
Get the Kerberos domain controller address . |
String |
getKerberosRealm()
Get the realm name to use for GSSAPI Kerberos authentication. |
char[] |
getKerberosServicePassword()
Get the Kerberos service account password. |
String |
getKerberosServicePrincipal()
Get the Kerberos service account password. |
int |
getKeyExchangePacketLimit()
Get the number of packets to send before a key exchange is forced |
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. |
ForwardingPolicy |
getLocalForwardingPolicy()
|
String |
getMacsCS()
Get the ciphers for the Client->Server stream. |
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()
|
int |
getMaxSFTPVersion()
|
String |
getPreferredCipherCS()
Get the currently preferred cipher for the Client->Server stream. |
String |
getPreferredCipherSC()
Get the currently preferred cipher for the Server->Client stream. |
String |
getPreferredCompressionCS()
Get the currently preferred compression for the Client->Server stream. |
String |
getPreferredCompressionSC()
Get the currently preferred compression for the Server->Client stream. |
String |
getPreferredKeyExchange()
Get the currently preferred key exchange method. |
String |
getPreferredMacCS()
Get the currently preferred mac for the Client->Server stream. |
String |
getPreferredMacSC()
Get the currently supported mac for the Server-Client stream. |
String |
getPreferredPublicKey()
Get the currently preferred public key algorithm. |
String |
getPublicKeys()
Get the ciphers for the Server->Client stream. |
boolean |
getRemoteForwardingCancelKillsTunnels()
Determines whether the cancellation of a remote forwarding drops currently active tunnels |
ForwardingPolicy |
getRemoteForwardingPolicy()
|
AuthenticationPolicy |
getRequiredAuthentications()
|
int |
getSessionTimeout()
Returns the session timeout in seconds |
String |
getSFTPCharsetEncoding()
Get the current encoding value for filenames in SFTP sessions. |
ShellPolicy |
getShellPolicy()
|
String |
getSoftwareVersionComments()
Get the software/version/comments field that is to be used in the SSH protocols negotiation procedure. |
String |
getSupportedPublicKeys()
Returns a comma delimited string containing installed public key types. |
String |
getTooManyConnectionsText()
|
boolean |
hasPublicKey(String algorithm)
Determine if the server has a host key configured. |
void |
setAllowDeniedKEX(boolean allowKeyExchangeForDeniedConnection)
|
void |
setAllowedAuthentications(AuthenticationPolicy allowedAuthentications)
|
void |
setAuthenicationMechanismFactory(AuthenticationMechanismFactory authFactory)
|
void |
setBannerMessage(String authenticationBanner)
Set the banner message that is displayed to all connecing clients prior to authentication. |
void |
setChannelFactory(ChannelFactory channelFactory)
|
void |
setChannelLimit(int maxChannels)
Set the maximum number of open channels allowed by each client (defaults to 100). |
void |
setCompressionLevel(int compressionLevel)
Set the compression level to use if compression is enabled |
void |
setDefaultTerminal(String defaultTerminal)
Set the default terminal to execute when the user requests to start a shell. |
void |
setFileSystemFactory(FileSystemFactory filesystemFactory)
Set the FileSystem for
this SSHD instance. |
void |
setForwardingManager(ForwardingManager remoteForwardingManager)
|
void |
setGlobalRequestFactory(GlobalRequestFactory globalRequestFactory)
|
void |
setIdleConnectionTimeoutSeconds(int idleConnectionTimeout)
Inform the context that the connection should be disconnected on session timeout |
void |
setKeepAliveDataMaxLength(int keepAliveDataMaxLength)
Set the maximum data length for the keep-alive packet. |
void |
setKeepAliveInterval(int keepAliveInterval)
Set the keep-alive interval (in seconds). |
void |
setKerberosConfiguration(Configuration kerberosConfiguration)
Set the custom Kerberos configuration. |
void |
setKerberosDC(String kerberosDC)
Set the Kerberos domain controller address . |
void |
setKerberosRealm(String kerberosRealm)
Set the realm name to use for GSSAPI Kerberos authentication. |
void |
setKerberosServicePassword(char[] kerberosServicePassword)
Set the Kerberos service account password. |
void |
setKerberosServicePrincipal(String kerberosServicePrincipal)
Set the Kerberos service account princial. |
void |
setKeyExchangePacketLimit(int MAX_NUM_PACKETS_BEFORE_REKEY)
This tells the server how many packets to use before a key exchange. |
void |
setKeyExchangeTransferLimit(int MAX_NUM_BYTES_BEFORE_REKEY)
This limit tells the server when to force a key exchange. |
void |
setLocalForwardingPolicy(ForwardingPolicy localForwardingPolicy)
|
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 |
setMaxSFTPVersion(int maxSftpVersion)
|
void |
setPreferredCipherCS(String name)
Set the preferred cipher for the Client->Server stream. |
void |
setPreferredCipherSC(String name)
Set the preferred cipher for the Server->Client stream. |
void |
setPreferredCompressionCS(String name)
Set the preferred compression for the Client->Server stream. |
void |
setPreferredCompressionSC(String name)
Set the preferred compression for the Server->Client stream. |
void |
setPreferredKeyExchange(String name)
Set the preferred key exchange method. |
void |
setPreferredMacCS(String name)
Set the preferred MAC for the Client->Server stream. |
void |
setPreferredMacSC(String name)
Set the preferred mac for the Server->Client stream. |
void |
setPreferredPublicKey(String name)
Set the preferred public key algorithm. |
void |
setRemoteForwardingCancelKillsTunnels(boolean killTunnelsOnRemoteForwardingCancel)
When the user cancels a remote forwarding should active tunnels be dropped? |
void |
setRemoteForwardingPolicy(ForwardingPolicy remoteForwardingPolicy)
|
void |
setRequiredAuthentications(AuthenticationPolicy requiredAuthentications)
|
void |
setSessionTimeout(int sessionTimeoutSeconds)
Sets the session timeout in seconds |
void |
setSFTPCharsetEncoding(String sftpCharsetEncoding)
Set the default encoding for filenames in SFTP sessions. |
void |
setShellPolicy(ShellPolicy permissions)
|
void |
setSoftwareVersionComments(String softwareVersionComments)
Set the current implementations software/version/comments field that is used during the SSH protocols negotiation procedure. |
void |
setTooManyConnectionsText(String tooManyConnectionsText)
|
com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshCipher> |
supportedCiphersCS()
|
com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshCipher> |
supportedCiphersSC()
|
com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshCompression> |
supportedCompressionsCS()
|
com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshCompression> |
supportedCompressionsSC()
|
com.maverick.ssh.components.ComponentFactory<SshKeyExchangeServer> |
supportedKeyExchanges()
|
com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshHmac> |
supportedMacsCS()
|
com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshHmac> |
supportedMacsSC()
|
com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshPublicKey> |
supportedPublicKeys()
|
| Methods inherited from class com.maverick.nio.ProtocolContext |
|---|
getReceiveBufferSize, getSendBufferSize, getSocketOptionKeepAlive, getSocketOptionReuseAddress, getSocketOptionTcpNoDelay, setReceiveBufferSize, setSendBufferSize, setSocketOptionKeepAlive, setSocketOptionReuseAddress, setSocketOptionTcpNoDelay |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SshContext()
throws IOException,
com.maverick.ssh.common.SshException
IOException
com.maverick.ssh.common.SshException
public SshContext(ServerComponentManager componentManager)
throws IOException,
com.maverick.ssh.common.SshException
IOException
com.maverick.ssh.common.SshException| Method Detail |
|---|
public ServerComponentManager getComponentManager()
public ShellPolicy getShellPolicy()
public void setShellPolicy(ShellPolicy permissions)
public ChannelFactory getChannelFactory()
public void setChannelFactory(ChannelFactory channelFactory)
public GlobalRequestFactory getGlobalRequestFactory()
public void setGlobalRequestFactory(GlobalRequestFactory globalRequestFactory)
public ForwardingManager getForwardingManager()
public void setForwardingManager(ForwardingManager remoteForwardingManager)
public AuthenticationPolicy getAllowedAuthentications()
public void setAllowedAuthentications(AuthenticationPolicy allowedAuthentications)
public AuthenticationPolicy getRequiredAuthentications()
public void setRequiredAuthentications(AuthenticationPolicy requiredAuthentications)
public ForwardingPolicy getRemoteForwardingPolicy()
public void setRemoteForwardingPolicy(ForwardingPolicy remoteForwardingPolicy)
public ForwardingPolicy getLocalForwardingPolicy()
public void setLocalForwardingPolicy(ForwardingPolicy localForwardingPolicy)
public String getBannerMessage()
public String getSFTPCharsetEncoding()
public int getMaxSFTPVersion()
public void setMaxSFTPVersion(int maxSftpVersion)
public void setSFTPCharsetEncoding(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 String getPreferredCipherCS()
public void setPreferredCipherCS(String name)
throws IOException,
com.maverick.ssh.common.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 -
IOException - if the cipher is not supported
com.maverick.ssh.common.SshExceptionpublic void setBannerMessage(String authenticationBanner)
authenticationBanner - public String getPreferredCipherSC()
public String getSoftwareVersionComments()
public void setSoftwareVersionComments(String softwareVersionComments)
softwareVersionComments -
public void setPreferredCipherSC(String name)
throws IOException,
com.maverick.ssh.common.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 -
IOException
com.maverick.ssh.common.SshExceptionpublic String getPreferredMacCS()
public void setPreferredMacCS(String name)
throws IOException,
com.maverick.ssh.common.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 -
IOException
com.maverick.ssh.common.SshExceptionpublic String getPreferredMacSC()
public void setRemoteForwardingCancelKillsTunnels(boolean killTunnelsOnRemoteForwardingCancel)
killTunnelsOnRemoteForwardingCancel - booleanpublic boolean getRemoteForwardingCancelKillsTunnels()
public int getMaximumPublicKeyVerificationAttempts()
public void setMaximumPublicKeyVerificationAttempts(int maximumPublicKeyVerificationAttempts)
maximumPublicKeyVerificationAttempts - int
public void setPreferredMacSC(String name)
throws IOException,
com.maverick.ssh.common.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 -
IOException
com.maverick.ssh.common.SshExceptionpublic String getPreferredCompressionCS()
public void setPreferredCompressionCS(String name)
throws IOException,
com.maverick.ssh.common.SshException
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 -
IOException
com.maverick.ssh.common.SshExceptionpublic String getPreferredCompressionSC()
public void setPreferredCompressionSC(String name)
throws IOException,
com.maverick.ssh.common.SshException
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 -
IOException
com.maverick.ssh.common.SshExceptionpublic String getPreferredKeyExchange()
public void setPreferredKeyExchange(String name)
throws IOException,
com.maverick.ssh.common.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 -
IOException
com.maverick.ssh.common.SshExceptionpublic String getPreferredPublicKey()
public String getSupportedPublicKeys()
public void setPreferredPublicKey(String name)
throws IOException,
com.maverick.ssh.common.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 -
IOException
com.maverick.ssh.common.SshExceptionpublic com.maverick.ssh.components.SshKeyPair[] getHostKeys()
public com.maverick.ssh.components.SshKeyPair getHostKey(String algorithm)
throws IOException
algorithm -
IOException
public void addHostKey(com.maverick.ssh.components.SshKeyPair keyPair)
throws 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 -
IOExceptionpublic boolean hasPublicKey(String algorithm)
algorithm -
public AuthenticationMechanismFactory getAuthenticationMechanismFactory()
public void setAuthenicationMechanismFactory(AuthenticationMechanismFactory authFactory)
public void setFileSystemFactory(FileSystemFactory filesystemFactory)
Set the FileSystem 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 FileSystemFactory getFileSystemProvider()
FileSystem for
this SSHD instance.
public 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(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 void setCompressionLevel(int compressionLevel)
compressionLevel - intpublic int getCompressionLevel()
public void setAllowDeniedKEX(boolean allowKeyExchangeForDeniedConnection)
public boolean getAllowDeniedKEX()
public int getMaximumSocketsBacklogPerRemotelyForwardedConnection()
public void setMaximumSocketsBacklogPerRemotelyForwardedConnection(int maximumSocketsBacklogPerRemotelyForwardedConnection)
public String getTooManyConnectionsText()
public void setTooManyConnectionsText(String tooManyConnectionsText)
public String getCiphersSC()
public String getCiphersCS()
public String getMacsCS()
public String getMacsSC()
public String getPublicKeys()
public String getKeyExchanges()
public void setMaximumPacketLength(int maximumPacketLength)
maximumPacketLength - intpublic int getMaximumPacketLength()
public void setKeyExchangeTransferLimit(int MAX_NUM_BYTES_BEFORE_REKEY)
MAX_NUM_BYTES_BEFORE_REKEY - intpublic void setKeyExchangePacketLimit(int MAX_NUM_PACKETS_BEFORE_REKEY)
MAX_NUM_PACKETS_BEFORE_REKEY - intpublic int getKeyExchangeTransferLimit()
public int getKeyExchangePacketLimit()
public int getIdleConnectionTimeoutSeconds()
public void setIdleConnectionTimeoutSeconds(int idleConnectionTimeout)
idleConnectionTimeout - public com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshPublicKey> supportedPublicKeys()
public int getKeepAliveInterval()
public void setKeepAliveInterval(int keepAliveInterval)
keepAliveInterval - public int getKeepAliveDataMaxLength()
public void setKeepAliveDataMaxLength(int keepAliveDataMaxLength)
keepAliveDataMaxLength - public String getKerberosRealm()
Configuration has been set using
setKerberosConfiguration(Configuration).
public void setKerberosRealm(String kerberosRealm)
kerberosRealm - kerberos realmpublic String getKerberosDC()
public void setKerberosDC(String kerberosDC)
kerberosDC - kerberos domain controllerpublic char[] getKerberosServicePassword()
public void setKerberosServicePassword(char[] kerberosServicePassword)
kerberosServicePassword - param kerberos service account passwordpublic String getKerberosServicePrincipal()
Configuration has been set using
setKerberosConfiguration(Configuration).
public void setKerberosServicePrincipal(String kerberosServicePrincipal)
Configuration has been set using
setKerberosConfiguration(Configuration).
kerberosServicePrincipal - kerberos service account principalpublic Configuration getKerberosConfiguration()
null.
public void setKerberosConfiguration(Configuration kerberosConfiguration)
null.
kerberosConfiguration - kerberos configurationpublic com.maverick.ssh.components.ComponentFactory<SshKeyExchangeServer> supportedKeyExchanges()
public com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshCipher> supportedCiphersCS()
public com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshCipher> supportedCiphersSC()
public com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshHmac> supportedMacsCS()
public com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshHmac> supportedMacsSC()
public com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshCompression> supportedCompressionsCS()
public com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshCompression> supportedCompressionsSC()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||