<div dir="ltr">Thanks, Amos.<br><div><br></div><div>I tried implementing the configuration you suggested but I am getting an error message:</div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>FATAL: Invalid ACL type 'ssl::server_name'</div><div>FATAL: Bungled /etc/squid/squid.conf line 36: acl server_blacklist ssl::server_name "/etc/squid/domain_blacklist.txt"</div><div> </div></blockquote>I tried reading the documentation but can't find anything wrong in my config file, I used the 2 lines exactly like they are in your suggestion, and I am running Squid 4.10.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 9, 2021 at 2:48 PM Amos Jeffries <<a href="mailto:squid3@treenet.co.nz">squid3@treenet.co.nz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 10/03/21 12:57 am, roee klinger wrote:<br>
> Hey,<br>
> <br>
> I have found a lot of outdated or conflicting information about this <br>
> online, and since this is a really important matter, I wanted to make <br>
> sure I am doing this correctly.<br>
> <br>
> I am attempting to block some websites completely, including all HTTPS <br>
> traffic and subdomains.<br>
> <br>
<br>
Basically there are two protocols that need to be considered for this. <br>
HTTP and TLS.<br>
<br>
In HTTP the "website" is identified by a domain name in the <br>
request-target (aka URI, sometimes called URL).<br>
  * The 'dstdomain' ACL type matches URI domain name.<br>
  * The http_access directive is where that domain name becomes <br>
available for Squid to check.<br>
<br>
<br>
In TLS the "website" is identified by the TLS SNI sent by the client, or <br>
a field in the server X.509 certificate.<br>
  * The 'ssl::server_name' ACL type matches those details.<br>
  * The ssl_bump directive<br>
<br>
<br>
Next thing is to be aware that there are many ways to layer protocols. <br>
Do expect to see vastly different proxy behaviours for each permutation <br>
of those.<br>
  * port 443 "HTTPS" is TLS then HTTP<br>
  * port 80 "HTTPS" is HTTP then TLS (quite rare)<br>
  * forward-proxy "HTTPS" is HTTP then TLS then HTTP<br>
<br>
<br>
<br>
> Squid.conf:<br>
> <br>
>     acl domain_blacklist dstdomain "/etc/squid/domain_blacklist.txt"<br>
>     http_access deny all domain_blacklist<br>
<br>
The "all" here is pointless.<br>
<br>
<br>
>     http_reply_access deny domain_blacklist<br>
<br>
Use of reply access directive for blacklisting by request details is not <br>
useful.<br>
<br>
The request already got blocked. So any response reaching here is just <br>
the error page saying forbidden. Blocking that error page would just <br>
change it to a slightly different error page saying the *response* was <br>
forbidden - which is a bit confusing for any user trying to understand <br>
why their request didn't work.<br>
<br>
<br>
>     http_access deny CONNECT domain_blacklist<br>
> <br>
<br>
This line is useless here.<br>
<br>
squid.conf lines are interpreted top-down. The "deny all <br>
domain_blacklist" already stopped all requests that could possibly match <br>
the second condition of this line.<br>
<br>
<br>
> <br>
> /etc/squid/domain_blacklist.txt:<br>
> <br>
>     .ph<br>
>     .<a href="http://somepornwebsite.com" rel="noreferrer" target="_blank">somepornwebsite.com</a><br>
>     .<a href="http://facebook.com" rel="noreferrer" target="_blank">facebook.com</a><br>
> <br>
...<br>
> <br>
> Am I doing this the right way?<br>
<br>
<br>
Sort of. Your http_access denial will catch all the HTTP and decrypted <br>
HTTP(S) traffic. It will not be able to block any HTTP(S) requests that <br>
are not able to decrypt.<br>
<br>
To catch and block these domains without needing the decrypt you should <br>
also use:<br>
<br>
  acl server_blacklist ssl::server_name "/etc/squid/domain_blacklist.txt"<br>
  ssl_bump terminate server_blacklist<br>
<br>
Of course there is always the failure case where traffic cannot decrypt <br>
and the TLS details use different server names.<br>
<br>
<br>
Amos<br>
_______________________________________________<br>
squid-users mailing list<br>
<a href="mailto:squid-users@lists.squid-cache.org" target="_blank">squid-users@lists.squid-cache.org</a><br>
<a href="http://lists.squid-cache.org/listinfo/squid-users" rel="noreferrer" target="_blank">http://lists.squid-cache.org/listinfo/squid-users</a><br>
</blockquote></div>