<?xml version="1.0" encoding="utf-8" ?> <packagegui> <name>squid</name> <!-- Menu is where this packages menu will appear --> <!-- configpath gets expanded out automatically and config items will be stored in that location --> <configpath>['installedpackages']['squid']['config']</configpath> <fields/> <custom_php_install_command> echo "<pre>"; system("/bin/mkdir /usr/local/etc/squid"); $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, "# cat squid.conf\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"); fclose($fout); $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"); filter_configure(); </custom_php_install_command> <start_command>/usr/local/sbin/squid</start_command> <custom_php_pre_deinstall_command> exec("mv /var/db/pkg/squid* /tmp/"); filter_configure(); exec("mv /tmp/squid* /var/db/pkg/"); </custom_php_pre_deinstall_command> <custom_php_deinstall_command> </custom_php_deinstall_command> <process_kill_command>squid</process_kill_command> </packagegui>