Hi all,
I'm currently experimenting with Squid. The idea is the following: during office hours you can only go to certain sites. Outside these hours you can browse to whichever site you want. This is for specific IP(s) or IP ranges/subnets. No client side configuration. This is how the network looks:
The router routes packets for the client to the Squid proxy. The client has the Squid proxy as the gateway. I have FreeBSD 9.2 on the proxy. Squid 3.4 compiled from source with the --with-nat-devpf and --enable-pf-transparent options. Firewall is PF.
Somewhere in the process I got confused with the different ways to configure Squid and PF. I need intercept or TPROXY as http_port option. From what I understand intercept will see packets that are for a webserver on the internet through port 80. The Squid proxy server will then set up its own connection to the webserver with its own IP.
Therefor this won't work with HTTPS. Unless making use of SslBump. SslBump creates a secure connection with the proxy server, which in his turn creates an SSL connection to the webserver. So this is a man-in-the-middle. This reason and because you need to install a root certificate in the client browser don't want to make use of this method.
So I need TPROXY here. If I understand it correctly TPROXY acts as the client (sending IP packets to the webserver with the client's IP). I'm not clear on if the client still has an SSL connection to the proxy server or not (I would think it still has) and if that needs SslBump anyway (still needing to need to add a certificate to the server? TPROXY should be really transparent).
However, any way I configure PF it seems like the packets are either arriving at the Squid proxy or something goes wrong with them. I read that I need ipdivert.ko which is available in my kernel.
I'm currently fiddling around with these rules:
OR
It's unclear to me what the difference is between the divert-to and rdr rules.
Might there be a problem with these rules because I only have one interface? Please correct me if I'm wrong at any point. What way should I go here to get the explained goal?
Thanks in advance for any help!
I'm currently experimenting with Squid. The idea is the following: during office hours you can only go to certain sites. Outside these hours you can browse to whichever site you want. This is for specific IP(s) or IP ranges/subnets. No client side configuration. This is how the network looks:
Code:
client --- --- router/firewall --- internet
|
squid proxy
The router routes packets for the client to the Squid proxy. The client has the Squid proxy as the gateway. I have FreeBSD 9.2 on the proxy. Squid 3.4 compiled from source with the --with-nat-devpf and --enable-pf-transparent options. Firewall is PF.
Somewhere in the process I got confused with the different ways to configure Squid and PF. I need intercept or TPROXY as http_port option. From what I understand intercept will see packets that are for a webserver on the internet through port 80. The Squid proxy server will then set up its own connection to the webserver with its own IP.
Therefor this won't work with HTTPS. Unless making use of SslBump. SslBump creates a secure connection with the proxy server, which in his turn creates an SSL connection to the webserver. So this is a man-in-the-middle. This reason and because you need to install a root certificate in the client browser don't want to make use of this method.
So I need TPROXY here. If I understand it correctly TPROXY acts as the client (sending IP packets to the webserver with the client's IP). I'm not clear on if the client still has an SSL connection to the proxy server or not (I would think it still has) and if that needs SslBump anyway (still needing to need to add a certificate to the server? TPROXY should be really transparent).
However, any way I configure PF it seems like the packets are either arriving at the Squid proxy or something goes wrong with them. I read that I need ipdivert.ko which is available in my kernel.
I'm currently fiddling around with these rules:
Code:
rdr pass on $lan_if inet proto tcp from 192.168.1.32 to any port 443 -> 127.0.0.1 port 3129
rdr pass on $lan_if inet proto tcp from 192.168.1.32 to any port 80 -> 127.0.0.1 port 3128
Code:
pass in quick log on em0 proto tcp from 192.168.1.32 to any port 80 divert-to localhost port 3128
pass in quick log on em0 proto tcp from 192.168.1.32 to any port 443 divert-to localhost port 3129
Might there be a problem with these rules because I only have one interface? Please correct me if I'm wrong at any point. What way should I go here to get the explained goal?
Thanks in advance for any help!