ropensci / ssh

Native SSH client in R based on libssh
https://docs.ropensci.org/ssh
Other
126 stars 21 forks source link

ssh-agent not being found #57

Closed r2evans closed 2 years ago

r2evans commented 2 years ago

R-4.1.2, ssh-0.8.0, credentials-1.3.2, libssh-0.9.5

I'm using keepass (password manager) and its built-in SSH agent. This agent works for all of my command-line (ssh, scp, rsync) agent-accessing tools, as well as basic windows gui utilities (e.g., winscp). It provides two styles of socket files: cygwin and msysgit, neither of which seem to work with ssh_connect, the use of either still results in R prompting me (using askpass) for the remote password.

Sys.setenv(SSH_AUTH_SOCK="c:/Users/r2/.ssh/keeagent_cygwin.sock")
# Sys.setenv(SSH_AUTH_SOCK="c:/Users/r2/.ssh/keeagent_msys.sock")
file.exists(Sys.getenv("SSH_AUTH_SOCK"))
# [1] TRUE
sess <- ssh::ssh_connect("r2@remotex", verbose = TRUE)
verbose output ``` ssh_config_parse_line: Unsupported option: IdentitiesOnly, line: 15 ssh_config_parse_line: Unsupported option: IdentitiesOnly, line: 21 ssh_config_parse_line: Unsupported option: IdentitiesOnly, line: 32 ssh_config_parse_line: Unapplicable option: ForwardX11, line: 40 ssh_config_parse_line: Unapplicable option: ForwardX11Trusted, line: 41 ssh_config_parse_line: Unapplicable option: ForwardX11, line: 46 ssh_config_parse_line: Unapplicable option: ForwardX11Trusted, line: 47 ssh_config_parse_line: Unapplicable option: LocalForward, line: 56 ssh_config_parse_line: Unapplicable option: LocalForward, line: 79 ssh_config_parse_line: Unapplicable option: LocalForward, line: 84 ssh_config_parse_line: Unapplicable option: LocalForward, line: 85 ssh_config_parse_line: Unapplicable option: LocalForward, line: 86 ssh_config_parse_line: Unapplicable option: LocalForward, line: 91 ssh_config_parse_line: Unapplicable option: LocalForward, line: 93 ssh_config_parse_line: Unapplicable option: LocalForward, line: 95 ssh_config_parse_line: Unapplicable option: LocalForward, line: 97 ssh_config_parse_line: Unapplicable option: LocalForward, line: 99 ssh_config_parse_line: Unsupported option: ForwardAgent, line: 121 ssh_config_parse_line: Unapplicable option: LocalForward, line: 125 ssh_config_parse_line: Unapplicable option: LocalForward, line: 131 ssh_config_parse_line: Unapplicable option: LocalForward, line: 132 ssh_config_parse_line: Unapplicable option: LocalForward, line: 137 ssh_config_parse_line: Unapplicable option: LocalForward, line: 139 ssh_config_parse_line: Unapplicable option: LocalForward, line: 141 ssh_config_parse_line: Unapplicable option: LocalForward, line: 143 ssh_config_parse_line: Unsupported option: ForwardAgent, line: 148 ssh_config_parse_line: Unsupported option: ForwardAgent, line: 172 ssh_config_parse_line: Unapplicable option: LocalForward, line: 174 ssh_config_parse_line: Unapplicable option: LocalForward, line: 175 ssh_config_parse_line: Unapplicable option: LocalForward, line: 181 ssh_config_parse_line: Unapplicable option: LocalForward, line: 183 ssh_config_parse_line: Unapplicable option: LocalForward, line: 188 ssh_config_parse_line: Unapplicable option: LocalForward, line: 193 ssh_config_parse_line: Unapplicable option: LocalForward, line: 195 ssh_config_parse_line: Unapplicable option: LocalForward, line: 199 ssh_config_parse_line: Unapplicable option: DynamicForward, line: 201 ssh_config_parse_line: Unsupported option: ForwardAgent, line: 212 ssh_config_parse_line: Unsupported option: ForwardAgent, line: 319 ssh_config_parse_line: Unapplicable option: ForwardX11, line: 321 ssh_config_parse_line: Unapplicable option: ForwardX11Trusted, line: 322 ssh_config_parse_line: Unsupported option: TCPKeepAlive, line: 325 ssh_config_parse_line: Unsupported option: ServerAliveInterval, line: 326 ssh_config_parse_line: Unsupported option: ServerAliveCountMax, line: 327 ssh_config_parse_line: Unsupported option: HashKnownHosts, line: 329 ssh_connect: libssh 0.9.5 (c) 2003-2019 Aris Adamantiadis, Andreas Schneider and libssh contributors. Distributed under the LGPL, please refer to COPYING file for information about your rights, using threading threads_pthread ssh_socket_connect: Nonblocking connection socket: 1888 ssh_connect: Socket connecting, now waiting for the callbacks to work socket_callback_connected: Socket connection callback: 1 (0) ssh_client_connection_callback: SSH server banner: SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.10 ssh_analyze_banner: Analyzing banner: SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.10 ssh_analyze_banner: We are talking to an OpenSSH client version: 7.2 (70200) ssh_known_hosts_read_entries: Failed to open the known_hosts file '/etc/ssh/ssh_known_hosts': No such file or directory ssh_kex_select_methods: Negotiated curve25519-sha256@libssh.org,ecdsa-sha2-nistp256,aes256-ctr,aes256-ctr,hmac-sha2-256-etm@openssh.com,hmac-sha2-256-etm@openssh.com,zlib@openssh.com,zlib@openssh.com,, ssh_init_rekey_state: Set rekey after 4294967296 blocks ssh_init_rekey_state: Set rekey after 4294967296 blocks ssh_packet_client_curve25519_reply: SSH_MSG_NEWKEYS sent ssh_packet_newkeys: Received SSH_MSG_NEWKEYS ssh_packet_newkeys: Signature verified and valid Found known server key: 91:01:c0:4c:3d:c7:d6:80:b2:64:7a:f6:a0:13:16:65:d3:df:e9:8f ssh_packet_userauth_failure: Access denied for 'none'. Authentication that can continue: publickey,password ssh_packet_userauth_failure: Access denied for 'none'. Authentication that can continue: publickey,password ssh_pki_import_pubkey_file: Error opening C:\Users\r2/.ssh/id_ed25519.pub: No such file or directory ssh_pki_import_privkey_file: Error opening C:\Users\r2/.ssh/id_ed25519: No such file or directory ssh_pki_import_pubkey_file: Error opening C:\Users\r2/.ssh/id_ecdsa.pub: No such file or directory ssh_pki_import_privkey_file: Error opening C:\Users\r2/.ssh/id_ecdsa: No such file or directory ssh_pki_import_pubkey_file: Error opening C:\Users\r2/.ssh/id_rsa.pub: No such file or directory ssh_pki_import_privkey_file: Error opening C:\Users\r2/.ssh/id_rsa: No such file or directory ssh_pki_import_pubkey_file: Error opening C:\Users\r2/.ssh/id_dsa.pub: No such file or directory ssh_pki_import_privkey_file: Error opening C:\Users\r2/.ssh/id_dsa: No such file or directory ssh_userauth_publickey_auto: Tried every public key, none matched ```

It does not connect to the socket file, instead asking me to type in my remote password. When I do that, it connects successfully. With no other changes, I can use the running agent from other (non-R) tools, so the agent is running and the respective keys are loaded and available.

KeeAgent has options to confirm with the user when a client requests a list of keys or retrieves a key. This prompting never occurs, so it appears (confirming what the log suggests) that there is no attempt to connect to the agent.

Am I doing something wrong?

r2evans commented 2 years ago

Forget it, this is a rehash of the pain of using ssh-agent in a windows/GfW/WSL2 environment.