I have some rules on the FILTER table of Netfilter, which block HTTPS access to some websites:
-A FORWARD -s 10.255.255.0/26 -p tcp -m tcp --dport 443 -m string --string "facebook.com" --algo bm -j DROP
-A FORWARD -s 10.255.255.0/26 -p tcp -m tcp --dport 443 -m string --string "instagram.com" --algo bm -j DROP
-A FORWARD -s 10.255.255.0/26 -p tcp -m tcp --dport 443 -m string --string "snapchat.com" --algo bm -j DROP
-A FORWARD -s 10.255.255.0/26 -p tcp -m tcp --dport 443 -m string --string "tumblr.com" --algo bm -j DROP
-A FORWARD -s 10.255.255.0/26 -p tcp -m tcp --dport 443 -m string --string "twitter.com" --algo bm -j DROP
-A FORWARD -s 10.255.255.0/26 -p tcp -m tcp --dport 443 -m string --string "youtube.com" --algo bm -j DROP
All rules work pretty fine, with the exception of the last rule (YouTube), that does not work when requesting youtube.com via Google Chrome. I tried to use other Web Browsers like Mozilla Firefox and Microsoft Edge, and for these Web Browsers, the rule works perfectly.
I'm not an expert on HTTP/HTTPS protocol, regarding headers, packets and the exact information that comes from a Web Server, but my guess, is that when the YouTube servers reply to a request (SYN-ACK) that comes from Google Chrome User-Agent, the information that comes with the packets, does not contain any string regarding "youtube.com" and maybe there could be other modifications in that case, in order to improve the performance of Google Chrome (YouTube + Google) regarding Google products.
I tried to change the algorithm, from bm (Boyer-Moore) to kmp (Knuth-Pratt-Morris), but no use.
My question is:
- Is there any IPTABLES rule for blocking requests for "youtube" via Google Chrome, without blocking IPs?