I was trying to create a PHP application that utilizes a local socks5 proxy to anonymize my IP address on each curl request. I couldn't successfully get the application to use a socks5 proxy. But in doing all that I have found that now some applications no longer connect to the internet, such as wget, curl and git.

wget responds with:

Error parsing proxy URL socks5:// Unsupported scheme ‘socks5’.

curl responds with

curl: (7) Failed to connect to port 8080: Connection refused

git responds with

fatal: unable to access 'https://github.com/jamiejackherer/idealer/': Failed to connect to port 8080: Connection refused

I dont know how to disable the socks5 proxy from listening, I even tried uninstalling tor and tor browser bundle but it seems something else is keeping the listener open but I don't know what or even how to check. I have searched online for 2 days non-stop but I can't find anything. I am afraid that I will start messing my system up if I change too much configuration.

Any idea's on how to resolve this issue?

  • Is tor running? If not...what does this have to do with Tor at all? – cacahuatl Feb 22 '17 at 0:32
  • Whether tor is running or not the problem persists.. I tried proxy-ing my application with both tor (built from source) or tor browser bundle running, I then removed all tor files (my build and the browser bundle). I am still unsure exactly how i got it to work – Jamie Lindsey Feb 22 '17 at 0:37
  • So this isn't related to Tor? – cacahuatl Feb 22 '17 at 0:42
  • the problem only appeared after editing my torrc files, so the problem is no longer due to tor but started because of tor.. any other ideas? – Jamie Lindsey Feb 22 '17 at 0:55
  • If Tor isn't running? No. You probably want to ask a more general server support community about server administration? – cacahuatl Feb 22 '17 at 0:57

First of all, you have port 8080 for your Socks5 - it's 9050 in Tor and 1080 or 3128 by default in most of apps. Second - Tor does not touch a packets outside the ones coming to his ports. You have added some environmental variables I think. For wget there's no socks proxy support, see docs for variable names and I think the problem is that you have used polipo or privoxy to channel HTTP+HTTPS requests to SOCKS ones. I do recommend you to use polipo, but it's my personal preference. You bind it to 8080 - and use http schema for request. Also check your user's, root's and global(in /etc folder) bash shell profiles - some guides are also pointing to making aliases for curl there. A good environment vars overvuew can be found here but the proxy vars names are standard and they are http_proxy, https_proxy, frp_proxy, rsync_proxy, socks_proxy and for exclusions no_proxy. Remember that due to the early times these variables must be duplicated in uppercase, i.e. if you want to set http_proxy - you also set the same value for HTTP_PROXY, just to be fail-safe. For curl also keep in mind that over Tor not socks5:// but socks5h:// must be used - it will force name resolution on proxy side, according to the official docs. Curl can also be configured via it's config file where is in key=value format options are specified, so take a look there too.

| improve this answer | |
  • 1
    Ok I appreciate your input but firstly - I do NOT and have never set my SOCKSPort to 8080! And the defaults do vary between either 9050 or 9150 .. :/ I don't use defaults as it poses risks.. I changed my SOCKSPort and ControlPort as soon i started reading about using a socks proxy! Also I haven't installed polipo or privoxy. You were right on one thing though.. I had set some env vars in my .bashrc that I had forgotten about and am annoyed that I never even needed them setting anyway! I have since learnt to set two env vars proxyOn and proxyOff. You have provided some good info though TY! – Jamie Lindsey Feb 22 '17 at 16:49
  • you're welcome! in my opinion - drop wget and adopt curl, it's socks5h schema is safe, no leaks there. To avoid env vars avalanche - especially set system-wide - reboot your machine with fixed shell profiles, it will wipe the remaining traces entirely from running config – Alexey Vesnin Feb 22 '17 at 16:52
  • 1
    I will show my gratitude by marking your answer as the correct one as it did offer some good info and you were right in the env vars part. Thanks and also.. with curl I learnt to use curl --socks5-hostname <proxy_ip>:<proxy_port> <url> – Jamie Lindsey Feb 22 '17 at 16:53
  • 1
    I've found github.com/clue/php-socks which seems to be doing a really good job as a controller for socks proxying with php – Jamie Lindsey Feb 22 '17 at 17:03
  • 1
    cheers, brute forcing someone else's account is illegal! And tbh I dont really care, Facebook are a horrible entity that give your details to certain agencies and such, they will even grant access to the highest bidder! I dont like them and personally feel they deserve all they get handed to them! :) – Jamie Lindsey Feb 22 '17 at 18:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.