I’ve restricted Tor to Exit Nodes in certain countrys. If i start it, it says
Nov 05 17:32:15.000 [warn] Failed to open GEOIP file /nix/store/ikmb0w7z22iw7w1ra9dszr6aip1yq390-tor-0.4.8.7/share/tor/geoip.
Nov 05 17:32:15.000 [warn] We've been configured to use (or avoid) nodes in certain countries, and we need GEOIP information to figure out which ones they are.
Nov 05 17:32:15.000 [warn] Failed to open GEOIP file /nix/store/ikmb0w7z22iw7w1ra9dszr6aip1yq390-tor-0.4.8.7/share/tor/geoip6.
Nov 05 17:32:15.000 [warn] We've been configured to use (or avoid) nodes in certain countries, and we need GEOIP information to figure out which ones they are.
Nov 05 17:32:15.000 [notice] Bootstrapped 0% (starting): Starting
Nov 05 17:32:15.000 [notice] Starting with guard context "default"
and hangs there forever.
I’ve then set up geoipupdate
and i can see the file that it downloaded but if i point tor to it, it prints out huge amounts of data to the terminal that it can’t parse and then gets stuck just the same.
How do i set up Tor with GeoIP on Nixos correctly?
How did you configure that?
Can you show me the config pls
thanks 
As far as I know one can specify that in the torrc
file and with NixOS it is specified in the config file with the services.tor.settings.GeoIPFile = <path_to_geoipfile>;
option.
tor docs regarding geoip
Hi,
i tried again with this in my torrc
StrictNodes 1
ExitNodes {ch}
GeoIPFile /var/lib/GeoIP
GeoIPv6File /var/lib/GeoIP
and now tor parses the GeoIP file without complaint. I don’t know why it didn’t work the first time.
However, tor now complains
Nov 08 06:11:17.864 [notice] Tor 0.4.8.7 running on Linux with Libevent 2.1.12-stable, OpenSSL 3.0.11, Zlib 1.3, Liblzma 5.4.4, Libzstd 1.5.5 and Glibc 2.38 as libc.
Nov 08 06:11:17.864 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://support.torproject.org/faq/staying-anonymous/
Nov 08 06:11:17.864 [notice] Read configuration file "/home/sperber/Dokumente/Install/Linux/torrc".
Nov 08 06:11:17.865 [notice] Opening Socks listener on 127.0.0.1:9050
Nov 08 06:11:17.865 [notice] Opened Socks listener connection (ready) on 127.0.0.1:9050
Nov 08 06:11:17.000 [notice] Parsing GEOIP IPv4 file /var/lib/GeoIP.
Nov 08 06:11:17.000 [warn] Country code 'ch' is not recognized.
Nov 08 06:11:17.000 [notice] Parsing GEOIP IPv6 file /var/lib/GeoIP.
Nov 08 06:11:17.000 [notice] Bootstrapped 0% (starting): Starting
Nov 08 06:11:18.000 [notice] Starting with guard context "default"
which i don’t understand because this is the correct country code and when i used this torrc with tor-browser
(without the GeoIP File reference) it worked fine.
I’ve set
geoipupdate = {
enable = true;
settings = {
AccountID = 123456;
LicenseKey = "/home/sperber/Dokumente/Install/Linux/geoipupdate";
EditionIDs = [
"GeoLite2-Country"
];
};
};
I also noticed that when i activate tor as a service in NixOS, geoip
is installed as a dependency but it still didn’t work for me initially.
geoipupdate
is a completely different package and as far as I know has nothing to do with the TOR configuration.
The config I’d have come up with would look something like this
{
services = {
tor = {
enable = true;
settings = {
GeoIPFile = "<path_to_file>";
};
};
};
}
An the file that the GeoIPFile
option points to would look something like this.
1 Like
Ah, i see. That works, thank you!
1 Like