###############################################################################
# #
# IPFire.org - A linux based firewall #
-# Copyright (C) 2013-2019 IPFire Team <info@ipfire.org> #
+# Copyright (C) 2007-2020 IPFire Team <info@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 #
</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
my @country_codes = &Location::Functions::get_locations("no_special_locations");
+
+ # 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'});
+ }
+
foreach my $country_code (@country_codes) {
# Convert country code into upper case format.
$country_code = uc($country_code);
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";
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 '') {