aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Marquette <billm@pfsense.org>2006-04-24 03:52:14 +0000
committerBill Marquette <billm@pfsense.org>2006-04-24 03:52:14 +0000
commit9219b0f3d7be1dde134c3496b57feaca2da493ee (patch)
tree1f7c4741f3302878b468865bfa36017c159c0ba6
parent5cf4db2fa809bf337253fe53e0ccc5f2f73b4136 (diff)
downloadpfsense-packages-9219b0f3d7be1dde134c3496b57feaca2da493ee.tar.gz
pfsense-packages-9219b0f3d7be1dde134c3496b57feaca2da493ee.tar.bz2
pfsense-packages-9219b0f3d7be1dde134c3496b57feaca2da493ee.zip
Re-enable cachemgr.cgi thanks in part to patch from msablanet
-rw-r--r--packages/squid_ng.inc15
-rw-r--r--packages/squid_ng.xml9
2 files changed, 19 insertions, 5 deletions
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 @@
<section>Services</section>
<url>/pkg_edit.php?xml=squid_ng.xml&amp;id=0</url>
</menu>
- <!--
<menu>
<name>Squid stats</name>
<tooltiptext>Show Squid statistics</tooltiptext>
<section>Services</section>
<url>/cachemgr.cgi</url>
</menu>
- -->
<service>
<name>squid</name>
<rcfile>squid.sh</rcfile>
@@ -192,6 +190,13 @@
<option><name>Turkish</name><value>Turkish</value></option>
</options>
</field>
+ <field>
+ <fielddescr>Enable cachemgr</fielddescr>
+ <fieldname>cachemgr_enabled</fieldname>
+ <description>Enable Squid's cachemgr.cgi to provide stats. Once enabled you can access this from the pfSense menus. <b>Note:</b> 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.</description>
+ <type>checkbox</type>
+ </field>
+
</fields>
<custom_add_php_command_late>
global_write_squid_config();