[Solved] Socksify an application?

I just wondered what's the best way to socksify an application, e.g. to tell it to use a SOCKS5 proxy. I see redsocks is available in OpenWrt but that's a bit heavyweight as I only need a single application to be redirected, and I couldn't get it working anyway. Then I tried socksify and that didn't work either, that problem seems to be described here.

Any ideas?

is it an application running on the router ?

Yes, ssh in fact.

There used to be apps for it, like httptunnel, there's sshtunnel now, but i don't know if it does what you'd like it to do.

After banging my head against it for long enough I made redsocks work in the end.

How you do that?

The most useful resource is Alexander Molochko:

However since I am only hooking ssh, and only for one specific destination, my setup is much, much simpler, so I just need three rules:

iptables -t nat -N REDSOCKS
iptables -t nat -A REDSOCKS -p tcp -d <my destination ip> -j REDIRECT --to-ports <redsocks port>
iptables -t nat -A OUTPUT -p tcp --dport 22 -j REDSOCKS

Then of course, you setup redsocks config to point to your proxy, and accept connection on the <redsocks port>
I am using Dante proxy (running external to OpenWrt).

I would have preferred to get intercept for just the ssh application. I'm not sure whether the problem with socksify + ssh is about the libc used by ssh or the problem is with socksify, but this is working for now, so...

Hope this helps.

2 Likes

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.

1 Like

This website is so slick it's surprising there isn't a button to do that, but it's done.

I went to check older posts and mark solved, but unfortunately it only allows editing back so far. I guess that makes sense.

This topic was automatically closed 0 minutes after the last reply. New replies are no longer allowed.