Polipo Proxy specify network interface to listen on

415 Views Asked by At

Right at the moment I am taking a closer look to the polipo proxy software. I already managed to setup an easy socks5 proxy with basic user authentication.

All it needs to be finished is to change the listening interface from eth0 to ppp0. Sadly polipo documentation doesn't provide any detail about this task.

The operating system is Debian 8 running in Hyper-V.

Can this configuration somehow be accomplished, either through calling parameters or configuration file or even iptables?

2

There are 2 best solutions below

0
On

Note: this doesn't provide a working solution to the question. I looked into something similar, but settled with using a different proxy software. Perhaps this information can help arrive at a working solution.

Some possible solutions I have found are the following:

  • use network namespaces (unix stackexchange, superuser, igalia blog)

    read more in info: info ip-netns

  • "configure polipo to listen on every interface, then block the requests from interfaces you do not want with iptables" (archlinux forum)

  • use a different proxy software, like tinyproxy (archlinux forum)

    [unix stackexchange]: https://unix.stackexchange.com/questions/210982
    [superuser]: https://superuser.com/questions/241178
0
On

In the function create_listener, in file io.c, after line 751, add something like the following:

struct ifreq ifr;
memset(&ifr, 0, sizeof(ifr));
strcpy(ifr.ifr_name, "ppp0");
rc = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr));
if(rc < 0) {
    done = (*handler)(-errno, NULL, NULL);
    assert(done);
    return NULL;
}