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

SSH connection via SOCKS proxy not working #280

Closed
carlos-n opened this issue Nov 19, 2019 · 5 comments
Closed

SSH connection via SOCKS proxy not working #280

carlos-n opened this issue Nov 19, 2019 · 5 comments
Labels
Milestone

Comments

@carlos-n
Copy link

Describe the bug
Once a SOCKS tunnel has been established, a new SSH connection using this tunnel doesn't work.

To Reproduce
Steps to reproduce the behavior:

  1. Define a new SSH connection against a server "A" configuring a "Dynamic Socks Proxy" in "SSH Options" section. We use "127.0.0.1" as "Bind Address" and "5000" as "Local Port".
    After creating the connection, we establish the connection with server "A".
    We can see our local server is listening in port 5000.

tcp LISTEN 0 128 127.0.0.1:5000

We can open connections against servers using the SOCKS tunnel with Putty.
So, the SOCKS tunnel is correctly created and working OK.

  1. Define a new SSH connection to a server "B". In "Proxy" tab of "Connection" section we configure the option "Always use next proxy /HTTP/SOCKS) for this connection". We use "127.0.0.1" in "IP/Host" field and "5000" in "Port" field. We leave empty "User" and "Password" fields.

  2. When trying to establish connection with server "B", we receive an error.

connect() failed with error 'Connection timed out'
ssh_exchange_identification: read: Connection reset by peer
pac_conn: Fatal IO error 22 (Invalid argument) on X server :0.

Expected behavior
Connection with server "B" should correctly established as it happens when you try it using Putty.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Linux Mint 19.02 64 bits
  • Version: Asbru v5.2.1

Additional context
Add any other context about the problem here.

@gfrenoy
Copy link
Contributor

gfrenoy commented Nov 30, 2019

I tried a few times to reproduce this but got stuck at step 2. I just realized it's a bug in the gtk3 branch, see #291... I soon as I can get that working, I'll have another look.

In the meantime, did you check the SSH command line of the connection to server B ? Does it work if you run it outside Ásbrú ?

@gfrenoy gfrenoy added the bug label Nov 30, 2019
@gfrenoy
Copy link
Contributor

gfrenoy commented Dec 1, 2019

I looked a bit more at this, here are some notes

  • Ásbú uses the perl module Net::Proxy
  • When configuring Ásbrú as you did, it uses the following configuration of Net::Proxy to establish the proxy:

asbru-cm/lib/pac_conn

Lines 848 to 861 in 1687e82

$proxy = Net::Proxy -> new( {
in => {
type => 'tcp',
port => $LOCAL_PORT = 60000 + int( rand( 1000 ) ),
},
out => {
type => 'tcp', # 'tcp' method allows using SOCKs proxies!! :)
host => $IP,
port => $PORT,
proxy_host => $proxy_ip,
proxy_port => $proxy_port,
proxy_user => $proxy_user,
proxy_pass => $proxy_pass,
proxy_agent => "Ásbrú Connection Manager (https://www.asbru-cm.net/)"

  • Not sure to understand what it exactly do but, as a matter of fact, it does not connect to the proxy ...

Btw, did you look at the Jump Host option in SSH to do this, see #67 ? It might be a more straight way to achieve the same, isn't it ?

@hanspr
Copy link
Contributor

hanspr commented Dec 30, 2019

Hi @carlos-n

Remove the "Always use next proxy /HTTP/SOCKS) for this connection", option in connection to "B", and move it back to "Use global options to decide"

And in "Advanced options", configure like this

imagen

This should be the correct way configure, the other option is for something else, not sure how to use it, but is not for what you want to do.

@KlaasT KlaasT added this to the 6.1.0 milestone Jan 4, 2020
gfrenoy pushed a commit that referenced this issue Jan 4, 2020
- Review main settings proxy options
- Support for jump connections
gfrenoy pushed a commit that referenced this issue Jan 5, 2020
- jump server uses own config file created on the fly
- recover adjustments to spin buttons
- removed left over ssh config field in global settings
@carlos-n
Copy link
Author

carlos-n commented Jan 7, 2020

Thanks so much for the responses.
The solution proposed by hanspr works perfectly.

@gfrenoy
Copy link
Contributor

gfrenoy commented Jan 7, 2020

As there is a workaround and that we are reviewing the way proxy is managed for the next version, I believe we can close this issue for now.

@gfrenoy gfrenoy closed this as completed Jan 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants