Community discussions

MikroTik App
 
b2k
just joined
Topic Author
Posts: 24
Joined: Tue Nov 24, 2009 7:09 am

how to block https for facebook.com

Mon Sep 06, 2010 12:00 pm

hi all, i want to block https://www.facebook.com,
how can i block that..?


thanks
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26381
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: how to block https for facebook.com

Mon Sep 06, 2010 12:01 pm

you must use transparent proxy, then you can block sites by host name

http://wiki.mikrotik.com/wiki/How_to_Bl ... sing_Proxy
 
b2k
just joined
Topic Author
Posts: 24
Joined: Tue Nov 24, 2009 7:09 am

Re: how to block https for facebook.com

Mon Sep 06, 2010 12:39 pm

you must use transparent proxy, then you can block sites by host name

http://wiki.mikrotik.com/wiki/How_to_Bl ... sing_Proxy

i am already using proxy on mikrotik, i can block http://www.facebook.com, but i can not block https://www.facebook.com.
i want to block https:

need help bro..?
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26381
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: how to block https for facebook.com

Mon Sep 06, 2010 12:40 pm

proxy doesn't work with HTTPS sites, you need to find out the IP addresses that Facebook uses and block them with the firewall.


This should be a start:

C:\Users\Normis>nslookup facebook.com

Non-authoritative answer:
Name:    facebook.com
Addresses:  69.63.189.16
          69.63.181.11
          69.63.181.12
          69.63.189.11

 
b2k
just joined
Topic Author
Posts: 24
Joined: Tue Nov 24, 2009 7:09 am

Re: how to block https for facebook.com

Mon Sep 06, 2010 12:47 pm

proxy doesn't work with HTTPS sites, you need to find out the IP addresses that Facebook uses and block them with the firewall.


This should be a start:

C:\Users\Normis>nslookup facebook.com

Non-authoritative answer:
Name:    facebook.com
Addresses:  69.63.189.16
          69.63.181.11
          69.63.181.12
          69.63.189.11

so, you mean i must block the facebook ip right..?
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: how to block https for facebook.com

Mon Sep 06, 2010 1:01 pm

Yes, those four ips. Block port 443 for https.
 
b2k
just joined
Topic Author
Posts: 24
Joined: Tue Nov 24, 2009 7:09 am

Re: how to block https for facebook.com

Tue Sep 07, 2010 6:02 am

Yes, those four ips. Block port 443 for https.
can you show me how to block using command line please..?

thanks
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: how to block https for facebook.com

Tue Sep 07, 2010 6:54 am

/ip firewall filter add chain=forward action=drop dst-address=a.b.c.d
Refer to the manual for details
 
b2k
just joined
Topic Author
Posts: 24
Joined: Tue Nov 24, 2009 7:09 am

Re: how to block https for facebook.com

Tue Sep 07, 2010 8:48 am

/ip firewall filter add chain=forward action=drop dst-address=a.b.c.d
Refer to the manual for details
thanks bro, i am already block my facebook
 
rgodoy
just joined
Posts: 14
Joined: Thu Sep 16, 2010 8:31 pm

Re: how to block https for facebook.com

Wed Sep 22, 2010 10:05 pm

So, it makes no sense to use the web proxy, but a firewall filter rule instead for any "facebook" browsing right? I didn't try it, but I guess that blocking those 4 IPs is enough...

One little question about transparent proxy. I have it running, but when I check web proxy status out, "cache used" is always 0 KiB. What could be going on?
 
netrat
Member
Member
Posts: 402
Joined: Thu Jun 07, 2007 1:16 pm
Location: Virginia

Re: how to block https for facebook.com

Wed Sep 22, 2010 11:24 pm

You need to setup a store for the webproxy to use.
 
rgodoy
just joined
Posts: 14
Joined: Thu Sep 16, 2010 8:31 pm

Re: how to block https for facebook.com

Thu Sep 23, 2010 3:47 pm

I have rOS v. 3.30. Web-proxy1 store is already activated.

