Basic support for freebsd ipfw firewall#21
Basic support for freebsd ipfw firewall#21stuart-mclaren wants to merge 1 commit intosorz:masterfrom
Conversation
FreeBSD's ipfw firewall does not rewrite the destination IP address when forwarding using rules such as: 00100 fwd 127.0.0.1,2080 tcp from me to not me 80,443 This commit adds ipfw support by assuming transparent redirection on freebsd. If you create the above rule and point moproxy at a http proxy at IP address 1.2.3.4 $ moproxy -b 127.0.0.1 -p 2080 -t 1.2.3.4:8080 You can fetch remote 443 or 80 ports without setting proxy environment variables, eg: $ curl https://example.com:443 <HTML>...
d3f76c0 to
ec788de
Compare
|
In current design, the TCP port for transparent proxy also serve as SOCKSv5 server. |
|
Thanks for your feedback. Looking at the ipfw man page (https://www.freebsd.org/cgi/man.cgi?ipfw(8))
I think this means that, in principle, we can distinguish between firewall redirected packets and direct connections. Adding some debug to the code and running produced this log output Note: addr has been set to 216.58.193.142:80 as per the man page. This is different to a direct connection, eg Note that addr is unchanged (127.0.0.1:2080) because it hasn't been affected by the firewall. So (hopefully) something like this would work (pseudo code): |
|
But if it's bind on I start feeling that reusing the socket for SOCKS proxy is a mistake from the beginning. I should at least give a CLI switch for it. |
3ba264b to
b62babf
Compare
FreeBSD's ipfw firewall does not rewrite the destination IP address when forwarding
using rules such as:
00100 fwd 127.0.0.1,2080 tcp from me to not me 80,443
This commit adds ipfw support by assuming transparent redirection on freebsd.
If you create the above rule and point moproxy at a http proxy at IP address 1.2.3.4
$ moproxy -b 127.0.0.1 -p 2080 -t 1.2.3.4:8080
You can fetch remote 443 or 80 ports without setting proxy environment variables, eg:
$ curl https://example.com:443
...