Java Code Examples for org.apache.sshd.server.SshServer#setHost()
The following examples show how to use
org.apache.sshd.server.SshServer#setHost() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SshShellConfiguration.java From ssh-shell-spring-boot with Apache License 2.0 | 6 votes |
/** * Construct ssh server thanks to ssh shell properties * * @return ssh server */ @Bean public SshServer sshServer() { SshServer server = SshServer.setUpDefaultServer(); server.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(properties.getHostKeyFile().toPath())); server.setHost(properties.getHost()); server.setPasswordAuthenticator(passwordAuthenticator); server.setPublickeyAuthenticator(RejectAllPublickeyAuthenticator.INSTANCE); if (properties.getAuthorizedPublicKeysFile() != null) { if (properties.getAuthorizedPublicKeysFile().exists() && properties.getAuthorizedPublicKeysFile().canRead()) { server.setPublickeyAuthenticator(new SshShellPublicKeyAuthenticationProvider(properties.getAuthorizedPublicKeysFile())); } else { LOGGER.warn("Could not read authorized public keys file [{}], public key authentication is disabled.", properties.getAuthorizedPublicKeysFile().getAbsolutePath()); } } server.setPort(properties.getPort()); server.setShellFactory(channelSession -> shellCommandFactory); server.setCommandFactory((channelSession, s) -> shellCommandFactory); return server; }
Example 2
Source File: SshdServerConfiguration.java From sshd-shell-spring-boot with Apache License 2.0 | 5 votes |
private SshServer buildServer(Shell props) { SshServer server = SshServer.setUpDefaultServer(); server.setHost(props.getHost()); server.setPort(props.getPort()); configureAuthenticationPolicies(server, props); configureServer(server); return server; }
Example 3
Source File: TestSshTunnel.java From datacollector with Apache License 2.0 | 5 votes |
private SshServer createSshd(PublickeyAuthenticator publickeyAuthenticator, java.security.KeyPair sshdKeyPair) { SshServer sshd = SshServer.setUpDefaultServer(); sshd.setHost("localhost"); sshd.setPort(randomPort()); KeyPairProvider keyPairProvider = KeyPairProvider.wrap(sshdKeyPair); sshd.setKeyPairProvider(keyPairProvider); sshd.setForwardingFilter(AcceptAllForwardingFilter.INSTANCE); sshd.setPublickeyAuthenticator(publickeyAuthenticator); return sshd; }