semigodking/redsocks

autoproxy 配置生效问题

wurenny opened this issue · 0 comments

redsocks.conf

base {
user = redsocks;
group = redsocks;
}
redsocks {
autoproxy =1
}

user

uid=1016(redsocks)
进程的owner显示是redsocks

iptables

Chain OUTPUT_direct (1 references)
target prot opt source destination
DNAT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:53 to:192.168.xxx.xxx:1053
REDSOCKS tcp -- 0.0.0.0/0 0.0.0.0/0 ! owner UID match 1016 multiport dports 53,80,443

Chain REDSOCKS (1 references)
target prot opt source destination
RETURN all -- 0.0.0.0/0 192.168.0.0/16
RETURN all -- 0.0.0.0/0 172.16.0.0/12
RETURN all -- 0.0.0.0/0 10.0.0.0/8
RETURN all -- 0.0.0.0/0 0.0.0.0/8
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 100.64.0.0/10
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 redir ports 12345

issue

  • autoproxy不工作,从抓包和国内查询IP的网站如:http://ip168.com 显示所有的流量都经过了tcp/12345
  • redsocks使用非root用户(redsocks)启动时有报错:make_socket_transparent Operation not permitted:
    systemd[1]: Starting Transparent redirector of any TCP connection to proxy using your firewall...
    systemd[1]: Started Transparent redirector of any TCP connection to proxy using your firewall.
    redsocks2[40213]: 1617978289.033395 debug utils.c:507 make_socket_transparent(...) setsockopt(fd, SOL_IP, IP_TRANSPARENT): Operation not permitted
    redsocks2[40213]: 1617978289.033417 debug utils.c:512 make_socket_transparent(...) setsockopt(fd, SOL_IPV6, IPV6_TRANSPARENT): Protocol not available
    redsocks2[40213]: 1617978289.033422 err utils.c:515 make_socket_transparent(...) Can not make socket transparent. See debug log for details.
    redsocks2[40213]: 1617978289.033428 warning redsocks.c:999 redsocks_init_instance(...) Continue without TPROXY support
    redsocks2[40213]: 1617978289.034437 info tcpdns.c:496 tcpdns_init_instance(...) tcpdns @ 192.168.xxx.xxx:1053
    redsocks2[40213]: 1617978289.034605 notice main.c:255 main(...) redsocks started with: epoll