Skip to content
Advertisement

JSCH -> Permanently added ‘my.host.com’ (RSA) to the list of known hosts (bug)

I have a file on an SFTP server and my application reads this file line by line. From the point of view of the application, everything is fine. The file is processed and everything works as expected. But there is one oddity. My application is continuously (one message per minutes) printing this message in the log:

2021-07-09 09:18:10.387 WARN 1 --- [com:22/out/Test] o.a.c.c.file.remote.SftpOperations : JSCH -> Permanently added 'my.host.com' (RSA) to the list of known hosts.

I am using version 3.9.0 for camel-spring-boot-starter and camel-ftp. This is how the connection address looks like: sftp://username@my.host.com:22/out/Test?fileName=myfile.txt&privateKeyFile=/usr/src/app/mykey.dat&delete=true&initialDelay=60000&delay=60000&recursive=true&disconnect=true&useUserKnownHostsFile=false

I see a similar resolved issue on Jira. Do we have a chance that this issue wasn’t resolved or this fix didn’t get on these dependencies?

Advertisement

Answer

By default, the Camel SFTP component sets parameter strictHostKeyChecking to no (always insert the new host key). JSch logs that warning when it inserts a new host key. Because you set parameter useUserKnownHostsFile=false and did not specify a known hosts file, JSch does not persistently remember the new host key, so it always inserts the host key and logs that warning on subsequent connections.

I work around this issue by configuring the logger to suppress that warning:

logging.level:
  org.apache.camel.component.file.remote: ERROR
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement