PfSense 2.2.2 - Unbound DNS Error?



  • I'm getting this error message when try to access the System Logs > Resolver

    Parse error: syntax error, unexpected '=' in /usr/local/www/diag_logs_resolver.php on line 108 
    

    Anyone know how to fix this?


  • Banned

    Reinstall?



  • In pfSense 2.2.2, line 108 of /usr/local/www/diag_logs_resolver.php does not even have an equals sign.
    Diagnostics->Edit file
    What is contained in /usr/local/www/diag_logs_resolver.php?

    It should have 144 lines of code.



  • @phil.davis:

    In pfSense 2.2.2, line 108 of /usr/local/www/diag_logs_resolver.php does not even have an equals sign.
    Diagnostics->Edit file
    What is contained in /usr/local/www/diag_logs_resolver.php?

    It should have 144 lines of code.

    Here is what in it.

    /* $Id$ */
    /*
    	firewall_aliases_import.php
    	Copyright (C) 2005 Scott Ullrich
    	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
    	All rights reserved.
    
    	Redistribution and use in source and binary forms, with or without
    	modification, are permitted provided that the following conditions are met:
    
    	1\. Redistributions of source code must retain the above copyright notice,
    	   this list of conditions and the following disclaimer.
    
    	2\. Redistributions in binary form must reproduce the above copyright
    	   notice, this list of conditions and the following disclaimer in the
    	   documentation and/or other materials provided with the distribution.
    
    	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
    	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
    	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
    	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
    	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    	POSSIBILITY OF SUCH DAMAGE.
    */
    /*
    	pfSense_MODULE:	filter
    */
    
    ##|+PRIV
    ##|*IDENT=page-firewall-alias-import
    ##|*NAME=Firewall: Alias: Import page
    ##|*DESCR=Allow access to the 'Firewall: Alias: Import' page.
    ##|*MATCH=firewall_aliases_import.php*
    ##|-PRIV
    
    // Keywords not allowed in names
    $reserved_keywords = array("all", "pass", "block", "out", "queue", "max", "min", "pptp", "pppoe", "L2TP", "OpenVPN", "IPsec");
    
    require("guiconfig.inc");
    require_once("util.inc");
    require_once("filter.inc");
    require("shaper.inc");
    
    $pgtitle = array(gettext("Firewall"),gettext("Aliases"),gettext("Bulk import"));
    
    $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_aliases.php');
    
    // Add all Load balance names to reserved_keywords
    if (is_array($config['load_balancer']['lbpool']))
    	foreach ($config['load_balancer']['lbpool'] as $lbpool)
    		$reserved_keywords[] = $lbpool['name'];
    
    $reserved_ifs = get_configured_interface_list(false, true);
    $reserved_keywords = array_merge($reserved_keywords, $reserved_ifs, $reserved_table_names);
    
    if (!is_array($config['aliases']['alias']))
    	$config['aliases']['alias'] = array();
    $a_aliases = &$config['aliases']['alias'];
    
    if($_POST['aliasimport'] <> "") {
    	$reqdfields = explode(" ", "name aliasimport");
    	$reqdfieldsn = array(gettext("Name"),gettext("Aliases"));
    
    	do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
    
    	if (is_validaliasname($_POST['name']) == false)
    		$input_errors[] = gettext("The alias name may only consist of the characters") . " a-z, A-Z, 0-9, _.";
    
    	/* check for name duplicates */
    	if (is_alias($_POST['name']))
    		$input_errors[] = gettext("An alias with this name already exists.");
    
    	/* Check for reserved keyword names */
    	foreach($reserved_keywords as $rk)
    		if ($rk == $_POST['name'])
    			$input_errors[] = sprintf(gettext("Cannot use a reserved keyword as alias name %s"), $rk);
    
    	/* check for name interface description conflicts */
    	foreach($config['interfaces'] as $interface) {
    		if($interface['descr'] == $_POST['name']) {
    			$input_errors[] = gettext("An interface description with this name already exists.");
    			break;
    		}
    	}
    
    	if ($_POST['aliasimport']) {
    		$tocheck = explode("\n", $_POST['aliasimport']);
    		$imported_ips = array();
    		$imported_descs = array();
    		$desc_len_err_found = false;
    		$desc_fmt_err_found = false;
    		foreach ($tocheck as $impline) {
    			$implinea = explode(" ",trim($impline),2);
    			$impip = $implinea[0];
    			$impdesc = trim($implinea[1]);
    			if (strlen($impdesc) < 200) {
    				if ((strpos($impdesc, "||") === false) && (substr($impdesc, 0, 1) != "|") && (substr($impdesc, -1, 1) != "|")) {
    					$iprange_type = is_iprange($impip);
    					if ($iprange_type == 4) {
    						list($startip, $endip) = explode('-', $impip);
    				ry="main area">
    
    									if($filtertext)
    						dump_clog($system_logfile, $nentries, true, array("$filtertext"), array("ppp"));
    					else
    						dump_clog($system_logfile, $nentries, true, array(), array("ppp"));
    				?>
    
    <form id="filterform" name="filterform" action="diag_logs_resolver.php" method="post" style="margin-top: 14px;">
                  				" />
    						</form>
    
    <form id="clearform" name="clearform" action="diag_logs_resolver.php" method="post" style="margin-top: 14px;">
    
                  				" />
    						</form>
    
    


  • @doktornotor:

    Reinstall?

    reinstall pfSense? Unbound comes as default package with pfSense 2.2.2.


  • Banned

    Yes. Clearly what you have there is broken.



  • That code says it is firewall_aliases_import.php up in the header comments!
    And then at line 108 it suddenly switches to

    ry="main area">
    

    which is the end of line 121 in https://github.com/pfsense/pfsense/blob/master/usr/local/www/diag_logs_resolver.php
    from there it seems to have code for diag_logs_resolver.php

    Do you have any idea what might have happened?

    Has someone been using Diagnostics->Edit file and doing accidental cut-paste-save? Or a command line editor?
    Or have there been random power failures and some file system corruption?

    If you don't know how/why this code-mixing corruption came about, then I would also recommend to backup your config, reinstall pfSense and restore your config. That will make sure you have clean copies of all the code.



  • @doktornotor:

    Yes. Clearly what you have there is broken.

    @phil.davis:

    That code says it is firewall_aliases_import.php up in the header comments!
    And then at line 108 it suddenly switches to

    ry="main area">
    

    which is the end of line 121 in https://github.com/pfsense/pfsense/blob/master/usr/local/www/diag_logs_resolver.php
    from there it seems to have code for diag_logs_resolver.php

    Do you have any idea what might have happened?

    Has someone been using Diagnostics->Edit file and doing accidental cut-paste-save? Or a command line editor?
    Or have there been random power failures and some file system corruption?

    If you don't know how/why this code-mixing corruption came about, then I would also recommend to backup your config, reinstall pfSense and restore your config. That will make sure you have clean copies of all the code.

    Should I just replace that file with what you have there? or Should I upgrade to pfSense 2.2.3 after the backup config? Will upgrading to 2.2.3 give me clean copies of all the code?


  • Banned

    As said above, either reinstall or upgrade to get known good working code.



  • @doktornotor:

    As said above, either reinstall or upgrade to get known good working code.

    thanks for advice, I couldn't decide yet. Not sure if the 2.2.3 is safe to upgrade yet or not. Currently, running these packages

    Don't want break something and don't know how to fix afterward.



  • Should I just replace that file with what you have there? or Should I upgrade to pfSense 2.2.3 after the backup config? Will upgrading to 2.2.3 give me clean copies of all the code?

    Yes, you could paste in the proper code from https://raw.githubusercontent.com/pfsense/pfsense/RELENG_2_2/usr/local/www/diag_logs_resolver.php and fix this file. That would fix the current problem you see. But if you do not know how the wrong code got there in the first place then who knows what other code or files are also not right.

    Upgrading to pfSense 2.2.3 will give you clean copies of the code.

    Maybe fix up the code in diag_logs_resolver.php for now, then upgrade to 2.2.3 in a couple of days (doing a full backup along the way…)

    You could also backup the config, reinstall 2.2.2, reload the config, let all the packages reinstall. That will bring you back to known good 2.2.2



  • @phil.davis:

    Should I just replace that file with what you have there? or Should I upgrade to pfSense 2.2.3 after the backup config? Will upgrading to 2.2.3 give me clean copies of all the code?

    Yes, you could paste in the proper code from https://raw.githubusercontent.com/pfsense/pfsense/RELENG_2_2/usr/local/www/diag_logs_resolver.php and fix this file. That would fix the current problem you see. But if you do not know how the wrong code got there in the first place then who knows what other code or files are also not right.

    Upgrading to pfSense 2.2.3 will give you clean copies of the code.

    Maybe fix up the code in diag_logs_resolver.php for now, then upgrade to 2.2.3 in a couple of days (doing a full backup along the way…)

    You could also backup the config, reinstall 2.2.2, reload the config, let all the packages reinstall. That will bring you back to known good 2.2.2

    Just paste your code. It fixed that problem, big thanks to you. I will wait for couple days before upgrade to 2.2.3.

    Thanks again.  ;D


Log in to reply