Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Implement AgentClient::connect_uds on Windows #177

Open
Irvingouj opened this issue Sep 8, 2023 · 7 comments
Open

Implement AgentClient::connect_uds on Windows #177

Irvingouj opened this issue Sep 8, 2023 · 7 comments

Comments

@Irvingouj
Copy link

I tried to run basic examples but hit a problem with

 let mut agent = russh_keys::agent::client::AgentClient::connect_env().await.unwrap();

where connect_env returns only error on non-unix platform. Does this library supposed to work under platform otherthan linux?

@Eugeny
Copy link
Owner

Eugeny commented Sep 8, 2023

russh-keys AgentClient class only supports SSH agent connections via UNIX sockets, so it doesn't work on Windows. The rest of russh works on Windows.

@Eugeny Eugeny closed this as completed Sep 8, 2023
@Eugeny
Copy link
Owner

Eugeny commented Sep 8, 2023

(if you're learning russh through examples, it's a better idea to start with remote_shell_call which is newer as opposed to client.rs which was inherited from thrussh)

@wez
Copy link

wez commented Sep 8, 2023

so it doesn't work on Windows.

FWIW, UNIX domain sockets have worked on windows for several years now, there's no reason not to support it here

@Eugeny
Copy link
Owner

Eugeny commented Sep 8, 2023 via email

@wez
Copy link

wez commented Sep 8, 2023

There are other ssh agents that run on windows that use unix domain sockets

@Eugeny Eugeny changed the title Does this library work on Windows? Implement AgentClient::connect_uds on Windows Sep 8, 2023
@Eugeny Eugeny reopened this Sep 8, 2023
@eminence
Copy link

eminence commented Sep 22, 2023

I was able to get this working on Windows with this small change to russh-keys:

#[cfg(windows)]
impl AgentClient<tokio::net::windows::named_pipe::NamedPipeClient> {
    pub async fn connect_windows() -> Result<Self, Error> {
        let stream = tokio::net::windows::named_pipe::ClientOptions::new()
            .open(r"\\.\pipe\openssh-ssh-agent")?;
        Ok(AgentClient {
            stream,
            buf: CryptoVec::new(),
        })
    }
}

Then agent.request_identities() returns a non-empty list.

Except it seems to not be returning my ECDSA keys:

[2023-09-22T19:01:19Z INFO  russh_keys::agent::client] Unsupported key type: Ok("ecdsa-sha2-nistp256")

@Eugeny
Copy link
Owner

Eugeny commented Sep 22, 2023

@eminence russh doesn't have support for ECDSA keys yet - only RSA and Ed25519

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants