diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0d9402..b6a95fa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,7 +54,6 @@ jobs: sudo cat /home/usr/.ssh/authorized_keys sudo cp /home/usr/.ssh/sftptest ${GITHUB_WORKSPACE}/sftp-connector-test/src_test/com/axonivy/connector/sftp/test/sftptest - sudo ssh-keygen -p -P "123456" -N "123456" -m pem -f ${GITHUB_WORKSPACE}/sftp-connector-test/src_test/com/axonivy/connector/sftp/test/sftptest sudo chown "$(whoami)" ${GITHUB_WORKSPACE}/sftp-connector-test/src_test/com/axonivy/connector/sftp/test/sftptest - name: Setup Maven @@ -68,6 +67,7 @@ jobs: - name: Print out log run: | sudo journalctl -u ssh + echo "=======================================================" sudo cat /var/log/auth.log # - name: Publish Unit Test Results diff --git a/sftp-connector/pom.xml b/sftp-connector/pom.xml index 119c50d..6d43de1 100644 --- a/sftp-connector/pom.xml +++ b/sftp-connector/pom.xml @@ -11,9 +11,9 @@ - com.jcraft + com.github.mwiede jsch - 0.1.55 + 0.2.19 diff --git a/sftp-connector/src/com/axonivy/connector/sftp/service/SftpClientService.java b/sftp-connector/src/com/axonivy/connector/sftp/service/SftpClientService.java index a2d2616..72a7316 100644 --- a/sftp-connector/src/com/axonivy/connector/sftp/service/SftpClientService.java +++ b/sftp-connector/src/com/axonivy/connector/sftp/service/SftpClientService.java @@ -63,6 +63,7 @@ public SftpClientService(String host, int port, String username, String authType if (StringUtils.isEmpty(authType) || PASSWORD.equalsIgnoreCase(authType)) { session.setPassword(password); } else { + session.setConfig("PreferredAuthentications", "publickey"); jsch.addIdentity(null, keyString.getBytes(), null, passphrase.getBytes()); }