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

Web Filtering

I have been searching through the posts and this is what I THINK I have found out.

When trying to either block or allow a website in the filter actions, if I put a DOMAIN in the domain section and a regEX statement into the REgular Expressions sections I have just created a "AND" statement?

If I want to block all access to " The Useless Web " all I need to do is enter that into the DOMAIN section as is and NOT enter anything into the Regular Expression section?

Regular Expressions escape me.  I have been trying to locate a website that will let me enter a website into a field and have it convert it into a string of gibberish(regEX) that I can enter into the filter.  So far, the sites I have found will let me do everything else but that.

Does anyone have a site, or an app, that I can use to convert something like " www.zumiez.com/womens/tops/t-shirts.html" into a regEX expression that accounts for possible subdomains and HTTP/HTTPS?  Or would it be best to just put "www.zumiez.com" into the DOMAIN section AND leave the Regular Expression section free from any mention of this site?

And how much will this change when 9.2 is released?


This thread was automatically locked due to age.
  • You could try this one, helped me a lot when I first started playing with regex.

    Quick RegEx for URLs | UTM Tools

    Managing several Sophos UTMs and Sophos XGs both at work and at some home locations, dedicated to continuously improve IT-security and feeling well helping others with their IT-security challenges.

    Sometimes I post some useful tips on my blog, see blog.pijnappels.eu/category/sophos/ for Sophos related posts.

  • Robert,

    Look at the Exceptions you already have from Astaro/Sophos.  For Windows, you will find

    ^https?://([A-Za-z0-9.-]*\.)?microsoft\.com/


    [A-Za-z0-9.-]* is what you're looking for.  I'm not sure why some extend that to ([A-Za-z0-9.-]*\.)?, but the longer expression also works.  Just model your expressions after the one above for all microsoft.com subdomains.

    Cheers - Bob
     
    Sophos UTM Community Moderator
    Sophos Certified Architect - UTM
    Sophos Certified Engineer - XG
    Gold Solution Partner since 2005
    MediaSoft, Inc. USA
  • Robert,

    ...I'm not sure why some extend that to ([A-Za-z0-9.-]*\.)?, but the longer expression also works. 
    Cheers - Bob


    Hello Bob

    The questionmark "?" is to make the characters/string in front of your domain optional ("one" or "none" of them), "*" means mandatory at least one (or many) of the expressions must match.

    ^https?://([A-Za-z0-9.-]*\.)?example.com
    http://www.example.com ==> matches regex
    http://example.com ==> matches regex

    ^https?://[A-Za-z0-9.-]*example.com
    http://www.example.com ==> matches regex
    http://example.com ==> Does NOT match the regex

    /Sascha
  • Sascha, "*" means "0 or more" of the previous character(s).  "+" means "1 or more" of the previous character(s).

    Cheers - Bob
     
    Sophos UTM Community Moderator
    Sophos Certified Architect - UTM
    Sophos Certified Engineer - XG
    Gold Solution Partner since 2005
    MediaSoft, Inc. USA
  • Sascha, "*" means "0 or more" of the previous character(s).  "+" means "1 or more" of the previous character(s).

    Cheers - Bob


    Bob...you're right ! Seems I mis interpreted that one in the past.

    http://www.cheatography.com/davechild/cheat-sheets/regular-expressions/

    Thanks for correction.

    Sorry for short answers and typos. was written on mobile using astaro.org app.
  • All-

    I really have to say the websites noted by apijnappels, and Sasha are incredably helpful. On the quick regex site (noted above) there is a regex exe file that writes the regex for you. That said the exe provides insight to just how close and how far off I was with the ones I wrote. Thank you for this very cool tool!

    BR,
    Jim
  • apijnappels : Thanks, this is what I was looking for.  Will give it a try.


    To my second question:  Does the domain / regular expressions act like an AND operator if both have the same domain in them?

    It would explain why I am having so much trouble blocking some sites.
  • Actually I don't have the answer to your second question. We only use the regex since they're more powerful.

    Managing several Sophos UTMs and Sophos XGs both at work and at some home locations, dedicated to continuously improve IT-security and feeling well helping others with their IT-security challenges.

    Sometimes I post some useful tips on my blog, see blog.pijnappels.eu/category/sophos/ for Sophos related posts.

  • Yes it is an AND.
    If you want an OR then you have to create multiple entries.

    Basically:
    If you want to use RegEx then create a new entry and fill in a RegEx.
    If you want to use a domain name then create a new entry and fill in the domain.
    In the rare case you want to do both (for example block a path on a domain) then create a new entry and put in the domain then the regex that will be applied only if the domain matches.

    The domain method is better performance and simpler.  The regex is more powerful.

    Please note that in 9.1 the domain blocking is the exact and entire domain only.  Therefore blocking cheatography.com does NOT block Cheat Sheet Generator and Cheat Sheet Repository - Cheatography.com.

    In 9.200 the UI changed a little bit to make the relationship more clear and to optionally allow subdomains to match, however the underlying functionality is the same.
  • Michael - thanks for the clairification.  For me it would seem the best thing would be to just leave the domain section empty and stict to Regex.

    The program " Quick Regex for URLs " is pretty slick.