private Session createSession(String host, Args args) throws JSchException { JSch jsch = new JSch(); for (String keyFile : getKeyFiles()) { jsch.addIdentity(keyFile); } JSch.setLogger(new LogAdapter()); Session session = jsch.getSession(args.user, host, args.sshPort); session.setConfig("StrictHostKeyChecking", "no"); return session; }
@Override protected JSch createDefaultJSch(FS fs) throws JSchException { if (GitMonitoringService.this.isJschLoggerEnabled) { JSch.setLogger(new JschLogger()); } JSch defaultJSch = super.createDefaultJSch(fs); defaultJSch.getIdentityRepository().removeAll(); if (GitMonitoringService.this.privateKeyPath != null) { defaultJSch.addIdentity(GitMonitoringService.this.privateKeyPath, GitMonitoringService.this.passphrase); } else { defaultJSch.addIdentity("gaas-git", GitMonitoringService.this.privateKey, null, GitMonitoringService.this.passphrase.getBytes(Charset.forName("UTF-8"))); } if (!Strings.isNullOrEmpty(GitMonitoringService.this.knownHosts)) { defaultJSch.setKnownHosts(new ByteArrayInputStream(GitMonitoringService.this.knownHosts.getBytes(Charset.forName("UTF-8")))); } else if (!Strings.isNullOrEmpty(GitMonitoringService.this.knownHostsFile)) { defaultJSch.setKnownHosts(GitMonitoringService.this.knownHostsFile); } return defaultJSch; } };
int proxyPort = this.state.getPropAsInt(ConfigurationKeys.SOURCE_CONN_USE_PROXY_PORT, -1); JSch.setLogger(new JSchLogger()); JSch jsch = new JSch();
public static void shutdown () { // Set null logger JSch.setLogger (null); } }
/** * Set the thread-inherited logger with a loglevel on Jsch * * @param logger logger * @param loggingLevel level */ private void setThreadLogger(PluginLogger logger, int loggingLevel) { pluginLogger.set(logger); logLevel.set(loggingLevel); JSch.setLogger(this); }
/** * Set the thread-inherited logger with a loglevel on Jsch * * @param logger logger * @param loggingLevel level */ private void setThreadLogger(BaseLogger logger, int loggingLevel) { baseLogger.set(logger); logLevel.set(loggingLevel); JSch.setLogger(this); } /**
public static void init () { // Set static logger JSch.setLogger (new JSchLoggerSLF4J (JSch.class)); }
private Session createSession(String host, Args args) throws JSchException { JSch jsch = new JSch(); for (String keyFile : getKeyFiles()) { jsch.addIdentity(keyFile); } JSch.setLogger(new LogAdapter()); Session session = jsch.getSession(args.user, host, args.sshPort); session.setConfig("StrictHostKeyChecking", "no"); return session; }
private Session createSession(String host, Args args) throws JSchException { JSch jsch = new JSch(); for (String keyFile : getKeyFiles()) { jsch.addIdentity(keyFile); } JSch.setLogger(new LogAdapter()); Session session = jsch.getSession(args.user, host, args.sshPort); session.setConfig("StrictHostKeyChecking", "no"); return session; }
protected void initJsch() { JSch.setConfig("StrictHostKeyChecking", "yes"); JSch.setLogger(new com.jcraft.jsch.Logger() { @Override public boolean isEnabled(int level) { return level == FATAL || level == ERROR ? LOG.isErrorEnabled() : level == WARN ? LOG.isWarnEnabled() : level == INFO ? LOG.isInfoEnabled() : LOG.isDebugEnabled(); } @Override public void log(int level, String message) { if (level == FATAL || level == ERROR) { LOG.error("[JSCH] {}", message); } else if (level == WARN) { LOG.warn("[JSCH] {}", message); } else if (level == INFO) { // JSCH is verbose at INFO logging so allow to turn the noise down and log at DEBUG by default if (isVerboseLogging()) { LOG.info("[JSCH] {}", message); } else { LOG.debug("[JSCH] {}", message); } } else { LOG.debug("[JSCH] {}", message); } } }); }
private Session createSession(String host, Args args) throws JSchException { JSch jsch = new JSch(); for (String keyFile : getKeyFiles()) { jsch.addIdentity(keyFile); } JSch.setLogger(new LogAdapter()); Session session = jsch.getSession(args.user, host, args.sshPort); session.setConfig("StrictHostKeyChecking", "no"); return session; }
private Session createSession(String host, Args args) throws JSchException { JSch jsch = new JSch(); for (String keyFile : getKeyFiles()) { jsch.addIdentity(keyFile); } JSch.setLogger(new LogAdapter()); Session session = jsch.getSession(args.user, host, args.sshPort); session.setConfig("StrictHostKeyChecking", "no"); return session; }
@Override public synchronized void disconnect(boolean force) throws RemoteException { if (sftpSession == null) { // nothing to do LOGGER.log(Level.FINE, "Remote client not created yet => nothing to do"); return; } if (!force && sftpSession.getServerAliveInterval() > 0) { LOGGER.log(Level.FINE, "Keep-alive running and disconnecting not forced -> do nothing"); return; } LOGGER.log(Level.FINE, "Remote client trying to disconnect"); if (sftpSession.isConnected()) { LOGGER.log(Level.FINE, "Remote client connected -> disconnecting"); JSch.setLogger(DEV_NULL_LOGGER); sftpSession.disconnect(); LOGGER.log(Level.FINE, "Remote client disconnected"); } sftpClient = null; sftpSession = null; sftpLogger.info("QUIT"); // NOI18N sftpLogger.info(NbBundle.getMessage(SftpClient.class, "LOG_Goodbye")); }
@Override protected JSch createDefaultJSch(FS fs) throws JSchException { if (GitMonitoringService.this.isJschLoggerEnabled) { JSch.setLogger(new JschLogger()); } JSch defaultJSch = super.createDefaultJSch(fs); defaultJSch.addIdentity(GitMonitoringService.this.privateKeyPath, GitMonitoringService.this.passphrase); return defaultJSch; } };
public static void init() { JSch.setLogger(new JSchLogger()); } }
public static void init() { JSch.setLogger(new JSchLogger()); } }
public static void init() { JSch.setLogger(new JSchLogger()); } }
@Override public void connect(NetconfConnectionDetails connectionDetails) throws APPCException { String host = connectionDetails.getHost(); int port = connectionDetails.getPort(); String username = connectionDetails.getUsername(); String password = connectionDetails.getPassword(); try { JSch.setLogger(new JSchLogger()); JSch jsch = new JSch(); session = jsch.getSession(EncryptionTool.getInstance().decrypt(username), host, port); session.setPassword(EncryptionTool.getInstance().decrypt(password)); session.setConfig("StrictHostKeyChecking", "no"); Properties additionalProps = connectionDetails.getAdditionalProperties(); if((additionalProps != null) && !additionalProps.isEmpty()) { session.setConfig(additionalProps); } session.connect(SESSION_CONNECT_TIMEOUT); session.setTimeout(10000); createConnection(connectionDetails); } catch(Exception e) { String message = EELFResourceManager.format(Msg.CANNOT_ESTABLISH_CONNECTION, host, String.valueOf(port), username); throw new APPCException(message, e); } }
try { JSch.setConfig("StrictHostKeyChecking", "no"); JSch.setLogger(new JschLogger()); final JSch jsch = new JSch(); Logger.debug(
final SSHBase base = this; if (verbose) { JSch.setLogger(new com.jcraft.jsch.Logger() { @Override public boolean isEnabled(final int level) {