change from privoxy to polipo for http proxy

This commit is contained in:
Nathan Freitas 2014-04-24 23:43:33 -04:00
parent a4d8669cc2
commit 40546c9ee5
10 changed files with 47 additions and 1523 deletions

3
.gitmodules vendored
View File

@ -26,3 +26,6 @@
path = external/obfsclient path = external/obfsclient
url = https://git.torproject.org/user/yawning/obfsclient.git url = https://git.torproject.org/user/yawning/obfsclient.git
[submodule "external/polipo"]
path = external/polipo
url = https://github.com/jech/polipo.git

47
external/Makefile vendored
View File

@ -74,7 +74,7 @@ endif
tor tor-clean \ tor tor-clean \
liballium liballium-clean \ liballium liballium-clean \
obfsclient obfsclient-clean \ obfsclient obfsclient-clean \
privoxy privoxy-clean polipo polipo-clean
all: assets all: assets
@ -280,37 +280,20 @@ obfsclient-clean:
git clean -fdx git clean -fdx
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
# privoxy # polipo
polipo-build-stamp:
$(MAKE) CC="$(CC)" -C polipo
touch polipo-build-stamp
privoxy/config.log: polipo: polipo-build-stamp
tar xzvf privoxy.tar.gz
mv privoxy*stable privoxy
cp privoxy.configure.in privoxy/configure.in
cd privoxy && \
autoheader
cd privoxy && \
autoconf
cp config.sub privoxy
cp config.guess privoxy
cd privoxy && \
CC="$(CC)" AR="$(AR)" RANLIB=$(RANLIB) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
./configure \
--host=arm-linux-eabi --enable-pthread
## --disable-pthread
privoxy-build-stamp: privoxy/config.log
$(MAKE) -C privoxy
touch privoxy-build-stamp
privoxy: privoxy-build-stamp
test -d bin || mkdir bin test -d bin || mkdir bin
cp privoxy/privoxy bin cp polipo/polipo bin
privoxy-clean: polipo-clean:
-rm -f bin/privoxy -rm -f bin/polipo
-rm -f privoxy-build-stamp -rm -f polipo-build-stamp
-rm -rf privoxy -rm -rf polipo
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
# JTorControl library # JTorControl library
@ -338,16 +321,16 @@ jtorctl-clean:
#in order to stop Android OS (older devices) from trying to compress/decompress it #in order to stop Android OS (older devices) from trying to compress/decompress it
#this is related to a bug in compression of assets and resources > 1MB #this is related to a bug in compression of assets and resources > 1MB
assets: tor privoxy jtorctl iptables obfsclient assets: tor polipo jtorctl iptables obfsclient
install bin/jtorctl.jar ../libs install bin/jtorctl.jar ../libs
install -d ../res/raw install -d ../res/raw
-zip ../res/raw/privoxy.mp3 bin/privoxy -zip ../res/raw/polipo.mp3 bin/polipo
-zip ../res/raw/obfsclient.mp3 bin/obfsclient -zip ../res/raw/obfsclient.mp3 bin/obfsclient
-zip ../res/raw/tor.mp3 bin/tor -zip ../res/raw/tor.mp3 bin/tor
-zip ../res/raw/xtables.mp3 bin/xtables -zip ../res/raw/xtables.mp3 bin/xtables
assets-clean: assets-clean:
-rm ../res/raw/privoxy.mp3 -rm ../res/raw/polipo.mp3
-rm ../res/raw/obfsclient.mp3 -rm ../res/raw/obfsclient.mp3
-rm ../res/raw/tor.mp3 -rm ../res/raw/tor.mp3
-rm ../res/raw/xtables.mp3 -rm ../res/raw/xtables.mp3
@ -356,7 +339,7 @@ assets-clean:
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
# cleanup, cleanup, put the toys away # cleanup, cleanup, put the toys away
clean: openssl-clean libevent-clean tor-clean privoxy-clean jtorctl-clean liballium-clean obfsclient-clean assets-clean clean: openssl-clean libevent-clean tor-clean polipo-clean jtorctl-clean liballium-clean obfsclient-clean assets-clean
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
# debugging stuff # debugging stuff

