/** * Open an ssh session. * * @return the opened session * @throws JSchException * on error */ protected Session openSession() throws JSchException { JSch jsch = new JSch(); if (null != userInfo.getKeyfile()) { jsch.addIdentity(userInfo.getKeyfile()); } if (!userInfo.getTrust() && knownHosts != null) { project.log("Using known hosts: " + knownHosts, Project.MSG_DEBUG); jsch.setKnownHosts(knownHosts); } Session session = jsch.getSession(userInfo.getName(), host, port); session.setUserInfo(userInfo); project.log("Connecting to " + host + ":" + port, Project.MSG_VERBOSE); session.connect(); return session; }
if (!userInfo.getTrust() && knownHosts != null) { log("Using known hosts: " + knownHosts, Project.MSG_DEBUG); jsch.setKnownHosts(knownHosts);
if (!base.getUserInfo().getTrust() && base.getKnownhosts() != null) { base.getPluginLogger().log(Project.MSG_DEBUG, "Using known hosts: " + base.getKnownhosts()); jsch.setKnownHosts(base.getKnownhosts());