Wednesday, July 7, 2021

Block Twitter Using Layer7 Protocol Mikrotik

Twitter access is restricted in almost every corporate network. Usually, if we apply the restriction using the firewall of the MikroTik router, then the users will be blocked from the web access of Twitter, but they will get access with Twitter apps.

To block Twitter apps we need to take the help of MikroTik's "layer-7 protocol" feature. There some kind of "RegExp Code" is written. Later,  restrictions are applied using those codes. One screenshot is given below.


The regexp code for blocking the "Twitter" app is given below: -


^.+(.twitter.|ads-twitter.com|twimg.com|twitter.com|twttr.com|twimg.com.akahost.net|twitter.map.fastly.net).*$


How to block "Twitter" apps using layer-7 protocol is discussed step by step below.

First, we will go to the layer-7 protocol from the firewall. Here, we will add a new protocol rule.


We will assign a name for this rule entry and then we will write the regexp code. To write this code, just copy and paste it from the upper location. We named it "Block_Twitter". Then click on the "apply" and "OK" buttons to save as well as close this window.


Now we will navigate to the "Filter Rules" tab. Here, we will create a new filter rule. After click on the (+) sign, navigate to the "Advanced" tab.


Here, in the "Layer7 Protocol" field, we will select the layer 7 protocol rule that we created earlier. That is "Block_Twitter".


Now go to the "Action" tab. In the "Action" field, select the "Drop" value from the drop-down list.


Finally, we will click on the "Apply" and "OK" buttons to save as well as close this window. From now on Twitter web access will be blocked as well as access through apps will be blocked.

If you have multiple firewall rules or access rules configured then please make sure you have placed this rule in the right sequence. If you are not sure about that, then place this rule at the top of all of your firewall rules. Just drag it on the up way and drop it at the first position and make sure the rule sequence number is "0". Just like below.


Thank you.



No comments:

Post a Comment