From 23a8065b6b16199f2a1a5bc9e0500c1ef7e24b99 Mon Sep 17 00:00:00 2001 From: "brian.mulier" Date: Thu, 21 Dec 2023 12:34:36 +0100 Subject: [PATCH] fix(sftp): force preferred authentication methods to prevent Kerberos auth --- src/main/java/io/kestra/plugin/fs/sftp/SftpService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/io/kestra/plugin/fs/sftp/SftpService.java b/src/main/java/io/kestra/plugin/fs/sftp/SftpService.java index 39e6743..bf3d282 100644 --- a/src/main/java/io/kestra/plugin/fs/sftp/SftpService.java +++ b/src/main/java/io/kestra/plugin/fs/sftp/SftpService.java @@ -57,6 +57,8 @@ public static FileSystemOptions fsOptions(RunContext runContext, SftpInterface s } if (sftpInterface.getKeyfile() != null) { + instance.setPreferredAuthentications(options, "publickey"); + File sftpKey = runContext.tempFile( runContext.render(sftpInterface.getKeyfile()).getBytes(StandardCharsets.UTF_8) ).toFile(); @@ -69,6 +71,8 @@ public static FileSystemOptions fsOptions(RunContext runContext, SftpInterface s } instance.setIdentityProvider(options, identityInfo); + } else { + instance.setPreferredAuthentications(options, "password"); } return options;