StanfordSNR / guardian-agent

[beta] Guardian Agent: secure ssh-agent forwarding for Mosh and SSH
BSD 3-Clause "New" or "Revised" License
439 stars 30 forks source link

sga-ssh does not work with custom port #21

Open lluchs opened 6 years ago

lluchs commented 6 years ago

I'm trying to use sga-ssh to connect to a git repository on a custom port.

With the environment variables from sga-env.sh, this fails with:

fatal: ssh variant 'simple' does not support setting port

Adding export GIT_SSH_VARIANT=ssh fixes this issue on the git side, but now sga-ssh just hangs.

This is the debug output:

% sga-ssh --debug git@example.com -p7999 git-upload-pack                       
2018/09/24 07:01:09 handshake.go:355: kex loop
2018/09/24 07:01:09 handshake.go:360: kex inner loop
2018/09/24 07:01:09 handshake.go:370: select exit: <-requestKex
2018/09/24 07:01:09 handshake.go:393: !sent: sending kexInit
2018/09/24 07:01:09 handshake.go:360: kex inner loop
2018/09/24 07:01:09 handshake.go:368: select exit: <-t.startKex
2018/09/24 07:01:09 handshake.go:416: entering keyexchange
2018/09/24 07:01:09 common.go:139: host key algorithms: server: [none], client: [none]
2018/09/24 07:01:09 delegated_client.go:582: KexCallback called
2018/09/24 07:01:09 handshake.go:355: kex loop
2018/09/24 07:01:09 handshake.go:360: kex inner loop
2018/09/24 07:01:12 delegated_client.go:634: no-more-sessions@openssh.com request denied, continuing
2018/09/24 07:01:12 delegated_client.go:641: Initiating Handoff Key Exchange
2018/09/24 07:01:12 handshake.go:326: requestKeyExchange, t.deferHostKeyVerification: %!b(bool=false)
2018/09/24 07:01:12 handshake.go:370: select exit: <-requestKex
2018/09/24 07:01:12 handshake.go:393: !sent: sending kexInit
2018/09/24 07:01:12 handshake.go:360: kex inner loop
2018/09/24 07:01:12 delegated_client.go:539: Finished copying transport data to agent
2018/09/24 07:01:12 handshake.go:368: select exit: <-t.startKex
2018/09/24 07:01:12 handshake.go:416: entering keyexchange
2018/09/24 07:01:12 common.go:139: host key algorithms: server: [ssh-rsa], client: [ssh-rsa-cert-v01@openssh.com ssh-dss-cert-v01@openssh.com ecdsa-sha2-nistp256-cert-v01@openssh.com ecdsa-sha2-nistp384-cert-v01@openssh.com ecdsa-sha2-nistp521-cert-v01@openssh.com ssh-ed25519-cert-v01@openssh.com ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521 ssh-rsa ssh-dss ssh-ed25519]                                                                    
dimakogan commented 6 years ago

Thanks for reporting. Do you perhaps know what git/ssh version the server is running? To get the ssh version string, you can run ssh git@example.com -v 2>&1 | grep Remote

lluchs commented 6 years ago

The server is Bitbucket Server v4.8.6, which I believe uses some Java SSH implementation. It identifies as SSH-2.0-SSHD-UNKNOWN (output from your command: debug1: Remote protocol version 2.0, remote software version SSHD-UNKNOWN).