From: "Peter Müller" <peter.mueller@ipfire.org>
To: development@lists.ipfire.org
Subject: [PATCH 1/4] Tor: allow multiple countries to be selected for Exit relays
Date: Wed, 04 Nov 2020 22:28:22 +0100 [thread overview]
Message-ID: <88bdbdd4-1418-1be0-6240-3123ca64c00c@ipfire.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 2953 bytes --]
This extends the functionality of the Tor CGI in order to be able to
select multiple countries for possible Exit relays, which is - in terms
of anonymity - less worse than limiting all Tor circuits to a single
country.
For example, a user might want to avoid Exit relays in more than one
country, and permit Tor to use Exit relays elesewhere, and vice versa.
Signed-off-by: Peter Müller <peter.mueller(a)ipfire.org>
---
html/cgi-bin/tor.cgi | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/html/cgi-bin/tor.cgi b/html/cgi-bin/tor.cgi
index 7447bd791..3db4bc22c 100644
--- a/html/cgi-bin/tor.cgi
+++ b/html/cgi-bin/tor.cgi
@@ -2,7 +2,7 @@
###############################################################################
# #
# IPFire.org - A linux based firewall #
-# Copyright (C) 2013-2019 IPFire Team <info(a)ipfire.org> #
+# Copyright (C) 2007-2020 IPFire Team <info(a)ipfire.org> #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
@@ -319,9 +319,16 @@ END
</tr>
<tr>
<td width='50%' colspan='2'>
- <select name='TOR_EXIT_COUNTRY'>
+ <select name='TOR_EXIT_COUNTRY' multiple='multiple'>
<option value=''>- $Lang::tr{'tor exit country any'} -</option>
END
+
+ # Convert Exit/Guard country strings into lists to make comparison easier
+ my @exit_countries;
+ if ($settings{'TOR_EXIT_COUNTRY'} ne '') {
+ @exit_countries = split(/\|/, $settings{'TOR_EXIT_COUNTRY'});
+ }
+
my @country_codes = &Location::database_countries($db_handle);
foreach my $country_code (@country_codes) {
# Convert country code into upper case format.
@@ -332,8 +339,8 @@ END
print "<option value='$country_code'";
- if ($settings{'TOR_EXIT_COUNTRY'} eq $country_code) {
- print " selected";
+ if ($settings{'TOR_EXIT_COUNTRY'} ne '') {
+ print " selected" if grep /$country_code/, @exit_countries;
}
print ">$country_name ($country_code)</option>\n";
@@ -678,8 +685,17 @@ sub BuildConfiguration() {
if ($settings{'TOR_EXIT_COUNTRY'} ne '') {
$strict_nodes = 1;
+ my $countrylist;
+
+ for my $singlecountry (split(/\|/, $settings{'TOR_EXIT_COUNTRY'})) {
+ if ($countrylist eq '') {
+ $countrylist = "{" . lc $singlecountry . "}";
+ } else {
+ $countrylist = $countrylist . "," . "{" . lc $singlecountry . "}";
+ }
+ }
- print FILE "ExitNodes {$settings{'TOR_EXIT_COUNTRY'}}\n";
+ print FILE "ExitNodes $countrylist\n";
}
if ($settings{'TOR_USE_EXIT_NODES'} ne '') {
--
2.26.2
next reply other threads:[~2020-11-04 21:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-04 21:28 Peter Müller [this message]
2020-11-04 21:28 ` [PATCH 2/4] Tor: allow enforcing distinct Guard relays or countries Peter Müller
2020-11-04 21:29 ` [PATCH 3/4] update translation files for changed Tor CGI strings Peter Müller
2020-11-04 21:29 ` [PATCH 4/4] Tor: bump package version number Peter Müller
2020-11-06 10:49 ` [PATCH 1/4] Tor: allow multiple countries to be selected for Exit relays Michael Tremer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=88bdbdd4-1418-1be0-6240-3123ca64c00c@ipfire.org \
--to=peter.mueller@ipfire.org \
--cc=development@lists.ipfire.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox