adds UDP reject for transproxy; thx to patrickbx

From a81741afe06ac2309b4306dedbd5a0ebf755b7e1 Mon Sep 17 00:00:00 2001
From: patch <patrickbx@gmail.com>
This commit is contained in:
n8fr8 2012-10-01 00:18:22 +05:30
parent 971c04e9f2
commit d1e299250a
1 changed files with 37 additions and 1 deletions

View File

@ -309,6 +309,16 @@ public class TorTransProxy implements TorServiceConstants {
script.append(" -j REJECT"); script.append(" -j REJECT");
script.append(" || exit\n"); 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(" -j REJECT");
script.append(" || exit\n"); 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");
} }
} }
@ -649,6 +669,14 @@ public class TorTransProxy implements TorServiceConstants {
script.append(" -j REJECT"); script.append(" -j REJECT");
script.append(" || exit\n"); 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()}; String[] cmdAdd = {script.toString()};
code = TorServiceUtils.doShellCommand(cmdAdd, res, runRoot, waitFor); code = TorServiceUtils.doShellCommand(cmdAdd, res, runRoot, waitFor);
@ -717,6 +745,14 @@ public class TorTransProxy implements TorServiceConstants {
script.append(" -j REJECT"); script.append(" -j REJECT");
script.append(" || exit\n"); 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()}; String[] cmdAdd = {script.toString()};
code = TorServiceUtils.doShellCommand(cmdAdd, res, runRoot, waitFor); code = TorServiceUtils.doShellCommand(cmdAdd, res, runRoot, waitFor);