cernekee / ocproxy

OpenConnect proxy
Other
366 stars 39 forks source link

Use of '-g' option #23

Closed jchwenger closed 2 years ago

jchwenger commented 2 years ago

Hi there,

I've started using ocproxy to connect to a server (B) through another one (A) on which I need to run a vpn, it works like a charm, thanks so much!

I've been wondering how to use the option for non-local clients:

  -g                        Allow non-local clients.

I'm wondering if that means I could directly connect to B by selecting the port correctly when ssh-ing into A, instead of first connecting to A, then ssh-ing into the local forwarding port? So far I haven't been able to do it.

In my example, I do it like so:

openconnect --script-tun --script \
    "ocproxy -L 2222:$IP_B:22 -D 11080 -v -g"  vpn.example.com

And then I can do, while inside A:

ssh user@localhost -p2222

However, if I try this from the outside:

ssh user@A -p2222

I get a connection refused. Is there a way to ssh straight into this specific port from my machine?

Thanks!

michaelblyons commented 2 years ago

Sounds like a job for SSH config to me: ProxyCommand or ProxyJump.

jchwenger commented 2 years ago

Oh yes, thanks a lot!