server.setPasswordAuthenticator(new PasswordAuthenticator() { public boolean authenticate(String _username, String _password, ServerSession session) { if (genericAuthenticate(String.class, _username, _password)) {
public SshShell() { sshd = SshServer.setUpDefaultServer(); File clerezzaUserConfigDir = new File(new File(System.getProperty("user.home")), ".clerezza"); if (!clerezzaUserConfigDir.exists()) { clerezzaUserConfigDir.mkdir(); } File hostKeyDir = new File(clerezzaUserConfigDir, "ssh"); if (!hostKeyDir.exists()) { hostKeyDir.mkdir(); } sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(new File(hostKeyDir,"hostkey.ser").getAbsolutePath())); sshd.setPasswordAuthenticator(new MyPasswordAuthenticator()); }
public void start() { sshServer = SshServer.setUpDefaultServer(); sshServer.setPort(port); sshServer.setHost("0.0.0.0"); final String basePath = new File(System.getProperty("user.dir")).getAbsolutePath(); if (SecurityUtils.isBouncyCastleRegistered()) { sshServer.setKeyPairProvider(new PEMGeneratorHostKeyProvider(new File(basePath, KEY_NAME + ".pem") .getPath())); } else { sshServer.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(new File(basePath, KEY_NAME + ".ser") .getPath())); } sshServer.setShellFactory(new CrestComandsFactory(session, securityHandler)); sshServer.setPasswordAuthenticator(new PasswordAuthenticatorImpl(securityHandler)); try { sshServer.start(); } catch (IOException e) { e.printStackTrace(); } }
userAuthFactories.add(new UserAuthPassword.Factory()); sshServer.setUserAuthFactories(userAuthFactories); sshServer.setPasswordAuthenticator(new PasswordAuthenticator() { @Override public boolean authenticate(String username, String password, ServerSession session) {
sshd.setPasswordAuthenticator(new PasswordAuthenticator()
@Override public void initialize(int port) { Security.addProvider(new BouncyCastleProvider()); sshd = SshServer.setUpDefaultServer(); sshd.setPort(port); StreamKeyPairProvider fileKeyPairProvider = new StreamKeyPairProvider(); sshd.setKeyPairProvider(fileKeyPairProvider); SftpSubsystem.Factory factory = new SftpSubsystem.Factory(); sshd.setSubsystemFactories(Arrays.<NamedFactory<Command>>asList(factory)); sshd.setCommandFactory(new ScpCommandFactory()); sshd.setShellFactory(new ProcessShellFactory()); sshd.setPasswordAuthenticator(new MockPasswordAuthenticator()); }
sshd.setCommandFactory(new ScpCommandFactory()); sshd.setShellFactory(new ProcessShellFactory(new String[] { "/system/bin/sh", "-i", "-l" })); // necessary if you want to type commands over ssh sshd.setPasswordAuthenticator(new PasswordAuthenticator() {
public void startSSHServer() { int port = 8888; SshServer sshd = SshServer.setUpDefaultServer(); sshd.setPort(port); sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider( "src/test/resources/hostkey.ser")); sshd.setSubsystemFactories(Arrays .<NamedFactory<Command>> asList(new SftpSubsystem.Factory())); sshd.setCommandFactory(new ScpCommandFactory()); sshd.setShellFactory(new ProcessShellFactory(new String[] { "/system/bin/sh", "-i", "-l" })); // necessary if you want to type commands over ssh sshd.setPasswordAuthenticator(new PasswordAuthenticator() { @Override public boolean authenticate(String u, String p, ServerSession s) { return ("sftptest".equals(u) && "sftptest".equals(p)); } }); try { sshd.start(); } catch (IOException e) { e.printStackTrace(); } }
void init(Context context, Device device) throws Exception { sshd.setKeyExchangeFactories(Arrays.asList( new DHG14.Factory(), new DHG1.Factory())); //Reuse this device keys for the ssh connection as well final KeyPair keyPair; PrivateKey privateKey = RsaHelper.getPrivateKey(context); PublicKey publicKey = RsaHelper.getPublicKey(context); keyPair = new KeyPair(publicKey, privateKey); sshd.setKeyPairProvider(new AbstractKeyPairProvider() { @Override public Iterable<KeyPair> loadKeys() { return Collections.singletonList(keyPair); } }); sshd.setFileSystemFactory(new AndroidFileSystemFactory(context)); sshd.setCommandFactory(new ScpCommandFactory()); sshd.setSubsystemFactories(Collections.singletonList(new SftpSubsystem.Factory())); if (device.publicKey != null) { keyAuth.deviceKey = device.publicKey; } else { keyAuth.deviceKey = device.certificate.getPublicKey(); } sshd.setPublickeyAuthenticator(keyAuth); sshd.setPasswordAuthenticator(passwordAuth); }
result.setPort(22); result.setKeyPairProvider(new SimpleGeneratorHostKeyProvider("hostkey.ser")); result.setPasswordAuthenticator(new PasswordAuthenticator() { public boolean authenticate(String username, String password, ServerSession session) { return "assentisftp".equals(username);
server.setPasswordAuthenticator(new PasswordAuthenticator() { public boolean authenticate(String _username, String _password, ServerSession session) { if (genericAuthenticate(String.class, _username, _password)) {
@SuppressWarnings("unchecked") final AuthenticationPlugin<String> passwordAuthentication = (AuthenticationPlugin<String>)authentication; server.setPasswordAuthenticator(new PasswordAuthenticator() { public boolean authenticate(String _username, String _password, ServerSession session) { boolean auth;
@BeforeClass public static void createServer() throws Exception { server = SshServer.setUpDefaultServer(); server.setPasswordAuthenticator(new PasswordAuthenticator() { @Override public boolean authenticate(String username, String password, org.apache.sshd.server.session.ServerSession session) { return true; } }); server.setPort(port); server.setKeyPairProvider(new SimpleGeneratorHostKeyProvider("hostkey.ser")); SftpSubsystem.Factory sftp = new SftpSubsystem.Factory(); server.setSubsystemFactories(Arrays.<NamedFactory<Command>>asList(sftp)); server.setFileSystemFactory(new NativeFileSystemFactory() { @Override public FileSystemView createFileSystemView(org.apache.sshd.common.Session session) { return new NativeFileSystemView(session.getUsername(), false) { @Override public String getVirtualUserDir() { return remoteTemporaryFolder.getRoot().getAbsolutePath(); } }; } }); server.start(); }
sshd.setPasswordAuthenticator( this.passwordAuthenticator );
sshd.setPasswordAuthenticator( this.passwordAuthenticator );
sshServer.setPasswordAuthenticator(new PasswordAuthenticator() { @Override public boolean authenticate(
@Override protected void startServer(PrintJid out, RP rp) throws Exception { registerSshServers(); out.println("ssh port: " + sshPort()); sshd = SshServer.setUpDefaultServer(); sshd.setPasswordAuthenticator(node().passwordAuthenticator()); sshd.setPort(sshPort()); sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider("hostkey.ser")); setShellFactory(); sshd.start(); super.startServer(out, rp); }
Server.setPasswordAuthenticator(new PasswordAuthenticator() { @Override public boolean authenticate(final String username, final String password, final ServerSession session) {
Server.setPasswordAuthenticator(new PasswordAuthenticator() { @Override public boolean authenticate(final String username, final String password, final ServerSession session) {
Server.setPasswordAuthenticator(new PasswordAuthenticator()