mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-06 23:30:55 +03:00
@@ -96,7 +96,7 @@ public class DefaultConfig
|
|||||||
|
|
||||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||||
|
|
||||||
private static final String VERSION = "SSHJ_0_8";
|
private static final String VERSION = "SSHJ_0_9_SNAPSHOT";
|
||||||
|
|
||||||
public DefaultConfig() {
|
public DefaultConfig() {
|
||||||
setVersion(VERSION);
|
setVersion(VERSION);
|
||||||
|
|||||||
@@ -683,7 +683,7 @@ public class SSHClient
|
|||||||
|
|
||||||
final long start = System.currentTimeMillis();
|
final long start = System.currentTimeMillis();
|
||||||
trans.doKex();
|
trans.doKex();
|
||||||
log.info("Key exchange took {} seconds", (System.currentTimeMillis() - start) / 1000.0);
|
log.debug("Key exchange took {} seconds", (System.currentTimeMillis() - start) / 1000.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -62,11 +62,11 @@ public class SecurityUtils {
|
|||||||
public void run()
|
public void run()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
if (java.security.Security.getProvider(BOUNCY_CASTLE) == null) {
|
if (java.security.Security.getProvider(BOUNCY_CASTLE) == null) {
|
||||||
LOG.info("Trying to register BouncyCastle as a JCE provider");
|
LOG.debug("Trying to register BouncyCastle as a JCE provider");
|
||||||
java.security.Security.addProvider(new BouncyCastleProvider());
|
java.security.Security.addProvider(new BouncyCastleProvider());
|
||||||
MessageDigest.getInstance("MD5", BOUNCY_CASTLE);
|
MessageDigest.getInstance("MD5", BOUNCY_CASTLE);
|
||||||
KeyAgreement.getInstance("DH", BOUNCY_CASTLE);
|
KeyAgreement.getInstance("DH", BOUNCY_CASTLE);
|
||||||
LOG.info("Registration succeeded");
|
LOG.info("BouncyCastle registration succeeded");
|
||||||
} else
|
} else
|
||||||
LOG.info("BouncyCastle already registered as a JCE provider");
|
LOG.info("BouncyCastle already registered as a JCE provider");
|
||||||
securityProvider = BOUNCY_CASTLE;
|
securityProvider = BOUNCY_CASTLE;
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ public class StreamCopier {
|
|||||||
|
|
||||||
final double timeSeconds = (System.currentTimeMillis() - startTime) / 1000.0;
|
final double timeSeconds = (System.currentTimeMillis() - startTime) / 1000.0;
|
||||||
final double sizeKiB = count / 1024.0;
|
final double sizeKiB = count / 1024.0;
|
||||||
log.info("{} KiB transferred in {} seconds ({} KiB/s)", new Object[] { sizeKiB, timeSeconds, (sizeKiB / timeSeconds) });
|
log.debug("{} KiB transferred in {} seconds ({} KiB/s)", new Object[] { sizeKiB, timeSeconds, (sizeKiB / timeSeconds) });
|
||||||
|
|
||||||
if (length != -1 && read == -1)
|
if (length != -1 && read == -1)
|
||||||
throw new IOException("Encountered EOF, could not transfer " + length + " bytes");
|
throw new IOException("Encountered EOF, could not transfer " + length + " bytes");
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class ConnectionImpl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void attach(Channel chan) {
|
public void attach(Channel chan) {
|
||||||
log.info("Attaching `{}` channel (#{})", chan.getType(), chan.getID());
|
log.debug("Attaching `{}` channel (#{})", chan.getType(), chan.getID());
|
||||||
channels.put(chan.getID(), chan);
|
channels.put(chan.getID(), chan);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ public class ConnectionImpl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void forget(Channel chan) {
|
public void forget(Channel chan) {
|
||||||
log.info("Forgetting `{}` channel (#{})", chan.getType(), chan.getID());
|
log.debug("Forgetting `{}` channel (#{})", chan.getType(), chan.getID());
|
||||||
channels.remove(chan.getID());
|
channels.remove(chan.getID());
|
||||||
synchronized (internalSynchronizer) {
|
synchronized (internalSynchronizer) {
|
||||||
if (channels.isEmpty())
|
if (channels.isEmpty())
|
||||||
@@ -91,13 +91,13 @@ public class ConnectionImpl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void forget(ForwardedChannelOpener opener) {
|
public void forget(ForwardedChannelOpener opener) {
|
||||||
log.info("Forgetting opener for `{}` channels: {}", opener.getChannelType(), opener);
|
log.debug("Forgetting opener for `{}` channels: {}", opener.getChannelType(), opener);
|
||||||
openers.remove(opener.getChannelType());
|
openers.remove(opener.getChannelType());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void attach(ForwardedChannelOpener opener) {
|
public void attach(ForwardedChannelOpener opener) {
|
||||||
log.info("Attaching opener for `{}` channels: {}", opener.getChannelType(), opener);
|
log.debug("Attaching opener for `{}` channels: {}", opener.getChannelType(), opener);
|
||||||
openers.put(opener.getChannelType(), opener);
|
openers.put(opener.getChannelType(), opener);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,7 +187,7 @@ public class ConnectionImpl
|
|||||||
byte[] specifics)
|
byte[] specifics)
|
||||||
throws TransportException {
|
throws TransportException {
|
||||||
synchronized (globalReqPromises) {
|
synchronized (globalReqPromises) {
|
||||||
log.info("Making global request for `{}`", name);
|
log.debug("Making global request for `{}`", name);
|
||||||
trans.write(new SSHPacket(Message.GLOBAL_REQUEST).putString(name)
|
trans.write(new SSHPacket(Message.GLOBAL_REQUEST).putString(name)
|
||||||
.putBoolean(wantReply)
|
.putBoolean(wantReply)
|
||||||
.putRawBytes(specifics));
|
.putRawBytes(specifics));
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ public abstract class AbstractChannel
|
|||||||
this.recipient = recipient;
|
this.recipient = recipient;
|
||||||
rwin = new Window.Remote(remoteWinSize, (int) Math.min(remoteMaxPacketSize, REMOTE_MAX_PACKET_SIZE_CEILING));
|
rwin = new Window.Remote(remoteWinSize, (int) Math.min(remoteMaxPacketSize, REMOTE_MAX_PACKET_SIZE_CEILING));
|
||||||
out = new ChannelOutputStream(this, trans, rwin);
|
out = new ChannelOutputStream(this, trans, rwin);
|
||||||
log.info("Initialized - {}", this);
|
log.debug("Initialized - {}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -220,7 +220,7 @@ public abstract class AbstractChannel
|
|||||||
|
|
||||||
private void gotClose()
|
private void gotClose()
|
||||||
throws TransportException {
|
throws TransportException {
|
||||||
log.info("Got close");
|
log.debug("Got close");
|
||||||
try {
|
try {
|
||||||
closeAllStreams();
|
closeAllStreams();
|
||||||
sendClose();
|
sendClose();
|
||||||
@@ -286,7 +286,7 @@ public abstract class AbstractChannel
|
|||||||
throws TransportException {
|
throws TransportException {
|
||||||
try {
|
try {
|
||||||
if (!closeRequested) {
|
if (!closeRequested) {
|
||||||
log.info("Sending close");
|
log.debug("Sending close");
|
||||||
trans.write(newBuffer(Message.CHANNEL_CLOSE));
|
trans.write(newBuffer(Message.CHANNEL_CLOSE));
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
@@ -313,7 +313,7 @@ public abstract class AbstractChannel
|
|||||||
} catch (Buffer.BufferException be) {
|
} catch (Buffer.BufferException be) {
|
||||||
throw new ConnectionException(be);
|
throw new ConnectionException(be);
|
||||||
}
|
}
|
||||||
log.info("Got chan request for `{}`", reqType);
|
log.debug("Got chan request for `{}`", reqType);
|
||||||
handleRequest(reqType, buf);
|
handleRequest(reqType, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,7 +325,7 @@ public abstract class AbstractChannel
|
|||||||
} catch (Buffer.BufferException be) {
|
} catch (Buffer.BufferException be) {
|
||||||
throw new ConnectionException(be);
|
throw new ConnectionException(be);
|
||||||
}
|
}
|
||||||
log.info("Received window adjustment for {} bytes", howMuch);
|
log.debug("Received window adjustment for {} bytes", howMuch);
|
||||||
rwin.expand(howMuch);
|
rwin.expand(howMuch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,7 +371,7 @@ public abstract class AbstractChannel
|
|||||||
protected Event<ConnectionException> sendChannelRequest(String reqType, boolean wantReply,
|
protected Event<ConnectionException> sendChannelRequest(String reqType, boolean wantReply,
|
||||||
Buffer.PlainBuffer reqSpecific)
|
Buffer.PlainBuffer reqSpecific)
|
||||||
throws TransportException {
|
throws TransportException {
|
||||||
log.info("Sending channel request for `{}`", reqType);
|
log.debug("Sending channel request for `{}`", reqType);
|
||||||
synchronized (chanReqResponseEvents) {
|
synchronized (chanReqResponseEvents) {
|
||||||
trans.write(
|
trans.write(
|
||||||
newBuffer(Message.CHANNEL_REQUEST)
|
newBuffer(Message.CHANNEL_REQUEST)
|
||||||
@@ -407,7 +407,7 @@ public abstract class AbstractChannel
|
|||||||
|
|
||||||
private synchronized void gotEOF()
|
private synchronized void gotEOF()
|
||||||
throws TransportException {
|
throws TransportException {
|
||||||
log.info("Got EOF");
|
log.debug("Got EOF");
|
||||||
eofGot = true;
|
eofGot = true;
|
||||||
eofInputStreams();
|
eofInputStreams();
|
||||||
if (eofSent)
|
if (eofSent)
|
||||||
@@ -424,7 +424,7 @@ public abstract class AbstractChannel
|
|||||||
throws TransportException {
|
throws TransportException {
|
||||||
try {
|
try {
|
||||||
if (!closeRequested && !eofSent) {
|
if (!closeRequested && !eofSent) {
|
||||||
log.info("Sending EOF");
|
log.debug("Sending EOF");
|
||||||
trans.write(newBuffer(Message.CHANNEL_EOF));
|
trans.write(newBuffer(Message.CHANNEL_EOF));
|
||||||
if (eofGot)
|
if (eofGot)
|
||||||
sendClose();
|
sendClose();
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ public final class ChannelInputStream
|
|||||||
synchronized (win) {
|
synchronized (win) {
|
||||||
final long adjustment = win.neededAdjustment();
|
final long adjustment = win.neededAdjustment();
|
||||||
if (adjustment > 0) {
|
if (adjustment > 0) {
|
||||||
log.info("Sending SSH_MSG_CHANNEL_WINDOW_ADJUST to #{} for {} bytes", chan.getRecipient(), adjustment);
|
log.debug("Sending SSH_MSG_CHANNEL_WINDOW_ADJUST to #{} for {} bytes", chan.getRecipient(), adjustment);
|
||||||
trans.write(new SSHPacket(Message.CHANNEL_WINDOW_ADJUST)
|
trans.write(new SSHPacket(Message.CHANNEL_WINDOW_ADJUST)
|
||||||
.putUInt32(chan.getRecipient()).putUInt32(adjustment));
|
.putUInt32(chan.getRecipient()).putUInt32(adjustment));
|
||||||
win.expand(adjustment);
|
win.expand(adjustment);
|
||||||
|
|||||||
@@ -129,10 +129,10 @@ public class LocalPortForwarder {
|
|||||||
log.info("Listening on {}", serverSocket.getLocalSocketAddress());
|
log.info("Listening on {}", serverSocket.getLocalSocketAddress());
|
||||||
while (!Thread.currentThread().isInterrupted()) {
|
while (!Thread.currentThread().isInterrupted()) {
|
||||||
final Socket socket = serverSocket.accept();
|
final Socket socket = serverSocket.accept();
|
||||||
log.info("Got connection from {}", socket.getRemoteSocketAddress());
|
log.debug("Got connection from {}", socket.getRemoteSocketAddress());
|
||||||
openChannel(socket).start();
|
openChannel(socket).start();
|
||||||
}
|
}
|
||||||
log.info("Interrupted!");
|
log.debug("Interrupted!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -66,7 +66,7 @@ public abstract class AbstractForwardedChannel
|
|||||||
@Override
|
@Override
|
||||||
public void confirm()
|
public void confirm()
|
||||||
throws TransportException {
|
throws TransportException {
|
||||||
log.info("Confirming `{}` channel #{}", getType(), getID());
|
log.debug("Confirming `{}` channel #{}", getType(), getID());
|
||||||
// Must ensure channel is attached before confirming, data could start coming in immediately!
|
// Must ensure channel is attached before confirming, data could start coming in immediately!
|
||||||
conn.attach(this);
|
conn.attach(this);
|
||||||
trans.write(newBuffer(Message.CHANNEL_OPEN_CONFIRMATION)
|
trans.write(newBuffer(Message.CHANNEL_OPEN_CONFIRMATION)
|
||||||
@@ -79,7 +79,7 @@ public abstract class AbstractForwardedChannel
|
|||||||
@Override
|
@Override
|
||||||
public void reject(Reason reason, String message)
|
public void reject(Reason reason, String message)
|
||||||
throws TransportException {
|
throws TransportException {
|
||||||
log.info("Rejecting `{}` channel: {}", getType(), message);
|
log.debug("Rejecting `{}` channel: {}", getType(), message);
|
||||||
conn.sendOpenFailure(getRecipient(), reason, message);
|
conn.sendOpenFailure(getRecipient(), reason, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class SocketForwardingConnectListener
|
|||||||
@Override
|
@Override
|
||||||
public void gotConnect(Channel.Forwarded chan)
|
public void gotConnect(Channel.Forwarded chan)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
log.info("New connection from {}:{}", chan.getOriginatorIP(), chan.getOriginatorPort());
|
log.debug("New connection from {}:{}", chan.getOriginatorIP(), chan.getOriginatorPort());
|
||||||
|
|
||||||
final Socket sock = new Socket();
|
final Socket sock = new Socket();
|
||||||
sock.setSendBufferSize(chan.getLocalMaxPacketSize());
|
sock.setSendBufferSize(chan.getLocalMaxPacketSize());
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public abstract class RemoteResource
|
|||||||
@Override
|
@Override
|
||||||
public void close()
|
public void close()
|
||||||
throws IOException {
|
throws IOException {
|
||||||
log.info("Closing `{}`", this);
|
log.debug("Closing `{}`", this);
|
||||||
requester.doRequest(newRequest(PacketType.CLOSE)).ensureStatusPacketIsOK();
|
requester.doRequest(newRequest(PacketType.CLOSE)).ensureStatusPacketIsOK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public class SFTPEngine
|
|||||||
throw new SFTPException("Expected INIT packet, received: " + type);
|
throw new SFTPException("Expected INIT packet, received: " + type);
|
||||||
|
|
||||||
operativeVersion = response.readUInt32AsInt();
|
operativeVersion = response.readUInt32AsInt();
|
||||||
log.info("Server version {}", operativeVersion);
|
log.debug("Server version {}", operativeVersion);
|
||||||
if (MAX_SUPPORTED_VERSION < operativeVersion)
|
if (MAX_SUPPORTED_VERSION < operativeVersion)
|
||||||
throw new SFTPException("Server reported incompatible protocol version: " + operativeVersion);
|
throw new SFTPException("Server reported incompatible protocol version: " + operativeVersion);
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class StatefulSFTPClient
|
|||||||
throws IOException {
|
throws IOException {
|
||||||
super(engine);
|
super(engine);
|
||||||
this.cwd = getSFTPEngine().canonicalize(".");
|
this.cwd = getSFTPEngine().canonicalize(".");
|
||||||
log.info("Start dir = {}", cwd);
|
log.debug("Start dir = {}", cwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized String cwdify(String path) {
|
private synchronized String cwdify(String path) {
|
||||||
@@ -44,7 +44,7 @@ public class StatefulSFTPClient
|
|||||||
if (statExistence(cwd) == null) {
|
if (statExistence(cwd) == null) {
|
||||||
throw new SFTPException(cwd + ": does not exist");
|
throw new SFTPException(cwd + ": does not exist");
|
||||||
}
|
}
|
||||||
log.info("CWD = {}", cwd);
|
log.debug("CWD = {}", cwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized List<RemoteResourceInfo> ls()
|
public synchronized List<RemoteResourceInfo> ls()
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ final class Decoder
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isInvalidPacketLength(len)) { // Check packet length validity
|
if (isInvalidPacketLength(len)) { // Check packet length validity
|
||||||
log.info("Error decoding packet (invalid length) {}", inputBuffer.printHex());
|
log.error("Error decoding packet (invalid length) {}", inputBuffer.printHex());
|
||||||
throw new TransportException(DisconnectReason.PROTOCOL_ERROR, "invalid packet length: " + len);
|
throw new TransportException(DisconnectReason.PROTOCOL_ERROR, "invalid packet length: " + len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ final class Heartbeater
|
|||||||
while (!isInterrupted()) {
|
while (!isInterrupted()) {
|
||||||
final int hi = getPositiveInterval();
|
final int hi = getPositiveInterval();
|
||||||
if (trans.isRunning()) {
|
if (trans.isRunning()) {
|
||||||
log.info("Sending heartbeat since {} seconds elapsed", hi);
|
log.debug("Sending heartbeat since {} seconds elapsed", hi);
|
||||||
trans.write(new SSHPacket(Message.IGNORE));
|
trans.write(new SSHPacket(Message.IGNORE));
|
||||||
}
|
}
|
||||||
Thread.sleep(hi * 1000);
|
Thread.sleep(hi * 1000);
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ final class KeyExchanger
|
|||||||
*/
|
*/
|
||||||
private void sendKexInit()
|
private void sendKexInit()
|
||||||
throws TransportException {
|
throws TransportException {
|
||||||
log.info("Sending SSH_MSG_KEXINIT");
|
log.debug("Sending SSH_MSG_KEXINIT");
|
||||||
clientProposal = new Proposal(transport.getConfig());
|
clientProposal = new Proposal(transport.getConfig());
|
||||||
transport.write(clientProposal.getPacket());
|
transport.write(clientProposal.getPacket());
|
||||||
kexInitSent.set();
|
kexInitSent.set();
|
||||||
@@ -200,7 +200,7 @@ final class KeyExchanger
|
|||||||
|
|
||||||
private void sendNewKeys()
|
private void sendNewKeys()
|
||||||
throws TransportException {
|
throws TransportException {
|
||||||
log.info("Sending SSH_MSG_NEWKEYS");
|
log.debug("Sending SSH_MSG_NEWKEYS");
|
||||||
transport.write(new SSHPacket(Message.NEWKEYS));
|
transport.write(new SSHPacket(Message.NEWKEYS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -354,7 +354,7 @@ final class KeyExchanger
|
|||||||
|
|
||||||
case KEXINIT:
|
case KEXINIT:
|
||||||
ensureReceivedMatchesExpected(msg, Message.KEXINIT);
|
ensureReceivedMatchesExpected(msg, Message.KEXINIT);
|
||||||
log.info("Received SSH_MSG_KEXINIT");
|
log.debug("Received SSH_MSG_KEXINIT");
|
||||||
startKex(false); // Will start key exchange if not already on
|
startKex(false); // Will start key exchange if not already on
|
||||||
/*
|
/*
|
||||||
* We block on this event to prevent a race condition where we may have received a SSH_MSG_KEXINIT before
|
* We block on this event to prevent a race condition where we may have received a SSH_MSG_KEXINIT before
|
||||||
@@ -367,7 +367,7 @@ final class KeyExchanger
|
|||||||
|
|
||||||
case FOLLOWUP:
|
case FOLLOWUP:
|
||||||
ensureKexOngoing();
|
ensureKexOngoing();
|
||||||
log.info("Received kex followup data");
|
log.debug("Received kex followup data");
|
||||||
try {
|
try {
|
||||||
if (kex.next(msg, buf)) {
|
if (kex.next(msg, buf)) {
|
||||||
verifyHost(kex.getHostKey());
|
verifyHost(kex.getHostKey());
|
||||||
@@ -382,7 +382,7 @@ final class KeyExchanger
|
|||||||
case NEWKEYS:
|
case NEWKEYS:
|
||||||
ensureReceivedMatchesExpected(msg, Message.NEWKEYS);
|
ensureReceivedMatchesExpected(msg, Message.NEWKEYS);
|
||||||
ensureKexOngoing();
|
ensureKexOngoing();
|
||||||
log.info("Received SSH_MSG_NEWKEYS");
|
log.debug("Received SSH_MSG_NEWKEYS");
|
||||||
gotNewKeys();
|
gotNewKeys();
|
||||||
setKexDone();
|
setKexDone();
|
||||||
expected = Expected.KEXINIT;
|
expected = Expected.KEXINIT;
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public final class TransportImpl
|
|||||||
private final DisconnectListener nullDisconnectListener = new DisconnectListener() {
|
private final DisconnectListener nullDisconnectListener = new DisconnectListener() {
|
||||||
@Override
|
@Override
|
||||||
public void notifyDisconnect(DisconnectReason reason) {
|
public void notifyDisconnect(DisconnectReason reason) {
|
||||||
log.debug("Default disconnect listener - {}", reason);
|
log.info("Disconnected - {}", reason);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -299,7 +299,7 @@ public final class TransportImpl
|
|||||||
if (service == null)
|
if (service == null)
|
||||||
service = nullService;
|
service = nullService;
|
||||||
|
|
||||||
log.info("Setting active service to {}", service.getName());
|
log.debug("Setting active service to {}", service.getName());
|
||||||
this.service = service;
|
this.service = service;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -346,7 +346,7 @@ public final class TransportImpl
|
|||||||
public long sendUnimplemented()
|
public long sendUnimplemented()
|
||||||
throws TransportException {
|
throws TransportException {
|
||||||
final long seq = decoder.getSequenceNumber();
|
final long seq = decoder.getSequenceNumber();
|
||||||
log.info("Sending SSH_MSG_UNIMPLEMENTED for packet #{}", seq);
|
log.debug("Sending SSH_MSG_UNIMPLEMENTED for packet #{}", seq);
|
||||||
return write(new SSHPacket(Message.UNIMPLEMENTED).putUInt32(seq));
|
return write(new SSHPacket(Message.UNIMPLEMENTED).putUInt32(seq));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -483,7 +483,7 @@ public final class TransportImpl
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IGNORE: {
|
case IGNORE: {
|
||||||
log.info("Received SSH_MSG_IGNORE");
|
log.debug("Received SSH_MSG_IGNORE");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case UNIMPLEMENTED: {
|
case UNIMPLEMENTED: {
|
||||||
@@ -508,7 +508,7 @@ public final class TransportImpl
|
|||||||
try {
|
try {
|
||||||
final boolean display = buf.readBoolean();
|
final boolean display = buf.readBoolean();
|
||||||
final String message = buf.readString();
|
final String message = buf.readString();
|
||||||
log.info("Received SSH_MSG_DEBUG (display={}) '{}'", display, message);
|
log.debug("Received SSH_MSG_DEBUG (display={}) '{}'", display, message);
|
||||||
} catch (Buffer.BufferException be) {
|
} catch (Buffer.BufferException be) {
|
||||||
throw new TransportException(be);
|
throw new TransportException(be);
|
||||||
}
|
}
|
||||||
@@ -549,7 +549,7 @@ public final class TransportImpl
|
|||||||
private void gotUnimplemented(SSHPacket buf)
|
private void gotUnimplemented(SSHPacket buf)
|
||||||
throws SSHException {
|
throws SSHException {
|
||||||
long seqNum = buf.readUInt32();
|
long seqNum = buf.readUInt32();
|
||||||
log.info("Received SSH_MSG_UNIMPLEMENTED #{}", seqNum);
|
log.debug("Received SSH_MSG_UNIMPLEMENTED #{}", seqNum);
|
||||||
if (kexer.isKexOngoing())
|
if (kexer.isKexOngoing())
|
||||||
throw new TransportException("Received SSH_MSG_UNIMPLEMENTED while exchanging keys");
|
throw new TransportException("Received SSH_MSG_UNIMPLEMENTED while exchanging keys");
|
||||||
getService().notifyUnimplemented(seqNum);
|
getService().notifyUnimplemented(seqNum);
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public abstract class AbstractDHG
|
|||||||
sha1.init();
|
sha1.init();
|
||||||
initDH(dh);
|
initDH(dh);
|
||||||
|
|
||||||
log.info("Sending SSH_MSG_KEXDH_INIT");
|
log.debug("Sending SSH_MSG_KEXDH_INIT");
|
||||||
trans.write(new SSHPacket(Message.KEXDH_INIT).putMPInt(dh.getE()));
|
trans.write(new SSHPacket(Message.KEXDH_INIT).putMPInt(dh.getE()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ public abstract class AbstractDHG
|
|||||||
if (msg != Message.KEXDH_31)
|
if (msg != Message.KEXDH_31)
|
||||||
throw new TransportException(DisconnectReason.KEY_EXCHANGE_FAILED, "Unexpected packet: " + msg);
|
throw new TransportException(DisconnectReason.KEY_EXCHANGE_FAILED, "Unexpected packet: " + msg);
|
||||||
|
|
||||||
log.info("Received SSH_MSG_KEXDH_REPLY");
|
log.debug("Received SSH_MSG_KEXDH_REPLY");
|
||||||
final byte[] K_S;
|
final byte[] K_S;
|
||||||
final BigInteger f;
|
final BigInteger f;
|
||||||
final byte[] sig; // signature sent by server
|
final byte[] sig; // signature sent by server
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public class UserAuthImpl
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("Trying `{}` auth...", meth.getName());
|
log.debug("Trying `{}` auth...", meth.getName());
|
||||||
authenticated.clear();
|
authenticated.clear();
|
||||||
currentMethod = meth;
|
currentMethod = meth;
|
||||||
|
|
||||||
@@ -93,13 +93,13 @@ public class UserAuthImpl
|
|||||||
authenticated.await(timeout, TimeUnit.SECONDS);
|
authenticated.await(timeout, TimeUnit.SECONDS);
|
||||||
|
|
||||||
} catch (UserAuthException e) {
|
} catch (UserAuthException e) {
|
||||||
log.info("`{}` auth failed", meth.getName());
|
log.debug("`{}` auth failed", meth.getName());
|
||||||
// Give other methods a shot
|
// Give other methods a shot
|
||||||
saveException(e);
|
saveException(e);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("`{}` auth successful", meth.getName());
|
log.debug("`{}` auth successful", meth.getName());
|
||||||
trans.setAuthenticated(); // So it can put delayed compression into force if applicable
|
trans.setAuthenticated(); // So it can put delayed compression into force if applicable
|
||||||
trans.setService(nextService); // We aren't in charge anymore, next service is
|
trans.setService(nextService); // We aren't in charge anymore, next service is
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class AuthKeyboardInteractive
|
|||||||
for (int i = 0; i < numPrompts; i++) {
|
for (int i = 0; i < numPrompts; i++) {
|
||||||
final String prompt = buf.readString();
|
final String prompt = buf.readString();
|
||||||
final boolean echo = buf.readBoolean();
|
final boolean echo = buf.readBoolean();
|
||||||
log.info("Requesting response for challenge `{}`; echo={}", prompt, echo);
|
log.debug("Requesting response for challenge `{}`; echo={}", prompt, echo);
|
||||||
userReplies[i] = new CharArrWrap(provider.getResponse(prompt, echo));
|
userReplies[i] = new CharArrWrap(provider.getResponse(prompt, echo));
|
||||||
}
|
}
|
||||||
} catch (Buffer.BufferException be) {
|
} catch (Buffer.BufferException be) {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class AuthPassword
|
|||||||
public SSHPacket buildReq()
|
public SSHPacket buildReq()
|
||||||
throws UserAuthException {
|
throws UserAuthException {
|
||||||
final AccountResource accountResource = makeAccountResource();
|
final AccountResource accountResource = makeAccountResource();
|
||||||
log.info("Requesting password for {}", accountResource);
|
log.debug("Requesting password for {}", accountResource);
|
||||||
return super.buildReq() // the generic stuff
|
return super.buildReq() // the generic stuff
|
||||||
.putBoolean(false) // no, we are not responding to a CHANGEREQ
|
.putBoolean(false) // no, we are not responding to a CHANGEREQ
|
||||||
.putSensitiveString(pwdf.reqPassword(accountResource));
|
.putSensitiveString(pwdf.reqPassword(accountResource));
|
||||||
|
|||||||
@@ -23,20 +23,20 @@ public class LoggingTransferListener
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TransferListener directory(String name) {
|
public TransferListener directory(String name) {
|
||||||
log.info("started transferring directory `{}`", name);
|
log.debug("started transferring directory `{}`", name);
|
||||||
return new LoggingTransferListener(relPath + name + "/");
|
return new LoggingTransferListener(relPath + name + "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StreamCopier.Listener file(final String name, final long size) {
|
public StreamCopier.Listener file(final String name, final long size) {
|
||||||
final String path = relPath + name;
|
final String path = relPath + name;
|
||||||
log.info("started transferring file `{}` ({} bytes)", path, size);
|
log.debug("started transferring file `{}` ({} bytes)", path, size);
|
||||||
return new StreamCopier.Listener() {
|
return new StreamCopier.Listener() {
|
||||||
@Override
|
@Override
|
||||||
public void reportProgress(long transferred)
|
public void reportProgress(long transferred)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isTraceEnabled()) {
|
||||||
log.debug("transferred {}% of `{}`", ((transferred * 100) / size), path);
|
log.trace("transferred {}% of `{}`", ((transferred * 100) / size), path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user