Guest User!

You are not Sophos Staff.

This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Blocking whole Top Level Domains via Web Protection

Hi@all,

one of our customers wishes to implement his new UTM-Proxy as follows:

Step 1: Block all requests going to Top Level Domains other than .com, .de and .pl
Step 2: Filter all requests to the allowed TLDs via UTM filtering categories

Unfortunately I have no idea how to do step one.
My first thought was a blacklist on the filter action saying "everything but .com, .de and .pl" - but I don't get it to work.

Any suggestions?


This thread was automatically locked due to age.
  • Hi, and welcome to the User BB!

    I've not tried anything like this before, but maybe there's a REGEX guru lurking that can help.  Probably, the best that you can do is to block the most-common TLDs.

    This is a unique request though.  For example, this forum would be blocked.  I think I would challenge the customer's solution by asking him what the real, underlying issue is that he's trying to address.  There might be a simple, elegant solution with the UTM that he's unaware of.  I'm just guessing, but categorization might exceed his expectations.

    Cheers - Bob
  • Hi Bob,

    thanks for your reply!
    I will talk to the customer again - maybe I can find another way to fulfill his needs.

    Nevertheless I would greatly appreciate help from anybody who is familiar with regex [:)]
  • Perhaps he would be interested in the GEOIP Country blocking, rather than domain name.
    Go to Network Protection, Country Blocking.  This looks at the IP to determine where it is and block all network traffic (including website visits).  However a .ru site that is hosted in Germany would appear to be German.

    If you want to do it by domain tld then it might be easiest to do a blacklist of all tlds that you don't want.  You'll then have to periodically maintain it as new tlds are added.

    ^https?://([A-Za-z0-9.-]*\.)?\.[uk|gov|edu|ru|***|info]/
  • Not extensively tested:

    ^https?://[A-Za-z0-9.-]*\.(?!com/)(?!de/)(?!pl/).{2,3}/


    Regex comments and suggestions welcome.

    Edited:
    I pulled the previously posted regex via the command line where there was an extra escape character instead of from the web interface.  The regex now has the correct number of escapes for entry via WebAdmin.
  • Perhaps he would be interested in the GEOIP Country blocking, rather than domain name.
    Go to Network Protection, Country Blocking.  This looks at the IP to determine where it is and block all network traffic (including website visits).  However a .ru site that is hosted in Germany would appear to be German.

    If you want to do it by domain tld then it might be easiest to do a blacklist of all tlds that you don't want.  You'll then have to periodically maintain it as new tlds are added.

    ^https?://([A-Za-z0-9.-]*\.)?\.[uk|gov|edu|ru|***|info]/


    Unfortunately Country Blocking is no option because the country-tld-combination is not always nonambiguous (as you said)  [[:(]]
    I will try your regex suggestion later today - thank you so far...


    Not extensively tested:

    ^https?://[A-Za-z0-9.-]*\.(?!com/)(?!de/)(?!pl/).{2,3}/


    Regex comments and suggestions welcome.


    Unfortunately this doesn't work - maybe I can find out why .. but right now I have no clue [[:(]]
    Thanks so far!

  • Unfortunately this doesn't work


    I have edited my previous post it had an extra escape character in the regex.
  • Thank you very much .. it seems to work!
    I will test it elaborately as soon as i can and leave a reply here.

    Thanks again [:)]