I guess news sites should not be cached, but, an institutional site with almost static contents I guess it should!

Any other suggestions? This is my config:
                 enabled: yes
             src-address: 0.0.0.0
                    port: 3128
            parent-proxy: 0.0.0.0
       parent-proxy-port: 0
     cache-administrator: "webmaster"
          max-cache-size: none
           cache-on-disk: yes
  max-client-connections: 1000
  max-server-connections: 1000
          max-fresh-time: 3d
   serialize-connections: no
       always-from-cache: no
          cache-hit-dscp: 4
             cache-drive: primary-master
 
inibir
Member Candidate
Member Candidate
Posts: 116
Joined: Thu Nov 25, 2010 2:25 pm
Location: lebanon
Contact:

Re: how to block https for facebook.com

Fri May 04, 2012 10:44 pm

there any way to convert https to http on facebook
 
User avatar
c0d3rSh3ll
Long time Member
Long time Member
Posts: 557
Joined: Mon Jul 25, 2011 9:42 pm
Location: [admin@Chile] >

Re: how to block https for facebook.com

Sat May 05, 2012 10:44 pm

/ip firewall filter
add action=drop chain=forward comment="block facebook https" content=facebook disabled=no dst-port=443 protocol=tcp

block facebook https
 
User avatar
cbrown
Trainer
Trainer
Posts: 1839
Joined: Thu Oct 14, 2010 8:57 pm
Contact:

Re: how to block https for facebook.com

Sat May 05, 2012 10:59 pm

/ip firewall filter
add action=drop chain=forward comment="block facebook https" content=facebook disabled=no dst-port=443 protocol=tcp

block facebook https
And unfortunately every https website that might have the term facebook. This will provide many false positives.
 
deejaylight
just joined
Posts: 3
Joined: Mon Dec 19, 2011 12:38 pm

Re: how to block https for facebook.com

Tue Oct 09, 2012 10:05 am

/ip firewall filter
add action=drop chain=forward comment="block facebook https" content=facebook disabled=no dst-port=443 protocol=tcp

I don't know why but this solution is not working for me.

I know that https traffic is encrypted, should mikrotik decrypt this traffic and see the content facebook?
I also have tried to block facebook IP's but now this site have a lot of servers and IP's, it always find an other way to connect.

I was thinking about redirecting from DNS query, I mean if lan pc's requesting facebook to froward a local IP address to them, trough DNS response.
But I'm not sure how to do that.
I will appreciate your help.
Thanks!
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: how to block https for facebook.com

Tue Oct 09, 2012 3:56 pm

I know that https traffic is encrypted, should mikrotik decrypt this traffic and see the content facebook?
That's the whole point of encryption, nobody on the way can decrypt it. :) If it was possible, it would be useless.
I was thinking about redirecting from DNS query, I mean if lan pc's requesting facebook to froward a local IP address to them, trough DNS response.
If your users are using your dns server, you can add:
/ip dns static
add address=192.0.2.1 name=www.facebook.com
add address=2001:db8::1 name=www.facebook.com
If they don't, you can force them by redirecting their dns packets (port 53) to your server (currently possible only for IPv4, the IPv6 ones you can only drop, that's probably safe for now). Not exactly nice thing to do, but it works.

But be prepared, that just a little advanced users know about hosts file and will get around this kind of blocking quite easily.
 
kirshteins
MikroTik Support
MikroTik Support
Posts: 592
Joined: Tue Dec 02, 2008 10:55 am

Re: how to block https for facebook.com

Tue Oct 09, 2012 4:02 pm

Simply try blocking 443/TCP to
66.220.144.0-66.220.159.255
69.63.176.0-69.63.191.255
204.15.20.0-204.15.23.255
IP addresses
 
User avatar
saintofinternet
Forum Veteran
Forum Veteran
Posts: 768
Joined: Thu Oct 15, 2009 3:52 am

Re: how to block https for facebook.com

Tue Aug 27, 2013 8:54 am

is there still no solution for the "https" facebook block from the latest version of ROS ???
 
alex_rhys-hurn
Member
Member
Posts: 352
Joined: Mon Jun 05, 2006 8:26 pm
Location: Kenya
Contact:

Re: how to block https for facebook.com

Wed Aug 28, 2013 1:26 am

The way we do this is to use a layer 7 regular expression to block any url with facebook in it.

First make layer 7 protocol with this as the value:

^.*(facebook).*$

Then make a firewall rule to drop that layer 7 protocol.

This can be very harsh and even prevent you resolving and pinging facebook as well as browsing by http and https. So think carefully about your rule.

Effectively what this regex is doing is matching any fqdn and url with facebook in it.

We often then put this rule on a script which enables facebook outside of office ours and disables facebook during office hours.

I hope that helps.
 
alex_rhys-hurn
Member
Member
Posts: 352
Joined: Mon Jun 05, 2006 8:26 pm
Location: Kenya
Contact:

Re: how to block https for facebook.com

Wed Aug 28, 2013 1:29 am

Wow. Really old thread. Sorry i posted.....
 
User avatar
saintofinternet
Forum Veteran
Forum Veteran
Posts: 768
Joined: Thu Oct 15, 2009 3:52 am

Re: how to block https for facebook.com

Wed Aug 28, 2013 4:57 am

hey thanks for the reply... but i am really wondering how come routeros firewall does not have a simple "https" blocking feature for its firewall which almost every other firewall in the market is giving.

why is so tedious to block https facebook from routeros?
 
alex_rhys-hurn
Member
Member
Posts: 352
Joined: Mon Jun 05, 2006 8:26 pm
Location: Kenya
Contact:

Re: how to block https for facebook.com

Wed Aug 28, 2013 11:18 am

Hello,

I think you may be confusing the term "firewall" with "UTM" or Unified Threat Management.

Mikrotik is not a UTM platform. For that you need to look at Checkpoint UTM, Untangle or the like.

Personally I dont think that making a layer7 protocol and firewall rule difficult of tedious. Actually I can do it faster on a Mikrotik than on a Cisco ASA.

Alex
 
alex_rhys-hurn
Member
Member
Posts: 352
Joined: Mon Jun 05, 2006 8:26 pm
Location: Kenya
Contact:

Re: how to block https for facebook.com

Wed Aug 28, 2013 11:52 am

So, to show how easy it is really here is the setup in full:

First the Layer & Protocol:
/ip firewall layer7-protocol add name=Facebook_URL regexp="^.*(facebook).*\$"

Then the Firewall Rule:
/ip firewall filter add chain=forward comment="Block Facebook" layer7-protocol=facebook_url

That will block all and any layer7 traffic to any domain that has facebook in it before the TLD.

Change the firewall filter rule to suit exactly what you want to block.

As I said before, these days simply blocking HTTPS facebook is not enough. Many of my client want to allow facebook but block certain parts of it such as games and apps. For this you need UTM.

Alex
 
User avatar
saintofinternet
Forum Veteran
Forum Veteran
Posts: 768
Joined: Thu Oct 15, 2009 3:52 am

Re: how to block https for facebook.com

Thu Aug 29, 2013 5:24 am

with the power of RouterOS i am sure Mikrotik hardware can be made into a UTM....

but how and how?? is the question.

let's leave it for Normis to answer :-)

Long Live Mikrotik!!!
 
Bitto
Frequent Visitor
Frequent Visitor
Posts: 94
Joined: Wed May 02, 2012 10:15 am

Re: how to block https for facebook.com

Wed Nov 13, 2013 2:27 pm

So there is no answer from Normis yet?
 
User avatar
saintofinternet
Forum Veteran
Forum Veteran
Posts: 768
Joined: Thu Oct 15, 2009 3:52 am

Re: how to block https for facebook.com

Thu Nov 14, 2013 4:46 am

Normis will... he is the GOD of Mikrotik... and GOD take their time to reply to their devotees... keep faith in Normis and Mikrotik :-)
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26381
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: how to block https for facebook.com

