From 9219b0f3d7be1dde134c3496b57feaca2da493ee Mon Sep 17 00:00:00 2001 From: Bill Marquette Date: Mon, 24 Apr 2006 03:52:14 +0000 Subject: Re-enable cachemgr.cgi thanks in part to patch from msablanet --- packages/squid_ng.inc | 15 ++++++++++++--- packages/squid_ng.xml | 9 +++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) (limited to 'packages') diff --git a/packages/squid_ng.inc b/packages/squid_ng.inc index 469cf8f3..0b4aa855 100644 --- a/packages/squid_ng.inc +++ b/packages/squid_ng.inc @@ -51,6 +51,7 @@ function global_write_squid_config() $visible_hostname = $config['installedpackages']['squid']['config'][0]['visible_hostname']; $cache_admin_email = $config['installedpackages']['squid']['config'][0]['cache_admin_email']; $error_language = $config['installedpackages']['squid']['config'][0]['error_language']; + $cachemgr_enabled = $config['installedpackages']['squid']['config'][0]['cachemgr_enabled']; /* squid_upstream.xml values */ $proxy_forwarding = $config['installedpackages']['squidupstream']['config'][0]['proxy_forwarding']; @@ -125,6 +126,14 @@ function global_write_squid_config() $config_array = array('shutdown_lifetime 5 seconds' . "\n\n"); + if (isset($cachemgr_enabled) && ($cachemgr_enabled == "on")) { + mwexec("cp /usr/local/libexec/squid/cachemgr.cgi /usr/local/www/cachemgr.cgi"); + mwexec("chmod a+rx /usr/local/www/cachemgr.cgi"); + } else { + mwexec("rm -f /usr/local/www/cachemgr.cgi"); + } + unset($cachemgr_enabled); + if (!isset($icp_port) or ($icp_port == "")) { $icp_port = "3130"; } @@ -143,6 +152,7 @@ function global_write_squid_config() $config_array[] = 'acl QUERY urlpath_regex cgi-bin \?' . "\n"; $config_array[] = 'no_cache deny QUERY' . "\n\n"; } + $config_array[] = 'http_port 127.0.0.1:' . $proxy_port . "\n\n"; unset($proxy_port); if (isset($domain) && ($domain !== "")) { @@ -803,8 +813,6 @@ function custom_php_install_command() { mwexec("chown squid:squid /usr/local/etc/squid/advanced/acls/src_unrestricted_ip.acl"); mwexec("cp /usr/local/etc/squid/mime.conf.default /usr/local/etc/squid/mime.conf"); - mwexec("cp mv /usr/lib/squid/cachemgr.cgi /usr/local/www/cachemgr.cgi"); - mwexec("chmod a+rx /usr/local/www/cachemgr.cgi"); /* set a few extra items noted by regan */ update_output_window("Creating logs and setting user information..."); @@ -904,6 +912,7 @@ function custom_php_deinstall_command() { unlink_if_exists("/usr/local/libexec/squid"); unlink_if_exists("/usr/local/etc/rc.d/aSquid.sh"); mwexec("rm -f /usr/local/etc/rc.d/squid*"); + mwexec("rm -f /usr/local/www/cachemgr.cgi"); filter_configure(); } @@ -1053,4 +1062,4 @@ function generate_htpasswd($username, $password) { return $crypt; } -?> \ No newline at end of file +?> diff --git a/packages/squid_ng.xml b/packages/squid_ng.xml index c3d4907f..6803f527 100644 --- a/packages/squid_ng.xml +++ b/packages/squid_ng.xml @@ -13,14 +13,12 @@
Services
/pkg_edit.php?xml=squid_ng.xml&id=0 - squid squid.sh @@ -192,6 +190,13 @@ + + Enable cachemgr + cachemgr_enabled + Enable Squid's cachemgr.cgi to provide stats. Once enabled you can access this from the pfSense menus. Note: This page is not secured by pfSense, any user with access to the pfSense admin port can view the stats. The page prompts for a password but it only required for shutting down Squid. + checkbox + + global_write_squid_config(); -- cgit v1.2.3