From 006061c74ab2cae1b034ff3f213b41deb19b769e Mon Sep 17 00:00:00 2001 From: Colin Smith Date: Sat, 19 Mar 2005 22:41:41 +0000 Subject: Rewrite squid package. --- packages/squid.xml | 122 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 79 insertions(+), 43 deletions(-) (limited to 'packages') diff --git a/packages/squid.xml b/packages/squid.xml index 03ea45a6..e63df9e4 100644 --- a/packages/squid.xml +++ b/packages/squid.xml @@ -1,56 +1,92 @@ - squid - - - ['installedpackages']['squid']['config'] + squidsettings + 2.5.7_5 + Squid: Settings + + Squid + Change Squid settings. +
Services
+ squid.xml + /pkg_edit.php?xml=squid.xml&id=0 +
+ installedpackages->package->$packagename->configuration->settings + + + Cache size + cache_size + + + + + Cache size + cache_size + Enter cache size limit in MB. + input + + + + function sync_package_squid() { + conf_mount_rw(); + config_lock(); + global $config; + if ($_POST[0] == "") $_POST = $config['installedpackages']['package']['squidsettings']['config']; + write_squid_static_config(); + $fout = fopen("/usr/local/etc/squid/squid.conf", "a"); + if ($_POST['cache_size'] != "") fwrite($fout, "cache_mem " . $_POST['cache_size'] . " MB\n"); + fclose($fout); + mwexec("/usr/bin/killall -HUP squid"); + conf_mount_ro(); + config_unlock(); + } + sync_package_squid(); + - echo "<pre>"; - $lancfg = $config['interfaces']['lan']; - $lanif = $lancfg['if']; - $lanip = $lancfg['ipaddr']; - $lansa = gen_subnet($lancfg['ipaddr'], $lancfg['subnet']); - $lansn = $lancfg['subnet']; - $netmask = ""; - $fout = fopen("/usr/local/etc/squid/squid.conf","w"); - fwrite($fout, "#\n"); - fwrite($fout, "# This file was automatically generated by the pfSense package manager\n"); - fwrite($fout, "#\n"); - fwrite($fout, "http_port 3128\n"); - fwrite($fout, "icp_port 0\n"); - fwrite($fout, "acl localnet src " . $lansa . "/" . $lansn . "\n"); - fwrite($fout, "acl all src " . $lansa . "/" . $lansn . "\n"); - fwrite($fout, "acl localhost src 127.0.0.1/255.255.255.255\n"); - fwrite($fout, "acl Safe_ports port 80 443 210 119 70 21 1025-65535\n"); - fwrite($fout, "acl CONNECT method CONNECT\n"); - fwrite($fout, "http_access allow localnet\n"); - fwrite($fout, "http_access allow localhost\n"); - fwrite($fout, "http_access deny !Safe_ports\n"); - fwrite($fout, "http_access deny CONNECT\n"); - fwrite($fout, "http_access deny all\n"); - fwrite($fout, "visible_hostname pfSense\n"); - fwrite($fout, "httpd_accel_host virtual\n"); - fwrite($fout, "httpd_accel_port 80\n"); - fwrite($fout, "httpd_accel_with_proxy on\n"); - fwrite($fout, "httpd_accel_uses_host_header on\n"); - fwrite($fout, "cache_effective_user squid\n"); - fwrite($fout, "cache_effective_group squid\n"); - fclose($fout); + function write_squid_static_config() { + global $config; + $lancfg = $config['interfaces']['lan']; + $lanif = $lancfg['if']; + $lanip = $lancfg['ipaddr']; + $lansa = gen_subnet($lancfg['ipaddr'], $lancfg['subnet']); + $lansn = $lancfg['subnet']; + $fout = fopen("/usr/local/etc/squid/squid.conf","w"); + fwrite($fout, "#\n"); + fwrite($fout, "# This file was automatically generated by the pfSense package manager\n"); + fwrite($fout, "#\n"); + fwrite($fout, "http_port 3128\n"); + fwrite($fout, "icp_port 0\n"); + fwrite($fout, "acl localnet src " . $lansa . "/" . $lansn . "\n"); + fwrite($fout, "acl all src " . $lansa . "/" . $lansn . "\n"); + fwrite($fout, "acl localhost src 127.0.0.1/255.255.255.255\n"); + fwrite($fout, "acl Safe_ports port 80 443 210 119 70 21 1025-65535\n"); + fwrite($fout, "acl CONNECT method CONNECT\n"); + fwrite($fout, "http_access allow localnet\n"); + fwrite($fout, "http_access allow localhost\n"); + fwrite($fout, "http_access deny !Safe_ports\n"); + fwrite($fout, "http_access deny CONNECT\n"); + fwrite($fout, "http_access deny all\n"); + fwrite($fout, "visible_hostname pfSense\n"); + fwrite($fout, "httpd_accel_host virtual\n"); + fwrite($fout, "httpd_accel_port 80\n"); + fwrite($fout, "httpd_accel_with_proxy on\n"); + fwrite($fout, "httpd_accel_uses_host_header on\n"); + fwrite($fout, "cache_effective_user squid\n"); + fwrite($fout, "cache_effective_group squid\n"); + fwrite($fout, "cache_mem $cache MB\n"); + fclose($fout); + } + write_squid_static_config(); $fout = fopen("/usr/local/etc/rc.d/squid.sh","w"); fwrite($fout, "#!/bin/sh\n"); fwrite($fout, "/usr/local/sbin/squid\n\n"); fclose($fout); - system("chmod a+x /usr/local/etc/rc.d/squid.sh"); - system("/usr/local/sbin/squid -z"); - system("/usr/local/sbin/squid"); + mwexec("chmod a+x /usr/local/etc/rc.d/squid.sh"); + mwexec("/usr/local/sbin/squid -z"); + mwexec("/usr/local/sbin/squid"); filter_configure(); - - exec("mv /var/db/pkg/squid* /tmp/"); - exec("mv /tmp/squid* /var/db/pkg/"); - - exec("/bin/rm -rf /usr/local/squid"); + mwexec("/bin/rm -rf /usr/local/squid"); filter_configure(); /usr/local/sbin/squid -- cgit v1.2.3