rofl0r / proxychains-ng

proxychains ng (new generation) - a preloader which hooks calls to sockets in dynamically linked programs and redirects it through one or more socks/http proxies. continuation of the unmaintained proxychains project. the sf.net page is currently not updated, use releases from github release page instead.
http://sourceforge.net/projects/proxychains-ng/files
GNU General Public License v2.0
9.82k stars 1.08k forks source link

proxychains-ng does not work some software use epoll #151

Open smkingsoft opened 7 years ago

smkingsoft commented 7 years ago

some software just like nginx use epoll, proxychains-ng does not work. only nginx use poll or select, proxychains-ng can work

rofl0r commented 7 years ago

interesting find. do you have an idea why that is so ?

smkingsoft commented 7 years ago

it seems can not wake up epoll_wait. proxychains-ng use poll ? epoll and poll or select mode is different?

rofl0r commented 7 years ago

yes, proxychains uses both poll and select internally:

./src/allocator_thread.c:       while((ret = select(readfd+1, &fds, NULL, NULL, 
./src/core.c:           ret = poll(fds, nfsd, time_remain);
./src/core.c:           ret = poll_retry(pfd, 1, tcp_connect_time_out);

but i don't see yet how that can disturb someone else's use of epoll.

smkingsoft commented 7 years ago

so so... i use nginx as reverse proxy. nginx ->proxychains-ng ->shadowsocks ->internet nginx default use epoll event, then nginx can not receive http response. now i config nginx use poll event, that is ok

rofl0r commented 7 years ago

oh, so nginx *calls* proxychains-ng ? how did you configure that ?

smkingsoft commented 7 years ago

use

proxychains4 nginx arguments

start nginx config proxychains socks5 ip port

itskeKs commented 7 years ago

sorry to pull it back up but @smkingsoft would you please explain how you manage to work it like this? maybe you can post a config of yours? i am trying the same but cant manage to get it to work :(

smkingsoft commented 7 years ago
  1. config nginx as a resolver proxy
  2. config nginx use epoll mode
  3. config proxychains use socks5 proxy
  4. use cmd: proxychains4 nginx [arguments] start nginx
zhaowq32 commented 6 years ago

epoll can not wake up by new fd(dup2).https://news.ycombinator.com/item?id=13918141