1
external/polipo vendored Submodule

@ -0,0 +1 @@
Subproject commit af08a108acb9ac717f114d81c60cad0ccc0d7c21

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -94,7 +94,7 @@
android:textColorLink="#ffffff" android:textColorLink="#ffffff"
android:paddingLeft="15px" android:paddingLeft="15px"
android:textColor="#ffffff" /> android:textColor="#ffffff" />
<TextView android:text="@string/privoxy_version" <TextView android:text="@string/polipo_version"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:autoLink="web" android:autoLink="web"

View File

@ -58,7 +58,7 @@
<string name="btn_cancel">Cancel</string> <string name="btn_cancel">Cancel</string>
<!--Welcome Wizard strings (DJH)--> <!--Welcome Wizard strings (DJH)-->
<string name="wizard_details">Some Orbot Details</string> <string name="wizard_details">Some Orbot Details</string>
<string name="wizard_details_msg">Orbot is an open-source application that contains Tor, LibEvent and Privoxy. It provides a local HTTP proxy (8118) and a SOCKS proxy (9050) into the Tor network. Orbot also has the ability, on rooted device, to send all internet traffic through Tor.</string> <string name="wizard_details_msg">Orbot is an open-source application that contains Tor, LibEvent and Polipo. It provides a local HTTP proxy (8118) and a SOCKS proxy (9050) into the Tor network. Orbot also has the ability, on rooted device, to send all internet traffic through Tor.</string>
<string name="wizard_permissions_root">Permission Granted</string> <string name="wizard_permissions_root">Permission Granted</string>
<string name="wizard_permissions_stock">Orbot Permissions</string> <string name="wizard_permissions_stock">Orbot Permissions</string>
<string name="wizard_premissions_msg_root">Excellent! We\'ve detected that you have root permissions enabled for Orbot. We will use this power wisely.</string> <string name="wizard_premissions_msg_root">Excellent! We\'ve detected that you have root permissions enabled for Orbot. We will use this power wisely.</string>
@ -162,7 +162,7 @@
<string name="warning_error_starting_transparent_proxying_">WARNING: error starting transparent proxying!</string> <string name="warning_error_starting_transparent_proxying_">WARNING: error starting transparent proxying!</string>
<string name="transproxy_rules_cleared">TransProxy rules cleared</string> <string name="transproxy_rules_cleared">TransProxy rules cleared</string>
<string name="couldn_t_start_tor_process_">Couldn\'t start Tor process: </string> <string name="couldn_t_start_tor_process_">Couldn\'t start Tor process: </string>
<string name="privoxy_is_running_on_port_">Privoxy is running on port: </string> <string name="privoxy_is_running_on_port_">Polipo is running on port: </string>
<string name="setting_up_port_based_transparent_proxying_">Setting up port-based transparent proxying&#8230;</string> <string name="setting_up_port_based_transparent_proxying_">Setting up port-based transparent proxying&#8230;</string>
<string name="bridge_error">Bridge Error</string> <string name="bridge_error">Bridge Error</string>
<string name="bridge_requires_ip">In order to use the bridge feature, you must enter at least one bridge IP address.</string> <string name="bridge_requires_ip">In order to use the bridge feature, you must enter at least one bridge IP address.</string>
@ -212,7 +212,7 @@
<string name="third_party_software">3rd-Party-Software: </string> <string name="third_party_software">3rd-Party-Software: </string>
<string name="tor_version">Tor v0.2.4.21: https://www.torproject.org</string> <string name="tor_version">Tor v0.2.4.21: https://www.torproject.org</string>
<string name="libevent_version">LibEvent v2.0.9: http://www.monkey.org/~provos/libevent/</string> <string name="libevent_version">LibEvent v2.0.9: http://www.monkey.org/~provos/libevent/</string>
<string name="privoxy_version">Privoxy v3.0.12: http://www.privoxy.org</string> <string name="polipo_version">Polipo v1.1.9: https://github.com/jech/polipo</string>
<string name="iptables_version">IPtables v1.4.21: http://www.netfilter.org</string> <string name="iptables_version">IPtables v1.4.21: http://www.netfilter.org</string>
<string name="openssl_version">OpenSSL v1.0.1g: http://www.openssl.org</string> <string name="openssl_version">OpenSSL v1.0.1g: http://www.openssl.org</string>
<string name="hidden_service_request">An app wants to open hidden server port %S to the Tor network. This is safe if you trust the app.</string> <string name="hidden_service_request">An app wants to open hidden server port %S to the Tor network. This is safe if you trust the app.</string>

