Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

New SSH server key added every time I trigger a call-home, not checking the known_host file. #1618

Closed
safwan2m opened this issue Aug 5, 2024 · 3 comments · Fixed by CESNET/libnetconf2#500
Labels
is:enhancement Request for adding new feature or enahncing functionality. status:completed From the developer perspective, the issue was solved (bug fixed, question answered,...)

Comments

@safwan2m
Copy link

safwan2m commented Aug 5, 2024

When SSH connection establishment is to be done using the call-home message, the program does not check for the known_hosts file and keeps on adding SSH keys. I believe this is an issue, while I went through the netopeer2 and libnetconf2 code, didn't find any code to check the known_hosts file. Please let me know if it is otherwise.

@Roytak
Copy link
Collaborator

Roytak commented Aug 7, 2024

Hi, I believe the client checks for the known_hosts file each time a Call Home connection is established. Even though an entry with a matching public key can be found in the known_hosts file, a new entry gets created "each time", because the port of the server trying to connect is generated randomly and the new port number most likely does not match any entry in said file.

This should be resolved once the YANG feature local-binding-supported of the ietf-tcp-client YANG model is supported and implemented. Then you would be able to configure the port and the address of where these connections are coming from. Or perhaps a new option could be added for netopeer2-cli's knownhosts command that would enable for changing the known hosts mode (which is set to ask by default).

@Roytak Roytak added the is:question Issue is actually a question. label Aug 7, 2024
@michalvasko michalvasko added is:enhancement Request for adding new feature or enahncing functionality. status:completed From the developer perspective, the issue was solved (bug fixed, question answered,...) and removed is:question Issue is actually a question. labels Aug 12, 2024
@safwan2m
Copy link
Author

I was trying to write my own netconf client code, following the netopeer2-cli, but couldn't find any function that checks for the known_hosts in the cmd_listen. Later was able to avoid adding new keys for every callhome, using this callback nc_client_ssh_ch_set_auth_hostkey_check_clb. Not sure, if it's the right way to do it, but it solves my current issue.
Thanks for your response @Roytak.

@michalvasko
Copy link
Member

The function that configures hostkey verification is nc_client_ssh_set_knownhosts_mode().

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
is:enhancement Request for adding new feature or enahncing functionality. status:completed From the developer perspective, the issue was solved (bug fixed, question answered,...)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants