Navigation

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

    Custom SquidGuard Error Pages Redux

    pfSense Packages
    2
    5
    1378
    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.
    • KOM
      KOM last edited by

      I've been trying to create a customized SquidGuard error page.  I've followed the simple steps here:

      https://forum.pfsense.org/index.php?topic=9519.0
      https://forum.pfsense.org/index.php?topic=26057.0
      https://forum.pfsense.org/index.php?topic=77142.0

      I've modified the standard sgerror.php to add an include for my custom error page (KOMerr.php renamed from the personalSgerror.php file linked in one of the forum posts I listed above):

      include "globals.inc";
      include "config.inc";
      include "/usr/local/www/KOMerr.php";
      $page_info = << <eod< pre="">I've commented out the get_error_page function in sgerror.php:
      
      

      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      IE displayed self-page, if them size > 1024

      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      function Xget_error_page($er_code_id, $err_msg='') {
              global $err_code;

      
      I've set SquidGuard to block with an Ext URL Error Page to:
      
      http://pfsense.mydomain.local/sgerror.php?url=http://pfsense.mydomain.local/KOMerr.php&a=%a&n=%n&i=%i&s=%s&t=%t&u=%u
      
      When a site is blocked, all i get is a blank page, as if the get_error_page function isn't being called.  I'm not a PHP guy nor do I have a clue as to where the PHP logs are, if they exist.
      
      Does anyone have a clue as to how I debug this?</eod<> 
      
      1 Reply Last reply Reply Quote 0
      • marcelloc
        marcelloc last edited by

        @KOM:

        I've set SquidGuard to block with an Ext URL Error Page to:

        http://pfsense.mydomain.local/sgerror.php?url=http://pfsense.mydomain.local/KOMerr.php&a=%a&n=%n&i=%i&s=%s&t=%t&u=%u

        It looks like this redirect says that http://pfsense.mydomain.local/KOMerr.php is the denied page.

        The complete error page is still sgerror.php or all info is inside KOMerr.php?

        1 Reply Last reply Reply Quote 0
        • KOM
          KOM last edited by

          The complete error page is still sgerror.php or all info is inside KOMerr.php?

          Thanks.  The sgerror.php is the main error page that includes the function from KOMerr.php.  I've been doing it as per this forum post where they used the URL:

          https://firewall-ip:port#/sgerror.php?url=https://firewall-ip:port#/firewallblock.php&a=%a&n=%n&i=%i&s=%s&t=%t&u=%u

          In my case I substituted http for https and KOMerr.php for firewallblock.php.  I tried using just http://pfsense.mydomain.local/sgerror.php&a=%a&n=%n&i=%i&s=%s&t=%t&u=%u and that didn't work either.

          I fully admit that I have no idea what I'm doing here, so my problem is likely something silly.

          1 Reply Last reply Reply Quote 0
          • marcelloc
            marcelloc last edited by

            If you edit the local sgerror.php, you may not need to call it external or change error url.

            when you call sgerror.php directly can you see your modifications?

            1 Reply Last reply Reply Quote 0
            • KOM
              KOM last edited by

              I haven't tried that.  The problem with editing the local file is that any changes will be blown away during an upgrade.  The posts I linked to suggested just including the function in an external file so that you only had to add the include statement to the updated sgerror.php.  I know I should move the KOMerr.php out of /usr/local/www but I wanted to get it working at a basic level first.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post

              Products

              • Platform Overview
              • TNSR
              • pfSense
              • Appliances

              Services

              • Training
              • Professional Services

              Support

              • Subscription Plans
              • Contact Support
              • Product Lifecycle
              • Documentation

              News

              • Media Coverage
              • Press
              • Events

              Resources

              • Blog
              • FAQ
              • Find a Partner
              • Resource Library
              • Security Information

              Company

              • About Us
              • Careers
              • Partners
              • Contact Us
              • Legal
              Our Mission

              We provide leading-edge network security at a fair price - regardless of organizational size or network sophistication. We believe that an open-source security model offers disruptive pricing along with the agility required to quickly address emerging threats.

              Subscribe to our Newsletter

              Product information, software announcements, and special offers. See our newsletter archive to sign up for future newsletters and to read past announcements.

              © 2021 Rubicon Communications, LLC | Privacy Policy