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
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 \
liballium liballium-clean \
obfsclient obfsclient-clean \
privoxy privoxy-clean
polipo polipo-clean
all: assets
@ -280,37 +280,20 @@ obfsclient-clean:
git clean -fdx
#------------------------------------------------------------------------------#
# privoxy
# polipo
polipo-build-stamp:
$(MAKE) CC="$(CC)" -C polipo
touch polipo-build-stamp
privoxy/config.log:
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
polipo: polipo-build-stamp
test -d bin || mkdir bin
cp privoxy/privoxy bin
cp polipo/polipo bin
privoxy-clean:
-rm -f bin/privoxy
-rm -f privoxy-build-stamp
-rm -rf privoxy
polipo-clean:
-rm -f bin/polipo
-rm -f polipo-build-stamp
-rm -rf polipo
#------------------------------------------------------------------------------#
# JTorControl library
@ -338,16 +321,16 @@ jtorctl-clean:
#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
assets: tor privoxy jtorctl iptables obfsclient
assets: tor polipo jtorctl iptables obfsclient
install bin/jtorctl.jar ../libs
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/tor.mp3 bin/tor
-zip ../res/raw/xtables.mp3 bin/xtables
assets-clean:
-rm ../res/raw/privoxy.mp3
-rm ../res/raw/polipo.mp3
-rm ../res/raw/obfsclient.mp3
-rm ../res/raw/tor.mp3
-rm ../res/raw/xtables.mp3
@ -356,7 +339,7 @@ assets-clean:
#------------------------------------------------------------------------------#
# 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

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:paddingLeft="15px"
android:textColor="#ffffff" />
<TextView android:text="@string/privoxy_version"
<TextView android:text="@string/polipo_version"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:autoLink="web"

View File

@ -58,7 +58,7 @@
<string name="btn_cancel">Cancel</string>
<!--Welcome Wizard strings (DJH)-->
<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_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>
@ -162,7 +162,7 @@
<string name="warning_error_starting_transparent_proxying_">WARNING: error starting transparent proxying!</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="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="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>
@ -212,7 +212,7 @@
<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="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="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>

View File

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

View File

@ -85,7 +85,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
private File appCacheHome;
private File fileTor;
private File filePrivoxy;
private File filePolipo;
private File fileObfsclient;
private File fileXtables;
@ -483,10 +483,10 @@ public class TorService extends Service implements TorServiceConstants, TorConst
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);
shell.add(killCommand);
@ -530,7 +530,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
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);
@ -625,7 +625,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
}
enableBinExec(fileTor);
enableBinExec(filePrivoxy);
enableBinExec(filePolipo);
enableBinExec(fileObfsclient);
enableBinExec(fileXtables);
@ -637,7 +637,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
sendCallbackStatusMessage(getString(R.string.status_starting_up));
runTorShellCmd();
runPrivoxyShellCmd();
runPolipoShellCmd();
if (mHasRoot && mEnableTransparentProxy)
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;
@ -809,21 +809,21 @@ public class TorService extends Service implements TorServiceConstants, TorConst
Shell shell = Shell.startShell();
if (privoxyProcId == -1)
if (polipoProcId == -1)
{
log = new StringBuilder();
String privoxyConfigPath = new File(appBinHome, PRIVOXYCONFIG_ASSET_KEY).getAbsolutePath();
SimpleCommand cmdPrivoxy = new SimpleCommand(filePrivoxy.getAbsolutePath() + " " + privoxyConfigPath + " &");
String polipoConfigPath = new File(appBinHome, POLIPOCONFIG_ASSET_KEY).getAbsolutePath();
SimpleCommand cmdPolipo = new SimpleCommand(filePolipo.getAbsolutePath() + " -c " + polipoConfigPath + " &");
shell.add(cmdPrivoxy);
shell.add(cmdPolipo);
//wait one second to make sure it has started up
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);
attempts++;
}
@ -833,7 +833,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
sendCallbackLogMessage(getString(R.string.privoxy_is_running_on_port_) + PORT_HTTP);
logNotice("Privoxy process id=" + privoxyProcId);
logNotice("Polipo process id=" + polipoProcId);
shell.close();
@ -1713,7 +1713,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
if (obfsBridges)
{
bridgeCfgKey = bridgeCfgKey + " obfs2";
bridgeCfgKey = bridgeCfgKey + " obfsclient";
}
StringTokenizer st = new StringTokenizer(bridgeList,bridgeDelim);
@ -1726,7 +1726,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
if (obfsBridges)
{
mBinder.updateConfiguration("ClientTransportPlugin","obfsclient exec " + fileObfsclient.getAbsolutePath() + " --managed", false);
mBinder.updateConfiguration("ClientTransportPlugin","obfsclient exec " + fileObfsclient.getAbsolutePath(), 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";
//privoxy
public final static String PRIVOXY_ASSET_KEY = "privoxy";
public final static String POLIPO_ASSET_KEY = "polipo";
//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
public final static String GEOIP_ASSET_KEY = "geoip";