Community discussions

MikroTik App
 
Mariosg
just joined
Topic Author
Posts: 2
Joined: Tue Jul 24, 2018 10:30 pm

Block youtube and not google earth

Tue Jul 24, 2018 11:18 pm

Is there any way to block YouTube and work the Google Earth, Gmail, the Google Search Engine?
Sorry for my English, I speak Spanish
Thank you
Mario
 
User avatar
mkx
Forum Guru
Forum Guru
Posts: 13045
Joined: Thu Mar 03, 2016 10:23 pm

Re: Block youtube and not google earth

Tue Jul 24, 2018 11:33 pm

No, not when https is used to access those web pages.
 
User avatar
sindy
Forum Guru
Forum Guru
Posts: 11224
Joined: Mon Dec 04, 2017 9:19 pm

Re: Block youtube and not google earth

Wed Jul 25, 2018 12:57 am

Wouldn't an action=reject reject-with=tcp-reset tls-host=youtube.com be a way?
Last edited by sindy on Wed Jul 25, 2018 9:30 am, edited 1 time in total.
 
User avatar
vecernik87
Forum Veteran
Forum Veteran
Posts: 891
Joined: Fri Nov 10, 2017 8:19 am

Re: Block youtube and not google earth

Wed Jul 25, 2018 8:30 am

No. I was never able to really make this reliably working, and there is reason behind this.
I noticed that for example anonymous mode of Google Chrome will always start with http/2 (which is TCP) and only after that, it will switch to http/2+quic. After support for QUIC is cached, it will always start with it. TCP is required for TLS host, but QUIC is UDP. In non-anonymous mode, Chrome remembers it since first visit (unless cache is cleared)

As this is cached probably in every client (unless it is brand new and never visited youtube) you can't reliably use it. Chrome (both desktop and android) and youtube app (android) will pass it without issue. I tested these personally. I believe Opera and maybe some other browsers today have support for QUIC, but I have not tested it.
Last edited by vecernik87 on Wed Jul 25, 2018 8:56 am, edited 1 time in total.
 
User avatar
sindy
Forum Guru
Forum Guru
Posts: 11224
Joined: Mon Dec 04, 2017 9:19 pm

Re: Block youtube and not google earth

Wed Jul 25, 2018 8:34 am

I've known about QUIC, but didn't know its availability at server side was cached by the browsers. Thank you for pointing that out.
 
User avatar
vecernik87
Forum Veteran
Forum Veteran
Posts: 891
Joined: Fri Nov 10, 2017 8:19 am

Re: Block youtube and not google earth

Wed Jul 25, 2018 9:10 am

I didn't know either, until I tried to do this few month ago, failed and started looking why the hell... :lol:
If you ever find some workaround, I believe many people would be very glad for that (including myself)

edit: i couldn't help myself so I started digging and found that despite QUIC support being stored in cache of browser, sometime, new QUIC - Client Hello (CHLO) packet is sent when reaching youtube. This packet (according to wireshark) has easily visible SNI in plain-text. This is good enough to be filtered but not quite sure if as fast as native TSL-Host feature.

I noticed this CHLO packet is sent after some unspecified timeout. Therefore if you just visited youtube, any request (even newly opened tab or after browser restart) will not send CHLO but continue straight with already encrypted QUIC session... So we are back on begining - not reliable...
(just sharing my thoughts - maybe it is useful for someone)

edit2: While reading more about QUIC, I realized that CHLO is required everytime UDP connection needs to be (re)opened - which simply must happen every time after user joins the network. That effectively means we can consider QUIC-CHLO packet as reliable source of communication start. However, I have no idea how to use this knowledge to filter it...

For now, I was able to filter youtube by following:
/ip firewall filter
add action=drop chain=forward dst-address-list=youtube
/ip firewall address-list
add address=www.youtube.com list=youtube
add address=i.ytimg.com list=youtube
add address=youtubei.googleapis.com list=youtube
Not reliable, not neat, probably some side-effects ... but it is the best I can do for now. (And I believe it is better than hand-written list of many IP addresses which I saw in some other topics)
 
msatter
Forum Guru
Forum Guru
Posts: 2942
Joined: Tue Feb 18, 2014 12:56 am
Location: Netherlands / Nīderlande

