I've got a (virtualized) local LAMP server on Xubuntu 12.04 that I am using for Drupal development. I'd like to learn how to use web 2.0 integration Drupal modules (eg. youtube, facebook, etc.) but I live in China so these sites are obviously blocked.

I use SSH tunneling and a local SOCKS proxy for browsing these sites, but I am not sure how to make my virtualized Apache2 server use this proxy. I can see 3 potential solutions but I'm not really sure how to best go about implementing them.

(in order of preference, I prefer limiting the traffic sent through the ssh tunnel to only what needs to get around the firewall)

  1. set up ssh tunnel from guest OS get Apache2 server to route external traffic (or even better, only external traffic with specific host names, eg. facebook.com, youtube.com) through the local SOCKS proxy.

  2. set up ssh tunnel from guest OS, route all traffic through local SOCKS proxy (easy with Ubuntu but looks like configuring a global SOCKS proxy might be a touch harder with Xubuntu because it doesn't have Ubuntu's Network Proxy GUI)

  3. make virtualbox on host OS route all traffic through SOCKS proxy.

Any ideas on which route would be best and how to implement it? Thanks in advance for any help!

  • how's going on with this issue? have you tried the alternative solutions? – vicd May 20 '12 at 12:38

@adempewolff, Good question, but one thing I'm not clear is that

2) set up ssh tunnel from guest OS, route all traffic through local SOCKS proxy (easy with Ubuntu but looks like it might be a touch harder with Xubuntu)

What do you mean by this, a touch harder with Xubuntu? SSH is almost shipped with every Linux distros, just set up a tunnel with ssh, then configure it as the globe socks v5 proxy, things may get done.

UPDATED ANSWER: global proxy may available on weird Xubuntu http://proxychains.sourceforge.net/ edit proxychains.conf as follows,

# add proxy here ...
# meanwile
# defaults set to "tor"
socks5 9050 

execute proxychains /etc/init.d/apache2 start to launch your apache server.

| improve this answer | |
  • thanks for your response. Your right, I wasn't very clear about this. I have no problem making the SSH tunnel itself, it's just configuring it as the global socks proxy that is giving me trouble. Xubuntu doesn't come with ubuntu's Network Proxy GUI, and all of the solutions I found via googling were only for http and ftp proxies and suggested it is impossible to set a global socks proxy (which I don't believe). They suggested using tsocks, but I'm unsure how to/if I can use tsocks with apache5 without breaking it. – adempewolff May 15 '12 at 7:49
  • see this question for example, which suggests a socks global proxy is impossible with Xubuntu: askubuntu.com/questions/77509/… – adempewolff May 15 '12 at 7:58
  • em, i have no experience in Xubuntu, from this point of view, it's a bit weird without global socks proxy setting even on 12.04!! in this case, i agree with other guys that you need proxy alternatives. if you hesitate to choose tsocks, why not give proxychains a chance(can be easily install by using apt-get install proxychains), but you may need to compile it from source on Xubuntu, who knows :P – vicd May 15 '12 at 8:51
  • start httpd server like this, proxychains /etc/init.d/apache2 start Good luck :P – vicd May 15 '12 at 8:52
  • thanks for the advice. unfortunately my problem is a lot more complicated than I originally thought it was. In addition to url and packet filtering China also uses DNS filtering. This is a problem because DNS lookups are UDP requests and only TCP requests get sent through the ssh tunnel (not a problem with firefox or chromium because they have options to route dns through the proxy--doubt apache has such). There is a solution (see hekate.homeip.net/tag/tsocks) using the program socat to convert the lookups to/from UDP on either end of the tunnel but I can't get it to work correctly. – adempewolff May 20 '12 at 12:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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