sshtunnel icon indicating copy to clipboard operation
sshtunnel copied to clipboard

Behavior of host_pkey_directories is incorrect

Open fabiorossetto opened this issue 3 years ago • 3 comments

Documentation for the host_pkey_directories says:

        host_pkey_directories (list):
            Look for pkeys in folders on this list, for example ['~/.ssh'].

            Default: ``None`` (disabled)

However in the get_keys function, at line 1089:

        if host_pkey_directories is None:
            host_pkey_directories = [DEFAULT_SSH_DIRECTORY]

I think this is wrong. If host_pkey_directories is None, the function get_keys should not return any key.

fabiorossetto avatar Jun 09 '21 17:06 fabiorossetto

Passing a empty list seems to work as workaround

fabiorossetto avatar Jun 09 '21 17:06 fabiorossetto

This is a bug because it means that the behaviour in newer versions is incompatible with old ones. In older versions pkeys would not be searched for by default and you could force the use of a particular pkey (only) by passing ssh_pkey. Now you need to specify host_pkey_directories=[] to get the same behaviour. Would a PR to fix this be accepted?

mhardcastle avatar Feb 08 '22 20:02 mhardcastle

@mhardcastle could you pleas send a PR

pahaz avatar May 12 '23 14:05 pahaz