Pure-Rust asynchronous SSH library, both client and server

#44 Don't add random keys to the ssh agent when running tests.

Opened by Freax13 on August 2, 2021
Freax13 on August 2, 2021

Currently thrussh has one test and one example that each add an ssh key to the ssh agent: Line 202 in https://nest.pijul.com/pijul/thrussh:main/7FRJYUI62VW24.OBAAI Line 54 in https://nest.pijul.com/pijul/thrussh:main/KGIUIQYIBBUEG.C4AAA

Please don’t do this. I executed the tests several times earlier, used ssh-copy-id for an unrelated reason and almost got a heart attack when I saw that it wanted to copy several keys I did not know.

pmeunier on August 2, 2021

Good idea. This wouldn’t be too hard to do either, we should use connect_uds instead of connect_env to avoid using the wrong agent. Do you want to submit a patch to fix this? I can help you.

Freax13 on August 2, 2021

I’d like to, but I seem to have some problems connecting to the nest over ssh, the server doesn’t respond.

freax13@desktop:~$ ssh nest.pijul.com -vvv
OpenSSH_8.2p1 Ubuntu-4ubuntu0.2, OpenSSL 1.1.1f  31 Mar 2020
debug1: Reading configuration data /home/freax13/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolving "nest.pijul.com" port 22
debug2: ssh_connect_direct
debug1: Connecting to nest.pijul.com [104.21.19.24] port 22.
pmeunier on August 2, 2021

The address is ssh.pijul.com.

Freax13 on August 2, 2021

Yup that works. Thanks

Freax13 on August 2, 2021

Good idea. This wouldn’t be too hard to do either, we should use connect_uds instead of connect_env to avoid using the wrong agent.

I’m not sure that’s the right solution here. The connect_uds function only exists on unix like platforms (#[cfg(unix)]), so it won’t compile on other targets. Additionally the tests also rely on a agent being there, which won’t be the case on non unix like platforms, so the tests will always fail on these platforms.