Hello Michael,
thanks for the clarification.
Hello,
On Wed, 2018-06-27 at 22:53 +0200, Peter Müller wrote:
Hello,
for quite some time, IPFire includes Tor via Pakfire as an add-on.
Trying to set up a Tor relay there, I stumbled into several problems regarding firewall rule configuration:
(a) Inbound It turns out that Tor is not working correctly if GeoIP block is active (this occurred after a reboot - strange). Of course, one possibility is to disable GeoIP block at all, allow access to the Tor relay ports, and deny any except those of legitimate countries to other services on the firewall machine.
You can use the normal firewall rules for a more granular configuration.
The geoip filter comes first and then all the rest. Depending on how many countries you block here, Tor connectivity becomes a little bit useless.
Indeed. And I block many... :-)
Since this enlarges the ruleset (already quite complex here :-| ), I am wondering if there is a more simple way to achieve this.
We could move tor rules before the GeoIP filter, but I am not sure if that is very intuitive.
I do not think so since users may expect anything is blocked then and wonder why Tor still works fine. We should keep firewall things intentional in order not to puzzle users.
OK, incoming way is solved then.
(b) Outbound For security reasons (surprise!), outgoing connections are heavily limited here - only DNS, NTP and web traffic is allowed, and only to a certain list of countries. Some call that "racist routing"...
This does not work with Tor since it needs to open connections to almost any port on almost any IP address. Allowing outbound traffic in general is out of question, so there seems to possibility left.
Besides from running a Tor relay in the local DMZ and apply the firewall rules for this machine, is there another way?
Not that I am aware of.
You can build something custom here by using the -m owner module of iptables and make an exception in the OUTPUT chain for the tor process. You just need a little script that puts the pid into it if you cannot check by uid.
Hm, I never used the "owner" module before...
I guess these custom firewall will need to be placed in "firewall.local" (https://wiki.ipfire.org/configuration/firewall/firewall.local)? According to the firewall processing scheme (https://wiki.ipfire.org/_media/configuration/firewall/ipfire_fw_chains.jpg), it is processed before anything else, so this would suit.
Will test this and get back if problems occur.
Best regards, Peter Müller