View File

@ -87,8 +87,8 @@ public class TorResourceInstaller implements TorServiceConstants {
shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish(); shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
streamToFile(is, outFile, false, false); streamToFile(is, outFile, false, false);
is = context.getResources().openRawResource(R.raw.privoxy_config); is = context.getResources().openRawResource(R.raw.torpolipo);
outFile = new File(installFolder, PRIVOXYCONFIG_ASSET_KEY); outFile = new File(installFolder, POLIPOCONFIG_ASSET_KEY);
shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish(); shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
streamToFile(is,outFile, false, false); streamToFile(is,outFile, false, false);
@ -97,8 +97,8 @@ public class TorResourceInstaller implements TorServiceConstants {
shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish(); shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
streamToFile(is,outFile, false, true); streamToFile(is,outFile, false, true);
is = context.getResources().openRawResource(R.raw.privoxy); is = context.getResources().openRawResource(R.raw.polipo);
outFile = new File(installFolder, PRIVOXY_ASSET_KEY); outFile = new File(installFolder, POLIPO_ASSET_KEY);
shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish(); shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
streamToFile(is,outFile, false, true); streamToFile(is,outFile, false, true);

View File

@ -85,7 +85,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
private File appCacheHome; private File appCacheHome;
private File fileTor; private File fileTor;
private File filePrivoxy; private File filePolipo;
private File fileObfsclient; private File fileObfsclient;
private File fileXtables; private File fileXtables;
@ -483,10 +483,10 @@ public class TorService extends Service implements TorServiceConstants, TorConst
shell.add(killCommand); shell.add(killCommand);
}*/ }*/
while ((procId = TorServiceUtils.findProcessId(filePrivoxy.getAbsolutePath())) != -1) while ((procId = TorServiceUtils.findProcessId(filePolipo.getAbsolutePath())) != -1)
{ {
logNotice("Found Privoxy PID=" + procId + " - killing now..."); logNotice("Found Polipo PID=" + procId + " - killing now...");
SimpleCommand killCommand = new SimpleCommand("toolbox kill " + procId); SimpleCommand killCommand = new SimpleCommand("toolbox kill " + procId);
shell.add(killCommand); shell.add(killCommand);
@ -530,7 +530,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
fileTor= new File(appBinHome, TOR_ASSET_KEY); fileTor= new File(appBinHome, TOR_ASSET_KEY);
filePrivoxy = new File(appBinHome, PRIVOXY_ASSET_KEY); filePolipo = new File(appBinHome, POLIPO_ASSET_KEY);
fileObfsclient = new File(appBinHome, OBFSCLIENT_ASSET_KEY); fileObfsclient = new File(appBinHome, OBFSCLIENT_ASSET_KEY);
@ -625,7 +625,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
} }
enableBinExec(fileTor); enableBinExec(fileTor);
enableBinExec(filePrivoxy); enableBinExec(filePolipo);
enableBinExec(fileObfsclient); enableBinExec(fileObfsclient);
enableBinExec(fileXtables); enableBinExec(fileXtables);
@ -637,7 +637,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
sendCallbackStatusMessage(getString(R.string.status_starting_up)); sendCallbackStatusMessage(getString(R.string.status_starting_up));
runTorShellCmd(); runTorShellCmd();
runPrivoxyShellCmd(); runPolipoShellCmd();
if (mHasRoot && mEnableTransparentProxy) if (mHasRoot && mEnableTransparentProxy)
enableTransparentProxy(mTransProxyAll, mTransProxyTethering); enableTransparentProxy(mTransProxyAll, mTransProxyTethering);
@ -796,12 +796,12 @@ public class TorService extends Service implements TorServiceConstants, TorConst
} }
} }
private void runPrivoxyShellCmd () throws Exception private void runPolipoShellCmd () throws Exception
{ {
logNotice( "Starting privoxy process"); logNotice( "Starting polipo process");
int privoxyProcId = TorServiceUtils.findProcessId(filePrivoxy.getAbsolutePath()); int polipoProcId = TorServiceUtils.findProcessId(filePolipo.getAbsolutePath());
StringBuilder log = null; StringBuilder log = null;
@ -809,21 +809,21 @@ public class TorService extends Service implements TorServiceConstants, TorConst
Shell shell = Shell.startShell(); Shell shell = Shell.startShell();
if (privoxyProcId == -1) if (polipoProcId == -1)
{ {
log = new StringBuilder(); log = new StringBuilder();
String privoxyConfigPath = new File(appBinHome, PRIVOXYCONFIG_ASSET_KEY).getAbsolutePath(); String polipoConfigPath = new File(appBinHome, POLIPOCONFIG_ASSET_KEY).getAbsolutePath();
SimpleCommand cmdPrivoxy = new SimpleCommand(filePrivoxy.getAbsolutePath() + " " + privoxyConfigPath + " &"); SimpleCommand cmdPolipo = new SimpleCommand(filePolipo.getAbsolutePath() + " -c " + polipoConfigPath + " &");
shell.add(cmdPrivoxy); shell.add(cmdPolipo);
//wait one second to make sure it has started up //wait one second to make sure it has started up
Thread.sleep(1000); Thread.sleep(1000);
while ((privoxyProcId = TorServiceUtils.findProcessId(filePrivoxy.getAbsolutePath())) == -1 && attempts < MAX_START_TRIES) while ((polipoProcId = TorServiceUtils.findProcessId(filePolipo.getAbsolutePath())) == -1 && attempts < MAX_START_TRIES)
{ {
logNotice("Couldn't find Privoxy process... retrying...\n" + log); logNotice("Couldn't find Polipo process... retrying...\n" + log);
Thread.sleep(3000); Thread.sleep(3000);
attempts++; attempts++;
} }
@ -833,7 +833,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
sendCallbackLogMessage(getString(R.string.privoxy_is_running_on_port_) + PORT_HTTP); sendCallbackLogMessage(getString(R.string.privoxy_is_running_on_port_) + PORT_HTTP);
logNotice("Privoxy process id=" + privoxyProcId); logNotice("Polipo process id=" + polipoProcId);
shell.close(); shell.close();
@ -1713,7 +1713,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
if (obfsBridges) if (obfsBridges)
{ {
bridgeCfgKey = bridgeCfgKey + " obfs2"; bridgeCfgKey = bridgeCfgKey + " obfsclient";
} }
StringTokenizer st = new StringTokenizer(bridgeList,bridgeDelim); StringTokenizer st = new StringTokenizer(bridgeList,bridgeDelim);
@ -1726,7 +1726,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
if (obfsBridges) if (obfsBridges)
{ {
mBinder.updateConfiguration("ClientTransportPlugin","obfsclient exec " + fileObfsclient.getAbsolutePath() + " --managed", false); mBinder.updateConfiguration("ClientTransportPlugin","obfsclient exec " + fileObfsclient.getAbsolutePath(), false);
} }
mBinder.updateConfiguration("UpdateBridgesFromAuthority", "0", false); mBinder.updateConfiguration("UpdateBridgesFromAuthority", "0", false);

View File

@ -21,10 +21,10 @@ public interface TorServiceConstants {
public final static String TOR_CONTROL_COOKIE = "control_auth_cookie"; public final static String TOR_CONTROL_COOKIE = "control_auth_cookie";
//privoxy //privoxy
public final static String PRIVOXY_ASSET_KEY = "privoxy"; public final static String POLIPO_ASSET_KEY = "polipo";
//privoxy.config //privoxy.config
public final static String PRIVOXYCONFIG_ASSET_KEY = "privoxy.config"; public final static String POLIPOCONFIG_ASSET_KEY = "torpolipo.conf";
//geoip data file asset key //geoip data file asset key
public final static String GEOIP_ASSET_KEY = "geoip"; public final static String GEOIP_ASSET_KEY = "geoip";