Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Squidguard Regular Expression

    Scheduled Pinned Locked Moved Cache/Proxy
    5 Posts 3 Posters 2.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      TTGest
      last edited by TTGest

      Hi,
      I've realized that from pfSense 2.5 to 2.6 if using Regular Expression in SquidGuard, only main part of URL is parsed.

      EG: if Regular expression contains

      .*\.(com)
      

      all pages like ebay.COM, google.COM and so are blocked.

      If Regular Expression is

      winzip
      

      www.winzip.com is blocked but www.test.com/winzip it's bypassed.

      My main goal it's to block downloads by extension, but only it could be solved when all the URL will be parsed.

      JonathanLeeJ 1 Reply Last reply Reply Quote 0
      • M
        Michele Trotta
        last edited by

        Hello,

        try with
        (. * \ /.* . (EXE | COM | BAT))

        Block all downloads with FIle .EXE .COM and .BAT

        Michele

        1 Reply Last reply Reply Quote 0
        • T
          TTGest
          last edited by

          Thanks Michele, but it doesn't work. As I stated in first post, it seems to be a bug as only www.domain.com part is parsed, but not the rest of the URL.

          EG. if URL is www.domain.com/downloads/app.exe , your Regex will not match, as "exe" is not a pattern in www.domain.com which is the only string which seems to be evaluated.

          Maybe a Netgate programmer could take a look over this issue? Where to publish a bug?

          Regards!

          1 Reply Last reply Reply Quote 0
          • M
            Michele Trotta
            last edited by

            Hi ttgest,
            this export ONLY blocks downloads.

            If you need to block downloads then

            • create a new target categories called Block_EXE
            • in regula expression copy this (. * \ /.*. (EXE | COM | BAT))
            • Save
            • in your Groups ACL (for example G_TEST) deny the Block_EXE
            • save
              After saving, go to General Settings and Apply!

            Michele

            1 Reply Last reply Reply Quote 0
            • JonathanLeeJ
              JonathanLee @TTGest
              last edited by JonathanLee

              @ttgest you can also try a regular expression tester online. I found a good one. I was having issues with t.co I wanted it blocked however it would block microsoft.com I had to adjust and test with the regular expression tester. Some basic examples below.

              Screenshot_20220524-072731.png !

              Screenshot_20220524-072641.png!

              Make sure to upvote

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.