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

can't proxy socks5 via ssh forwarder #324

Closed
ansoda opened this issue May 3, 2022 · 17 comments
Closed

can't proxy socks5 via ssh forwarder #324

ansoda opened this issue May 3, 2022 · 17 comments

Comments

@ansoda
Copy link

ansoda commented May 3, 2022

hello, my config:

glider --listen :8443 --forward 'ssh://root@xx.xx.xx.xx:22?key=myprivate&timeout=5'

error in dial: ssh: unexpected packet in response to channel open:

can't proxy socks5 via ssh forwarder.
Is there any problem with my use, thank you.

@nadoo
Copy link
Owner

nadoo commented May 3, 2022

Try other ssh clients and see whether they worked?

@nadoo nadoo added the question label May 3, 2022
@ansoda
Copy link
Author

ansoda commented May 4, 2022

Other ssh clients have no problem logging in via username and private key.

@ansoda
Copy link
Author

ansoda commented May 4, 2022

I think this bug is easy to reproduce.I am using the glider-v0.16.1 version.

@nadoo
Copy link
Owner

nadoo commented May 4, 2022

I think this bug is easy to reproduce.

I've tested and no problem here.

@nadoo
Copy link
Owner

nadoo commented May 4, 2022

Other ssh clients have no problem logging in via username and private key.

Don't just test login, test socket forwarding.

Or just test another ssh server.

@ansoda
Copy link
Author

ansoda commented May 4, 2022

SSH login and forwarding are normal. But glider proxy reports an error: error in dial: ssh: unexpected packet in response to channel open:

ssh server: OpenSSH_8.2p1 Ubuntu-4, OpenSSL 1.1.1f, Ubuntu-v20.04's default ssh server.
ssh client:   OpenSSH_8.6p1, LibreSSL 3.3.5
tabby ssh client: tabby-v1.0.176

@ansoda
Copy link
Author

ansoda commented May 4, 2022

Does ssh have header blocking? Because sock5 is mostly short connections, if one of socks5 requests timeout or an error occurs, it will cause all subsequent requests to timeout or error?

@nadoo
Copy link
Owner

nadoo commented May 4, 2022

setup a local sock5 forwarding proxy server:

ssh -N -D :8443 root@xx.xx.xx.xx

use curl to test the socks5 proxy:

curl -x socks5://127.0.0.1:8443 api.ipify.org

whether it worked?

@ansoda
Copy link
Author

ansoda commented May 4, 2022

This works fine, curl returns the server's ip.

@nadoo
Copy link
Owner

nadoo commented May 4, 2022

This works fine, curl returns the server's ip.

Oh no... -_-! I tested on debian11 and all works fine, maybe I should get an ubuntu server.

@nadoo
Copy link
Owner

nadoo commented May 4, 2022

It always failed or failed after some time?

@ansoda
Copy link
Author

ansoda commented May 4, 2022

I compared glider ssh forwarder and standard ssh forwarder
glider --listen :8443 --forward 'ssh://root@xx.xx.xx.xx:22?key=myprivate&timeout=5'
and
ssh -N -D :8443 root@xx.xx.xx.xx

request:
curl -x socks5://127.0.0.1:8443 api.ipify.org

In both ways, the curl it works fine, but it takes longer for the glider forwarder to return.
As a result, this is particularly obvious when accessing web pages. The speed of opening web pages through standard ssh forwarder is very fast, while the speed of opening web pages through glider is very slow, or even impossible to open at all.

@nadoo
Copy link
Owner

nadoo commented May 4, 2022

So it worked with glider now? anything changed?

@ansoda
Copy link
Author

ansoda commented May 4, 2022

There is no change. I did not use curl but the browser web page to test. Maybe some urls in the web page return slowly or some urls do not return, causing the page to fail to open. I thought there was a problem. But standard ssh doesn't have this problem.
Simply use curl to access a url, and the glider works fine, but it feels slower than standard ssh.
I wonder if the standard ssh is a long connection, and each glider request is a short connection.

@nadoo nadoo added enhancement and removed question labels May 4, 2022
@nadoo nadoo closed this as completed in 1e01d86 May 5, 2022
@nadoo nadoo added the bug label May 5, 2022
@nadoo
Copy link
Owner

nadoo commented May 5, 2022

Hi @ansoda , thanks for your report! you can download and try the dev version here if you need: https://github.com/nadoo/glider/actions/runs/2274744274

@nadoo
Copy link
Owner

nadoo commented May 5, 2022

This issue was closed by the latest commit, feel free to reopen it if there's still any problem.

@ansoda
Copy link
Author

ansoda commented May 5, 2022

Thank you so much, you are great, I just tested it and it works fine.

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

No branches or pull requests

2 participants