0

Am using redsocks to redirect thru a proxy. The problem is that when i use a tool like wget it appears to be connecting but not resolving. What could be the problem and how could i solve it?

Executing wget google.com

--2020-08-22 17:32:34--  http://google.com/
Resolving google.com (google.com)... 172.217.1.110, 2607:f8b0:4008:810::200e
Connecting to google.com (google.com)|172.217.1.110|:80... connected.
HTTP request sent, awaiting response... 

Executing curl google.com

curl -v google.com -o saved

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 172.217.1.110:80...
* Connected to google.com (172.217.1.110) port 80 (#0)
> GET / HTTP/1.1
> Host: google.com
> User-Agent: curl/7.71.1
> Accept: */*
> 
  0     0    0     0    0     0      0      0 --:--:--  0:00:14 --:--:--     0^C

redsocks.conf

base {
    log_debug = on;
    log_info = on;
    log = "file:/var/log/redsocks.log";

    daemon = on;

    redirector = iptables;
}

redsocks {
    local_ip = 0.0.0.0;
    local_port = 12345;

    ip = my.proxy;
    port = 3128;

    type = http-connect;

    login = "myUser";
    password = "myPassword";
}

redsocks {
    local_ip = 0.0.0.0;
    local_port = 12346;

    ip = my.proxy;
    port = 3128;

    type = http-relay;

    login = "myUser";
    password = "myPassword";
}

iptables

Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination         

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
REDSOCKS   tcp  --  0.0.0.0/0            0.0.0.0/0           

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination         

Chain REDSOCKS (1 references)
target     prot opt source               destination         
RETURN     all  --  0.0.0.0/0            0.0.0.0/8           
RETURN     all  --  0.0.0.0/0            10.0.0.0/8          
RETURN     all  --  0.0.0.0/0            100.64.0.0/10       
RETURN     all  --  0.0.0.0/0            127.0.0.0/8         
RETURN     all  --  0.0.0.0/0            169.254.0.0/16      
RETURN     all  --  0.0.0.0/0            172.16.0.0/12       
RETURN     all  --  0.0.0.0/0            192.168.0.0/16      
RETURN     all  --  0.0.0.0/0            198.18.0.0/15       
RETURN     all  --  0.0.0.0/0            224.0.0.0/4         
RETURN     all  --  0.0.0.0/0            240.0.0.0/4         
REDIRECT   tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:80 redir ports 12346
REDIRECT   tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:443 redir ports 12345
REDIRECT   tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:11371 redir ports 12346

jogarcia
  • 101
  • 3
  • Have you looked at your proxy logs? Have you looked at your redsocks logs? Have you tried connecting to an IP you control? This thoroughly lacks any kind of research or demonstration thereof. – Ginnungagap Aug 22 '20 at 22:22
  • @Ginnungagap Not my proxy, the redsocks logs not very informative (i could upload them). I dont control the ips and the proxy rotates them. Am sorry for providing so little info but please consider that am newbie in this subject. – jogarcia Aug 23 '20 at 00:30

1 Answers1

1

I replaced the redsocks with transocks and now I can use one config to both "http" and "https" redirect (in my IP table I redirect all the traffic to the transocks)

https://github.com/cybozu-go/transocks

Dave M
  • 4,514
  • 22
  • 31
  • 30