I have set up a tor relay to aid people in countries without free press. How can I limit the use to such countries (e.g. by country code) and prevent the use of my bandwith for users from all other countries?
1 Answer
As an anonymity network, relays don't learn geographical information of Tor clients (edit: in the general case) so this isn't possible. You could instead run a private bridge, and give out the bridge address to people in those countries (and possibly add a firewall rule to block IP addresses outside of your intended countries).
-
Thanks for your answer, but shouldn't an entry node be able to determine the location from the IP address?– RobertCommented Mar 13, 2022 at 6:38
-
-
Ah, so do I understand your answer correctly that, while it would theoretically be possible, it is not implemented by choice?– RobertCommented Mar 14, 2022 at 16:37
-
Mostly yeah. A relay can only know the IP addresses of users for circuits in which the relay is in the entry position. So a relay could be implemented to use IP-based geo blocking for only specific circuits where the relay is the first hop. Other circuits where the relay is not the first hop would need to be allowed since the relay doesn't know the user's IP address. And although you could implement this manually, I don't think blocking people in this way would be good for the network, and might get your relay removed if it seems to be misconfigured and causing connectivity issues for users.– SteveCommented Mar 15, 2022 at 6:23