Git Product home page Git Product logo

Comments (5)

garywill avatar garywill commented on May 18, 2024

what is your proxy software? what type is the proxy? this script require the proxy supports transparent proxy. have you tried redirecting all traffic to your proxy not just port 80?

from linux-router.

chaudhryfaisal avatar chaudhryfaisal commented on May 18, 2024
  • using Charles Proxy
  • SOCKS5 proxy type
  • I dont see an option for transparent proxy under socks but I have enabled under regular proxy which runs on different port
  • yes I have tried redirecting 80, 443 and even by process like iptables -t nat -A OUTPUT -p tcp -m owner --uid-owner root -j REDSOCKS and it works just not with AP

after many hours... I was able to get it working with sshuttle sshuttle -Nr root@SERVER_2_IP 0/0 -l 0.0.0.0 but this required another server with ssh and ** redsocks** with following rules

# Create new chain
iptables -t nat -N REDSOCKS
# Everything should be redirected to port 12345
iptables -t nat -A REDSOCKS -p tcp -j REDIRECT --to-ports 12345
# Any tcp connection made by `root' should be redirected.
iptables -t nat -A OUTPUT -p tcp -m owner --uid-owner root -j REDSOCKS

still would love your help to get it working without sshuttle

thank you

from linux-router.

garywill avatar garywill commented on May 18, 2024

As I remember, iptables doesn't support redirecting to SOCKS proxy. I have tried iptables -t nat -I OUTPUT -p tcp -j REDIRECT --to-ports xxxx with different SOCKS proxy and failed.

yes I have tried redirecting 80, 443 and even by process like iptables -t nat -A OUTPUT -p tcp -m owner --uid-owner root -j REDSOCKS and it works

I guess your proxy does special treatment on web requests. Did you test ports and protocols other than web? If yes, maybe it really supports transparent proxy.
check these: Is the proxy listening on right interface ?(0.0.0.0 or 127.0.0.1) Is firewall blocking input from AP?

Besides there's a program called tun2socks which is useful if you want to combine iptables and SOCKS

It implements a TUN device which accepts all incoming TCP connections (regardless of destination IP), and forwards the connections through a SOCKS server.

from linux-router.

garywill avatar garywill commented on May 18, 2024

Also found these tools useful:
https://github.com/semigodking/redsocks
https://github.com/darkk/redsocks
https://github.com/vi/tcpsocks

from linux-router.

chaudhryfaisal avatar chaudhryfaisal commented on May 18, 2024

my setup is as following
iptables -> port 12345 (redsocks tcp port) -> 7771 (Charles proxy SOCK5 port) so not going from iptables to socks directly, using redsocks to bridge the gap between.

I believe my issue is somewhere with iptables rules.

from linux-router.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.