Skip to content

Commit

Permalink
update jsch to com.github.mwiede:jsch:0.2.19
Browse files Browse the repository at this point in the history
  • Loading branch information
anh-bolt committed Aug 13, 2024
1 parent 739ade0 commit 3c2dc8f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
9 changes: 4 additions & 5 deletions sftp-connector/config/variables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ Variables:
username: 'usr'

# Auth type to the SFPT server: password OR ssh
auth: 'password'
auth: 'ssh'

# The password to the SFTP server
# [password]
password: pwd
password: ''

# The ssh key string to SFTP server
# [secret private key]
secret_sshkey: ''

secret.sshkey: ''
# The ssh key passphrase
secret_sshpassphrase: ''
secret.sshpassphrase: ''
4 changes: 2 additions & 2 deletions sftp-connector/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
</properties>
<dependencies>
<dependency>
<groupId>com.jcraft</groupId>
<groupId>com.github.mwiede</groupId>
<artifactId>jsch</artifactId>
<version>0.1.55</version>
<version>0.2.19</version>
</dependency>
</dependencies>
<pluginRepositories>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Properties;

import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
Expand Down Expand Up @@ -63,6 +64,11 @@ 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");
// Properties config = new Properties();
// config.put("PubkeyAcceptedKeyTypes", "ssh-rsa");
// config.put("HostKeyAlgorithms", "ssh-rsa");
// session.setConfig(config);
jsch.addIdentity(null, keyString.getBytes(), null, passphrase.getBytes());
}

Expand Down

0 comments on commit 3c2dc8f

Please sign in to comment.