Archived Forum Post

Index of archived forum posts

Question:

Known Hosts File Implementation

Jan 08 '16 at 10:31

Having very little experience on this... I have a task to resolve an issue where our .net (C#/ASP) Chilkat v9.4.1.42 client SFTP connection needs to authenticate the host which can be 1 of 4 per the virtual IP load balancing. I'm told we need to add these 4 host public key entries into the known_hosts file. Issue: our Windows 2008 R2 client server apparently has no SSH installed (no dir or known host file found). If I have our SSH tools (bundle including PuTTY, WinSCP etc.) installed on the client server and add these host entries to the known_hosts file... will my .net Chilkat connection magically recognize and authenticate successfully now? Or is there some chilkat connection object property/method I need to modify in the c# code to 'register' these 4 server hosts?

~Thanks in advance to anyone able to offer some guidance. .·´¯·.¸><(((º> ? <º(((><¸¸.·´¯·.¸


Answer

I'll explain how this is a non-issue.

One must remember that Chilkat is an API, whereas these other things (PuTTY, WinSCP, etc.) are applications. The "known host file" is a feature of the application. An API should never assume nor require a specific file such as this. An application may choose to utilize a known hosts file, perhaps it's own private known hosts file, or maybe a "known hosts" database table..

What PuTTY, WinSCP, and these other applications do is (1) connect to the SSH server and then (2) examine the fingerprint of the server's host key, and then (3) check to see if this fingerprint is in the known hosts file, and if not, then interactively give the user a choice..

With Chilkat, your application makes a call to Connect. Once the connection is established, your app may examine the host key fingerprint via the HostKeyFingerprint property. It is up to your app to decide if it wishes to even check the host key fingerprint, and if so, it is up to your app to implement for itself how to persist a collection of "known host key fingerprints" -- perhaps to a file, perhaps to a database table, etc. In summary, Chilkat is not tied to some system file containing known hosts. This functionality is left for your app to decide what it wishes to do..