|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.sshd.common.AbstractFactoryManager
org.apache.sshd.SshServer
public class SshServer
The SshServer class is the main entry point for the server side of the SSH protocol.
The SshServer has to be configured before being started. Such configuration can be
done either using a dependency injection mechanism (such as the Spring framework)
or programmatically. Basic setup is usually done using the setUpDefaultServer()
method, which will known ciphers, macs, channels, etc...
Besides this basic setup, a few things have to be manually configured such as the
port number, Factory, the KeyPairProvider
and the PasswordAuthenticator.
Some properties can also be configured using the AbstractFactoryManager.setProperties(java.util.Map)
method.
Once the SshServer instance has been configured, it can be started using the
start() method and stopped using the stop() method.
ServerFactoryManager,
FactoryManager| Field Summary | |
|---|---|
protected org.apache.mina.core.service.IoAcceptor |
acceptor
|
protected int |
backlog
|
protected CommandFactory |
commandFactory
|
protected FileSystemFactory |
fileSystemFactory
|
protected ForwardingFilter |
forwardingFilter
|
protected java.lang.String |
host
|
protected PasswordAuthenticator |
passwordAuthenticator
|
protected int |
port
|
protected PublickeyAuthenticator |
publickeyAuthenticator
|
protected boolean |
reuseAddress
|
protected org.apache.mina.core.session.IoSessionConfig |
sessionConfig
|
protected SessionFactory |
sessionFactory
|
protected Factory<Command> |
shellFactory
|
protected java.util.List<NamedFactory<Command>> |
subsystemFactories
|
protected java.util.List<NamedFactory<UserAuth>> |
userAuthFactories
|
| Fields inherited from class org.apache.sshd.common.AbstractFactoryManager |
|---|
channelFactories, cipherFactories, compressionFactories, keyExchangeFactories, keyPairProvider, macFactories, properties, randomFactory, signatureFactories, version |
| Fields inherited from interface org.apache.sshd.server.ServerFactoryManager |
|---|
MAX_CONCURRENT_SESSIONS, SERVER_IDENTIFICATION |
| Fields inherited from interface org.apache.sshd.common.FactoryManager |
|---|
AUTH_TIMEOUT, MAX_AUTH_REQUESTS, MAX_PACKET_SIZE, WINDOW_SIZE |
| Constructor Summary | |
|---|---|
SshServer()
|
|
| Method Summary | |
|---|---|
protected void |
checkConfig()
|
protected void |
configure(org.apache.mina.core.service.IoAcceptor acceptor)
|
protected org.apache.mina.core.service.IoAcceptor |
createAcceptor()
|
protected SessionFactory |
createSessionFactory()
|
int |
getBacklog()
|
CommandFactory |
getCommandFactory()
Retrieve the CommandFactory to be used to process commands requests. |
FileSystemFactory |
getFileSystemFactory()
Retrieve the FileSystemFactory to be used to traverse the file system. |
ForwardingFilter |
getForwardingFilter()
Retrieve the ForwardingFilter to be used by the SSH server. |
java.lang.String |
getHost()
|
PasswordAuthenticator |
getPasswordAuthenticator()
Retrieve the PasswordAuthenticator to be used by the SSH server. |
int |
getPort()
|
PublickeyAuthenticator |
getPublickeyAuthenticator()
Retrieve the PublickeyAuthenticator to be used by SSH server. |
boolean |
getReuseAddress()
|
org.apache.mina.core.session.IoSessionConfig |
getSessionConfig()
|
SessionFactory |
getSessionFactory()
|
Factory<Command> |
getShellFactory()
Retrieve the ShellFactory object to be used to create shells. |
java.util.List<NamedFactory<Command>> |
getSubsystemFactories()
Retrieve the list of named factories for CommandFactory.Command to
be used to create subsystems. |
java.util.List<NamedFactory<UserAuth>> |
getUserAuthFactories()
Retrieve the list of named factories for UserAuth |
static void |
main(java.lang.String[] args)
|
void |
setBacklog(int backlog)
|
void |
setCommandFactory(CommandFactory commandFactory)
|
void |
setFileSystemFactory(FileSystemFactory fileSystemFactory)
|
void |
setForwardingFilter(ForwardingFilter forwardingFilter)
|
void |
setHost(java.lang.String host)
|
void |
setPasswordAuthenticator(PasswordAuthenticator passwordAuthenticator)
|
void |
setPort(int port)
Configure the port number to use for this SSH server. |
void |
setPublickeyAuthenticator(PublickeyAuthenticator publickeyAuthenticator)
|
void |
setReuseAddress(boolean reuseAddress)
|
void |
setSessionConfig(org.apache.mina.core.session.IoSessionConfig sessionConfig)
|
void |
setSessionFactory(SessionFactory sessionFactory)
|
void |
setShellFactory(Factory<Command> shellFactory)
|
void |
setSubsystemFactories(java.util.List<NamedFactory<Command>> subsystemFactories)
|
static SshServer |
setUpDefaultServer()
|
void |
setUserAuthFactories(java.util.List<NamedFactory<UserAuth>> userAuthFactories)
|
void |
start()
Start the SSH server and accept incoming exceptions on the configured port. |
void |
stop()
Stop the SSH server. |
void |
stop(boolean immediately)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.apache.sshd.common.FactoryManager |
|---|
getChannelFactories, getCipherFactories, getCompressionFactories, getKeyExchangeFactories, getKeyPairProvider, getMacFactories, getProperties, getRandomFactory, getSignatureFactories, getVersion |
| Field Detail |
|---|
protected org.apache.mina.core.service.IoAcceptor acceptor
protected java.lang.String host
protected int port
protected int backlog
protected boolean reuseAddress
protected org.apache.mina.core.session.IoSessionConfig sessionConfig
protected java.util.List<NamedFactory<UserAuth>> userAuthFactories
protected Factory<Command> shellFactory
protected SessionFactory sessionFactory
protected CommandFactory commandFactory
protected FileSystemFactory fileSystemFactory
protected java.util.List<NamedFactory<Command>> subsystemFactories
protected PasswordAuthenticator passwordAuthenticator
protected PublickeyAuthenticator publickeyAuthenticator
protected ForwardingFilter forwardingFilter
| Constructor Detail |
|---|
public SshServer()
| Method Detail |
|---|
public java.lang.String getHost()
public void setHost(java.lang.String host)
public int getPort()
public void setPort(int port)
port - the port number for this SSH serverpublic boolean getReuseAddress()
public void setReuseAddress(boolean reuseAddress)
public int getBacklog()
public void setBacklog(int backlog)
public org.apache.mina.core.session.IoSessionConfig getSessionConfig()
public void setSessionConfig(org.apache.mina.core.session.IoSessionConfig sessionConfig)
public java.util.List<NamedFactory<UserAuth>> getUserAuthFactories()
ServerFactoryManagerUserAuth objects.
- Specified by:
getUserAuthFactories in interface ServerFactoryManager
- Returns:
- a list of named
UserAuth factories, never null
public void setUserAuthFactories(java.util.List<NamedFactory<UserAuth>> userAuthFactories)
public Factory<Command> getShellFactory()
ServerFactoryManagerShellFactory object to be used to create shells.
getShellFactory in interface ServerFactoryManagerShellFactory object or null if shells
are not supported on this serverpublic void setShellFactory(Factory<Command> shellFactory)
public SessionFactory getSessionFactory()
public void setSessionFactory(SessionFactory sessionFactory)
public CommandFactory getCommandFactory()
ServerFactoryManagerCommandFactory to be used to process commands requests.
getCommandFactory in interface ServerFactoryManagerCommandFactory object or null if commands
are not supported on this serverpublic void setCommandFactory(CommandFactory commandFactory)
public FileSystemFactory getFileSystemFactory()
ServerFactoryManagerFileSystemFactory to be used to traverse the file system.
getFileSystemFactory in interface ServerFactoryManagerFileSystemFactory object or null if commands
are not supported on this serverpublic void setFileSystemFactory(FileSystemFactory fileSystemFactory)
public java.util.List<NamedFactory<Command>> getSubsystemFactories()
ServerFactoryManagerCommandFactory.Command to
be used to create subsystems.
getSubsystemFactories in interface ServerFactoryManagerCommandFactory.Command factories
or null if subsystems are not supported on this serverpublic void setSubsystemFactories(java.util.List<NamedFactory<Command>> subsystemFactories)
public PasswordAuthenticator getPasswordAuthenticator()
ServerFactoryManagerPasswordAuthenticator to be used by the SSH server.
If no authenticator has been configured (i.e. this method returns
null), then client authentication requests based on passwords
will be rejected.
getPasswordAuthenticator in interface ServerFactoryManagerPasswordAuthenticator or nullpublic void setPasswordAuthenticator(PasswordAuthenticator passwordAuthenticator)
public PublickeyAuthenticator getPublickeyAuthenticator()
ServerFactoryManagerPublickeyAuthenticator to be used by SSH server.
If no authenticator has been configured (i.e. this method returns
null), then client authentication requests based on keys will be
rejected.
getPublickeyAuthenticator in interface ServerFactoryManagerPublickeyAuthenticato or nullpublic void setPublickeyAuthenticator(PublickeyAuthenticator publickeyAuthenticator)
public ForwardingFilter getForwardingFilter()
ServerFactoryManagerForwardingFilter to be used by the SSH server.
If no filter has been configured (i.e. this method returns
null), then all forwarding requests will be rejected.
getForwardingFilter in interface ServerFactoryManagerForwardingFilter or nullpublic void setForwardingFilter(ForwardingFilter forwardingFilter)
protected void checkConfig()
public void start()
throws java.io.IOException
java.io.IOException
public void stop()
throws java.lang.InterruptedException
java.lang.InterruptedException
public void stop(boolean immediately)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionprotected org.apache.mina.core.service.IoAcceptor createAcceptor()
protected void configure(org.apache.mina.core.service.IoAcceptor acceptor)
protected SessionFactory createSessionFactory()
public static SshServer setUpDefaultServer()
public static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||