apache骆驼中的sftp尝试使用kerberos身份验证

时间:2019-01-31 23:43:48

标签: apache-camel jsch

我的骆驼路线从配置了用户名和密码的sftp终结点拾取文件。在建立连接之前,我会从Kerberos提示输入用户名和密码。 我通过按Enter跳过此操作,然后按预期进行身份验证,我提取了这些文件。 编辑:浏览了版本日志和程序日志后,我并不完全确定这是什么发生了,我无法复制它。 我看到的(一个)带有Kerberos提示的屏幕拷贝与显示由于用户名错误而导致身份验证失败的多个日志之一一致。

为什么我会收到提示?我的端点看起来像这样:

sendEmptyMessageWhenIdle: sendEmptyMessageWhenIdle=true
useHostFile: knownHostsFile=known_hosts&strictHostKeyChecking=yes
workDirectory: /omg/myprogram/${env}/WorkDirectory
fromParams: streamDownload=true&maximumReconnectAttempts=2&throwExceptionOnConnectFailed=true&consumer.bridgeErrorHandler=true&disconnectOnBatchComplete=true
mypassword: password=blablabla
fromUri: sftp://myuser@accept.server.nu:22/TST?${mypassword}
from: ${fromUri}&${sendEmptyMessageWhenIdle}&${routeScheduler}&delete=true&${useHostFile}&localWorkDirectory=${workDirectory}&${fromParams}

实际上,当我不使用主机文件时,会发生相同的事情:

useUserKnownHostsFile=false

骆驼版本为2.22.2。 如何在Apache骆驼中禁用Kerberos?

2 个答案:

答案 0 :(得分:1)

能否请您在SFTP组件上设置preferredAuthentications属性,看看是否有所作为?这是一个示例preferredAuthentications=publickey,keyboard-interactive,password。 FTP组件here的文档。文档说如果不设置此项,该组件将使用JSCH中的默认机制列表。

编辑: 我看到了类似的问题here,但从JSCH角度来看。

答案 1 :(得分:1)

使用提供的用户名和密码进行身份验证失败时,出现Kerberos提示。

也就是说,我无法重现上述问题,但是我发现当用户名不正确时会出现Kerberos提示。

日志:

2019-01-31 12:42:30,767 DEBUG [main] myprogram.StartUpVerneProphet -  -  - Running with Spring Boot v2.0.8.RELEASE, Spring v5.0.12.RELEASE 
2019-01-31 12:42:30,769 INFO  [main] myprogram.StartUpVerneProphet -  -  - No active profile set, falling back to default profiles: default 
2019-01-31 12:42:36,003 WARN  [main] org.apache.camel.component.file.remote.SftpOperations -  -  - JSCH -> Permanently added 'accept.server.nu' (DSA) to the list of known hosts. 
2019-01-31 12:43:01,537 WARN  [main] org.apache.camel.component.file.remote.SftpOperations -  -  - JSCH -> Permanently added 'accept.server.nu' (DSA) to the list of known hosts. 
2019-01-31 12:44:13,940 WARN  [main] org.apache.camel.component.file.remote.SftpOperations -  -  - JSCH -> Permanently added 'accept.server.nu' (DSA) to the list of known hosts. 
2019-01-31 12:44:24,963 WARN  [main] org.apache.camel.component.file.remote.SftpConsumer -  -  - Error auto creating directory: TST due Cannot connect to sftp://faulty-username@accept.server.nu:22. This exception is ignored. org.apache.camel.component.file.GenericFileOperationFailedException: Cannot connect to sftp://faulty-username@accept.server.nu:22
at org.apache.camel.component.file.remote.SftpOperations.connect(SftpOperations.java:144)
at org.apache.camel.component.file.remote.RemoteFileConsumer.connectIfNecessary(RemoteFileConsumer.java:197)

屏幕复制:

12:42:30,761 |-INFO in c.q.l.core.rolling.helper.TimeBasedArchiveRemover - first clean up after appender initialization
12:42:30,763 |-INFO in c.q.l.core.rolling.helper.TimeBasedArchiveRemover - Multiple periods, i.e. 32 periods, seem to have elapsed. This is expected a                                  t application start.
2019-01-31 12:42:30 DEBUG myprogram.StartUp -   -  - Running with Spring Boot v2.0.8.RELEASE, Spr                                  ing v5.0.12.RELEASE
2019-01-31 12:42:30 INFO myprogram.StartUp -   -  - No active profile set, falling back to defau                                  lt profiles: default
2019-01-31 12:42:36 WARN  org.apache.camel.component.file.remote.SftpOperations -   -  - JSCH -> Permanently added 'accept.server.nu' (DSA) to the list of known hosts.
Kerberos username [root]:
Kerberos password for root:
2019-01-31 12:43:01 WARN   org.apache.camel.component.file.remote.SftpOperations -   -  - JSCH -> Permanently added 'accept.server.nu' (DSA) to the list of known hosts.
Kerberos username [root]:
Kerberos password for root:

不幸的是,我只进行了一次屏幕复制,所以我不确定在使用正确的用户名后是否有任何情况出现Kerberos提示符。 至今还没有出现。