commit d1e299250a97448d240f44a542fc04194dfb23e3 Author: n8fr8 nathan@freitas.net Date: Mon Oct 1 00:18:22 2012 +0530
adds UDP reject for transproxy; thx to patrickbx
From a81741afe06ac2309b4306dedbd5a0ebf755b7e1 Mon Sep 17 00:00:00 2001 From: patch patrickbx@gmail.com --- .../torproject/android/service/TorTransProxy.java | 38 +++++++++++++++++++- 1 files changed, 37 insertions(+), 1 deletions(-)
diff --git a/src/org/torproject/android/service/TorTransProxy.java b/src/org/torproject/android/service/TorTransProxy.java index 8753097..1a34c5c 100644 --- a/src/org/torproject/android/service/TorTransProxy.java +++ b/src/org/torproject/android/service/TorTransProxy.java @@ -309,6 +309,16 @@ public class TorTransProxy implements TorServiceConstants { script.append(" -j REJECT"); script.append(" || exit\n"); + // Reject all other outbound UDP packets + script.append(ipTablesPath); + script.append(" -A OUTPUT"); + script.append(" -t filter"); + script.append(" -m owner --uid-owner "); + script.append(tApp.getUid()); + script.append(" -p udp"); + script.append(" -j REJECT"); + script.append(" || exit\n"); + } } @@ -407,6 +417,16 @@ public class TorTransProxy implements TorServiceConstants { script.append(" -j REJECT"); script.append(" || exit\n"); + // Reject all other outbound TCP packets + script.append(ipTablesPath); + script.append(" -D OUTPUT"); + script.append(" -t filter"); + script.append(" -m owner --uid-owner "); + script.append(tApp.getUid()); + script.append(" -p udp"); + script.append(" -j REJECT"); + script.append(" || exit\n"); + } } @@ -648,7 +668,15 @@ public class TorTransProxy implements TorServiceConstants { script.append(" -p tcp"); script.append(" -j REJECT"); script.append(" || exit\n"); - + + // Reject all other outbound UDP packets + script.append(ipTablesPath); + script.append(" -t filter"); + script.append(" -A OUTPUT"); + script.append(" -p udp"); + script.append(" -j REJECT"); + script.append(" || exit\n"); + String[] cmdAdd = {script.toString()}; code = TorServiceUtils.doShellCommand(cmdAdd, res, runRoot, waitFor); @@ -717,6 +745,14 @@ public class TorTransProxy implements TorServiceConstants { script.append(" -j REJECT"); script.append(" || exit\n"); + // Reject all other outbound TCP packets + script.append(ipTablesPath); + script.append(" -D OUTPUT"); + script.append(" -t filter"); + script.append(" -p udp"); + script.append(" -j REJECT"); + script.append(" || exit\n"); + String[] cmdAdd = {script.toString()}; code = TorServiceUtils.doShellCommand(cmdAdd, res, runRoot, waitFor);
tor-commits@lists.torproject.org