Hi,

I am trying to upgrade to sshd 0.13.0 in one of my projects and I noticed
that my ssh server key verifier is no longer invoked.

The example program below when running with sshd 0.12.0 will dump the
server public key fingerprint, while with 0.13.0 it is not going to display
anything.
I tested this with various versions of OpenSSH server,

So now with sshd 0.13, when will the server key verifier be invoked?

Regards,
Laszlo

----

package foo.bar;

import org.apache.sshd.ClientSession;
import org.apache.sshd.SshClient;
import org.apache.sshd.client.ServerKeyVerifier;
import org.apache.sshd.common.util.KeyUtils;

import java.io.IOException;
import java.net.SocketAddress;
import java.security.PublicKey;

public class Main {

    static class LogAndAcceptServerKeyVerifier implements ServerKeyVerifier
{

        @Override
        public boolean verifyServerKey(ClientSession sshClientSession,
SocketAddress remoteAddress, PublicKey serverKey) {
            System.out.println("verify: "+remoteAddress);
            System.out.println(KeyUtils.getKeyType(serverKey) + " " +
KeyUtils.getFingerPrint(serverKey));
            return true;
        }
    }

    public static void main(String[] args) throws IOException,
InterruptedException {
        SshClient client = SshClient.setUpDefaultClient();
        client.setServerKeyVerifier(new LogAndAcceptServerKeyVerifier());
        client.start();
        ClientSession session = client.connect("root", "127.0.0.1",
22).await().getSession();
        Thread.sleep(5000);
        session.close(true);
        client.stop();
    }
}





-- 

EOF

Reply via email to