Re: Block youtube and not google earth

Wed Jul 25, 2018 11:36 pm

I just don't allow UDP 80,443 to escape to the internet. I do this by blocking that traffic in RAW with any port.
 
Leinadmontilla
just joined
Posts: 12
Joined: Sat Jul 21, 2018 8:39 am

Re: Block youtube and not google earth

Thu Jul 26, 2018 5:48 am

You can block youtube using layer7 protocol.
 
User avatar
vecernik87
Forum Veteran
Forum Veteran
Posts: 891
Joined: Fri Nov 10, 2017 8:19 am

Re: Block youtube and not google earth

Thu Jul 26, 2018 6:55 am

No you can't and it was described many times, again and again. Layer7 filtering does not work if website use HTTPS. Only result will be slow router and CPU on 100% because every connection will be checked again and again... please watch following: https://youtu.be/XkKj9rj4quQ?t=25m43s It explains why you cant use Layer7
Unfortunately even suggested method (tls-host) is not working properly because youtube now use QUIC (if supported by browser or app), which is not TCP but UDP, therefore TLS-host rules will not match it...
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3345
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Block youtube and not google earth

Thu Jul 26, 2018 8:28 am

There are ways to do it but not with Mikrotik.

In our office, we do block many sites.
We do use "Enabling SSL decryption"
Find out more here:
https://www.websense.com/content/suppor ... nable.aspx

But there are many catches with that.
Some sites does not work
Some sites should not be inspected (bank/political)++
Some software that uses HTTPS sites needs to be white listed to work.
+++
Last edited by Jotne on Wed Apr 08, 2020 4:30 pm, edited 1 time in total.
 
User avatar
vecernik87
Forum Veteran
Forum Veteran
Posts: 891
Joined: Fri Nov 10, 2017 8:19 am

Re: Block youtube and not google earth

Thu Jul 26, 2018 10:13 am

"To implement SSL decryption for your end users, you need a root certificate on each client machine that acts as a Certificate Authority for SSL requests to the cloud proxy."

So - you have to manually set up each client to support this, otherwise you will see famous "your connection is not secure" message. Some apps which simply rely on https and do not allow modification of SSL (because they have hard-coded certificate to avoid tampering) will not work. Some sites as you say may also not work.


That is not solution, merely terrible band-aid approach causing compromised security and many other issues. If you have to do such thing, fine, but please - never ever promote it or suggest to people, who are unaware of consequences.
 
pe1chl
Forum Guru
Forum Guru
Posts: 10529
Joined: Mon Jun 08, 2015 12:09 pm

Re: Block youtube and not google earth

Thu Jul 26, 2018 10:27 am

Those solutions are at the end of their lifetime anyway now that more and more initiatives are made
to actually check the certificate authority for certificates (DANE etc). The browser will alarm the user
when accessing e.g. youtube but the certificate is not the one that youtube indicates.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3345
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Block youtube and not google earth

Thu Jul 26, 2018 1:24 pm

The browser will alarm the user
when accessing e.g. youtube but the certificate is not the one that youtube indicates.
Do you know when this would be implemented?
I do not see any message like this.
PS I do not like this way of implementation that my work has done, cannot do anything about it.
 
pe1chl
Forum Guru
Forum Guru
Posts: 10529
Joined: Mon Jun 08, 2015 12:09 pm

Re: Block youtube and not google earth

Thu Jul 26, 2018 2:05 pm

The browser will alarm the user
when accessing e.g. youtube but the certificate is not the one that youtube indicates.
Do you know when this would be implemented?
I do not see any message like this.
Google Chrome does this already for some of Google's own sites.
It is only a matter of time until this is extended to other sites and other browsers.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3345
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Block youtube and not google earth

Thu Jul 26, 2018 2:16 pm

Can you give me a site to try from my work PC.
It would be interesting to se if it is detected.
 
User avatar
krafg
Forum Guru
Forum Guru
Posts: 1042
Joined: Sun Jun 28, 2015 7:36 pm

Re: Block youtube and not google earth

Fri Jul 27, 2018 8:17 pm

