FreeBSD has two mutually exclusive firewalls: ipfw(8) and pf(8). Currenlty only pf(8) is supported for transparent proxy lookups of destination addresses.
This patch adds support for ipfw(8). It first checks if /dev/pf exists. If it does, it assumes pf(8) is in use. Otherwise it assumes ipfw(8) is used.
ipfw(8) is actually native on FreeBSD and much more popular than pf(8).
Patch is against tor-0.2.3.25_1
Trac: Username: yurivict
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items ...
Show closed items
Linked items 0
Link issues together to show that they're related.
Learn more.
Marking for inclusion in 0.2.5; 0.2.3 and 0.2.4 are currently in bugfixes-only mode.
Can we do any checks to verify that ipfw is actually in use? Otherwise, getsockname() will succeed, but will give a (presumably local) address.
The code could be simplified by the use of tor_addr_from_sockaddr().
In get_pf_socket(), do we really want to keep trying to open /dev/pf every time we get an incoming socket? That seems pretty wasteful. Maybe we should remember that /dev/pf wasn't there.
Trac: Status: new to needs_review Milestone: N/Ato Tor: 0.2.5.x-final
I agree with your suggestions about tor_addr_from_sockaddr() and keeping the flag "/dev/pf exists"
On FreeBSD ipfw is the default, and to the minimal degree, is always used for the default allow-all rule. It can't be turned off completely, and also no additional rules can be added when pf is used. pf is a special-case, replacement firewall functionality. So opening /dev/pf is probably the best way to check what is the current firewall type in use.
You are right, this leaves the possibility for somebody to just connect to that address without firewall forwarding and then getsockaddr would produce the (meaningless) local address. This would be the error condition. Tor should not be trying to recursively connect to its own TransPort.
Another possibility is to allow the user to set the firewall type in config file, for example like this:
TransFirewallType ipfw
But this may be an overkill for this.
Well, we already need a special option for selecting TPROXY on linux (#10582 (moved)), so making a general purpose one wouldn't be too bad. I'm changing the TPROXY configuration option to be a bit more general so that we don't need one option per firewall type.
This will conflict with #10896 (moved) if we merge both; I'll work on a combined branch.
Changing to ipfw by default would be problematic because it would break all existing pf configurations. What we could do is have Tor 0.2.5 or 0.2.6 warn the users that the default will change in a later version, and then later change to ipfw by default.
See branch 10267_plus_10896_rebased in my public repository (https://gitweb.torproject.org/nickm/tor.git) for both branches, plus some small tweaks. I can confirm that the code looks okay to me so far and it doesn't break compilation on OSX or Linux; can somebody else confirm that ipfw still works with this branch, and that it doesn't break regular pf users?
yurivict, can you confirm that I didn't mangle your code badly or put anything inaccurate in the changes file?
This was closed 11 months ago, yet today 0.2.6.3-rc is released and the patch still isn't there.
get_pf_socket function in 0.2.6.3 is obviously old, and just opens /dev/pf on FreeBSD.
Milestone is set to Tor: 0.2.5.x-final. What am I missing?
An updated patch was merged; see above for discussion why.
Does "TransProxyType ipfw" not work for you? That should cause ipfw, rather than pf, to get used.
Trac: Keywords: andrea-review-0254, 025-triaged deleted, freebsd 026-backport added Priority: major to normal Milestone: Tor: 0.2.5.x-final to Tor: 0.2.7.x-final
I see, you modified it the way that the tor app still breaks with the same message, and old patch still applies, but "TransProxyType ipfw" makes it work. You should have mentioned this option.