【问题标题】:sftp in apache camel tries kerberos authenticationapache camel中的sftp尝试kerberos身份验证
【发布时间】:2019-06-25 12:33:28
【问题描述】:

我的骆驼路线从配置了用户名和密码的 sftp 端点获取文件。在建立连接之前,我会收到来自 Kerberos 的用户名和密码提示。 我按回车键跳过此操作, 身份验证按预期进行,我拾取的文件。 编辑:查看版本控制日志和程序日志后,我不完全确定这是什么发生了,我无法重现它。 我看到我的(一个)屏幕副本与 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 camel 中的 Kerberos?

【问题讨论】:

    标签: apache-camel jsch


    【解决方案1】:

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

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

    【讨论】:

    • 谢谢,我试图重现该问题以尝试您的建议,但这样做我意识到也许我只收到了 kerberos 提示,因为我试图使用错误的用户名登录。我确实在某个时候纠正了这个问题,但我不确定在那之后我是否看到了 Kerberos 提示,就像我说的那样,我无法重现它。
    • 我遇到了这个问题,我可以通过提供 preferredAuthentications=publickey 使 kerberos 提示消失
    【解决方案2】:

    当使用提供的用户名和密码进行身份验证失败时,似乎会出现 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 提示。 今天还没有出现。

    【讨论】:

    • 感谢您提供更多详细信息。题外话,但请考虑使用非特权帐户(不是root)用于此类目的。
    猜你喜欢
    • 2017-06-28
    • 2023-04-02
    • 2017-03-10
    • 2015-06-22
    • 1970-01-01
    • 2018-08-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多