Project

General

Profile

Bug #11711 ยป 83.diff

Viktor Gurov, 06/07/2021 12:20 AM

View differences:

www/pfSense-pkg-squidGuard/Makefile
2 2

  
3 3
PORTNAME=	pfSense-pkg-squidGuard
4 4
PORTVERSION=	1.16.18
5
PORTREVISION=	18
5
PORTREVISION=	19
6 6
CATEGORIES=	www
7 7
MASTER_SITES=	# empty
8 8
DISTFILES=	# empty
www/pfSense-pkg-squidGuard/files/usr/local/pkg/squidguard.inc
901 901
function sg_check_reserved_name($name, $log='')
902 902
{
903 903
    $res = true;
904
    $reserved = array("acl", "all", "allow", "dbhome", "default", "dest", "in-addr", "log", "logdir", "none", "pass", "rew", "src", "url", "user");
904
    $reserved = array("acl", "all", "allow", "dbhome", "default", "dest", "in-addr", "log", "logdir", "none", "pass", "rew", "src", "squidstatus", "url", "user");
905 905

  
906 906
    if (in_array(strtolower(trim($name)), $reserved)) {
907 907
        $res = false;
www/pfSense-pkg-squidGuard/files/usr/local/pkg/squidguard_configurator.inc
518 518
# sg_reconfigure_user_db - reconfigure(update) db user entries
519 519
# ------------------------------------------------------------------------------
520 520
function sg_reconfigure_user_db() {
521
	global $squidguard_config;
521
	global $squidguard_config, $config;
522 522
	$dbhome = $squidguard_config[F_DBHOME];
523 523

  
524 524
	sg_addlog("sg_reconfigure_user_db", "Begin with '$dbhome'", SQUIDGUARD_INFO);
......
533 533
		sg_addlog("sg_reconfigure_user_db", "Create user DB directory '$dbhome'.", SQUIDGUARD_INFO);
534 534
	}
535 535

  
536
	/* bypass local IPs for squid_status.php, see https://redmine.pfsense.org/issues/11711 */
537
	if ($squidguard_config[F_DEFAULT][F_NOTALLOWINGIP]) {
538
		init_config_arr(array('installedpackages', 'squidcache','config'));
539
		$proxy_ifaces = explode(",", $config['installedpackages']['squid']['config'][0]['active_interface']);
540
		$sgips = '';
541
		foreach ($proxy_ifaces as $iface) {
542
			if (get_interface_ip($iface)) {
543
				$sgips .= get_interface_ip($iface) . ' ';
544
			} else {
545
				$sgips .= get_interface_ipv6($iface) . ' ';
546
			}
547
		}
548
		if (!empty($sgips)) {
549
			$squidguard_config[F_DESTINATIONS][F_ITEM][] = array(F_NAME => 'squidstatus',
550
			    F_DOMAINS => $sgips, F_RMOD => RMOD_NONE);
551
		}
552
	}
553

  
536 554
	# update destinations to db
537 555
	$dests = $squidguard_config[F_DESTINATIONS];
538 556
	if (!empty($dests)) {
......
1106 1124

  
1107 1125
				# not allowing IP in URL
1108 1126
				if ($acl[F_NOTALLOWINGIP]) {
1109
					$acl[F_DESTINATIONNAME]     = "!in-addr {$acl[F_DESTINATIONNAME]}";
1110
					$acl[F_OVERDESTINATIONNAME] = "!in-addr {$acl[F_OVERDESTINATIONNAME]}";
1127
					$acl[F_DESTINATIONNAME]     = "^squidstatus !in-addr {$acl[F_DESTINATIONNAME]}";
1128
					$acl[F_OVERDESTINATIONNAME] = "^squidstatus !in-addr {$acl[F_OVERDESTINATIONNAME]}";
1111 1129
				}
1112 1130

  
1113 1131
				# re-order acl pass (<white><!in-addr><deny><allow><all|none>)
......
1164 1182

  
1165 1183
		# not allowing IP in URL
1166 1184
		if ($def[F_NOTALLOWINGIP]) {
1167
			$def[F_DESTINATIONNAME] = "!in-addr " . $def[F_DESTINATIONNAME];
1185
			$def[F_DESTINATIONNAME] = "^squidstatus !in-addr " . $def[F_DESTINATIONNAME];
1168 1186
		}
1169 1187

  
1170 1188
		# re-order acl pass (<allow><deny<all|none>)
    (1-1/1)