Custom SquidGuard Error Pages Redux



  • 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<> 
    


  • @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?



  • 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.



  • 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?



  • 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.