Thu Nov 14, 2013 1:12 pm

I am not sure this is possible. HTTPS is encrypted for a reason.
 
shiny
just joined
Posts: 14
Joined: Tue Feb 19, 2013 3:19 pm

Re: how to block https for facebook.com

Thu Nov 14, 2013 1:59 pm

It is pretty easy actually :

DO NOT use transparent proxy. If you setup the proxy in your web browser, you can deny/allow any http or https traffic. This is not possible with transparent proxy.
Yes you will have to MAKE your customers use the proxy :)
 
rusly
just joined
Posts: 2
Joined: Sat Mar 01, 2014 9:12 am

Re: how to block https for facebook.com

Sat Mar 01, 2014 9:27 am

i hope this can help

add action=drop chain=forward comment=Youtube content=www.youtube.com disabled=\
no dst-port=80,443 protocol=tcp src-address=192.168.10.100-192.168.10.200

i succes with that setting to drop http and https youtube
if you want to block facebook, you just change content=www.facebook.com
src-address=(give with your target network address range)

if any mistake or question just replay this message


best regard
rusly12
if you want to discus just send message to ruslyali@yahoo.com
 
rusly
just joined
Posts: 2
Joined: Sat Mar 01, 2014 9:12 am

Re: how to block https for facebook.com

Sat Mar 01, 2014 9:31 am

i have try with ip address on firewall
i input many ip but filter didn't work yet

so i try to configure with that setting on my Mikrotik
 
zarvan
just joined
Posts: 2
Joined: Fri Jul 04, 2014 1:15 pm

Re: how to block https for facebook.com

Fri Jul 04, 2014 1:20 pm

 
jorgito
Trainer
Trainer
Posts: 8
Joined: Thu Apr 07, 2011 8:30 pm

Re: how to block https for facebook.com

Wed Aug 06, 2014 2:29 am

Hi Guys,
just wanted to make a little contribution about HTTPS blocking.
Nowdays, you have two ways of blocking traffic in HTTPS:

- Man in the middle attack and see HTTPS traffic as clear.

- Alternates ways of detecting or maybe guessing is a better term of what a user is doing.

I'd like to talk about the second one.

Why does the MK's L7 filter works on HTTPS if the traffic is encrypted? If all the traffic passes through the MK, maybe you are actually filtering the DNS query (you can do this or something similar like that last great link about adding to address lists all DNS queries that contains facebook).

But what about if the DNS traffic doesn't pass through my MK router? Well, if it works, it's because of a TLS extension used nowadays called SNI (http://es.wikipedia.org/wiki/Server_Name_Indication) is matching our L7 filter. This is THE WAY to block HTTPS by URL. It's great and doesn't makes false positives, because you cant block a google search that says "who is the owner of facebook.com", because that traffic is already encrypted, and you just block the domain name that the user connected to.
Some big name UTM manufacturers use this to block HTTPS.

But what about blocking FarmVille inside Facebook? You just need a couple of pcap captures to see it, you can guess what a user is doing by looking it's traffic, not the encrypted part, but all headers. All applications have behavior profiles that can be guessed with good confidence, and in the end of the day (not a day actually, this takes a LOT of time to do and mantain....:-) ) have a happy HTTPS firewall.......and have LOTS OF FUN TOO!!!!

Well, just wanted to make this little contribution. If anyone wants any of this topics explained further, just ask.

Best regards!

Jorge.
 
User avatar
CyberTod
Long time Member
Long time Member
Posts: 510
Joined: Wed Jan 25, 2012 10:23 am

Re: how to block https for facebook.com

Wed Aug 06, 2014 10:55 am

The initial GET/POST query from client to server is not encrypted even in https so this works like a charm :
/ip firewall filter add action=reject chain=forward comment="drop facebook" content=facebook.com dst-port=80,443 protocol=tcp reject-with=icmp-admin-prohibited
Working flawlessly in a client's corporate network.

Who is online

Users browsing this forum: Ahrefs [Bot], Semrush [Bot] and 158 guests