No you can't and it was described many times, again and again. Layer7 filtering does not work if website use HTTPS. Only result will be slow router and CPU on 100% because every connection will be checked again and again... please watch following: https://youtu.be/XkKj9rj4quQ?t=25m43s It explains why you cant use Layer7
Unfortunately even suggested method (tls-host) is not working properly because youtube now use QUIC (if supported by browser or app), which is not TCP but UDP, therefore TLS-host rules will not match it...
Today you CAN block Youtube using Layer7. It works with HTTP and HTTPS!
Try it!
Regards.
 
pe1chl
Forum Guru
Forum Guru
Posts: 10529
Joined: Mon Jun 08, 2015 12:09 pm

Re: Block youtube and not google earth

Fri Jul 27, 2018 11:10 pm

Today you CAN block Youtube using Layer7. It works with HTTP and HTTPS!
Try it!
... but now Google/Youtube has moved on to QUIC, read above!
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3345
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Block youtube and not google earth

Fri Jul 27, 2018 11:25 pm

According to wikipedia QUIC is an experimenta protocol.

Since our work do inspect HTTPS using Forecepoint to intercept HTTPS, Quic should give problem with blocking HTTPS.
As far as I can see HTTPS/Youtube and HTTPS/Google are logged and tracked by Forepoint.
Can also be blocked.
I do not see any error inn Chrome (v68) that there are anything wrong with those site.
So you as far as I can see, you can block HTTPS sites, but not with Mikrotik.
 
kevinds
Long time Member
Long time Member
Posts: 657
Joined: Wed Jan 14, 2015 8:41 am

Re: Block youtube and not google earth

Sat Jul 28, 2018 3:28 am

Could this not be done with DNS?

Simple hosts file or on the DNS server?
 
nitrohydride
newbie
Posts: 29
Joined: Mon Oct 08, 2018 10:37 pm

Re: Block youtube and not google earth

Tue Oct 09, 2018 10:14 am

Could this not be done with DNS?

Simple hosts file or on the DNS server?
You can make it, but it will affect every DNS user. Unless Mikrotik can redirect only chosen ones to another dns server (but i guess it is impossible).

@vacernik87 I've tested TLS host and Layer 7 solution. It works for me after browser restart, i will do more test anyway..
 
lil0
just joined
Posts: 7
Joined: Fri Mar 28, 2014 6:54 pm
Location: BG
Contact:

Re: Block youtube and not google earth

Tue Dec 18, 2018 10:04 am

My simple solution work for me.
Block only youtube.com without google maps, gmail etc.
#router is dns server, all dns request to my dns server :
/ip firewall filter
add action=redirect chain=dstnat dst-port=53 protocol=udp to-ports=53
add action=redirect chain=dstnat dst-port=53 protocol=tcp to-ports=53
# block
add action=drop chain=forward comment=youtube dst-address-list=youtube protocol=tcp
/ip firewall address-list
add address=216.58.21x.xxx list=youtube
add address=216.58.20x.xxx list=youtube
add address=172.217.16x.xxx list=youtube
add address=172.217.16x.xxx list=youtube
add address=216.58.20x.xxx list=youtube
add address=172.217.1x.xxx list=youtube
add address=172.217.1x.xxx list=youtube
add address=216.239.3x.xxx list=youtube
add address=216.58.21x.xxx list=youtube

addresses may depends of your country and ISP.

You can find it try :
nslookup www.youtube.com
Server: 192.168.88.1
Address: 192.168.88.1#53

Answer : XXXXXXXXX
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3345
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Block youtube and not google earth

Wed Apr 08, 2020 4:35 pm

M
/ip firewall address-list
add address=216.58.21x.xxx list=youtube
add address=216.58.20x.xxx list=youtube
add address=172.217.16x.xxx list=youtube
add address=172.217.16x.xxx list=youtube
add address=216.58.20x.xxx list=youtube
add address=172.217.1x.xxx list=youtube
add address=172.217.1x.xxx list=youtube
add address=216.239.3x.xxx list=youtube
add address=216.58.21x.xxx list=youtube
You may get problem with other web site hosted on same server as Youtube. It's common than many sites share same ip/platform

Who is online

Users browsing this forum: FurfangosFrigyes and 28 guests