aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/squid.xml105
1 files changed, 84 insertions, 21 deletions
diff --git a/packages/squid.xml b/packages/squid.xml
index e7cc3688..ff3fc4f0 100644
--- a/packages/squid.xml
+++ b/packages/squid.xml
@@ -1,14 +1,66 @@
<?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 "&lt;pre&gt;";
- system("/bin/mkdir /usr/local/etc/squid");
+ <configpath>['installedpackages']['squid']['config']</configpath>
+ <aftersaveredirect>pkg_edit.php?xml=squid.xml&amp;id=0&amp;savemsg=Settings%20saved.</aftersaveredirect>
+ <name>squid</name>
+ <menu>
+ <name>Squid</name>
+ <tooltiptext>Squid-Cache Proxy</tooltiptext>
+ <section>Services</section>
+ <url>pkg_edit.php?xml=squid.xml&amp;id=0</url>
+ </menu>
+ <fields>
+ <field>
+ <fielddescr>hostname</fielddescr>
+ <fieldname>visable_hostname</fieldname>
+ <description>note: if left empty your default hostname will be used.</description>
+ <type>input</type>
+ </field>
+ <field>
+ <fielddescr>http_port</fielddescr>
+ <fieldname>http_port</fieldname>
+ <description>note: default proxy port is 3128.</description>
+ <type>input</type>
+ </field>
+ <field>
+ <fielddescr>httpd_accel_with_proxy</fielddescr>
+ <fieldname>httpd_accel_with_proxy</fieldname>
+ <description>enabled by default</description>
+ <type>select</type>
+ <options>
+ <option><name>On</name><value>on</value></option>
+ <option><name>Off</name><value>off</value></option>
+ </options>
+ </field>
+ <field>
+ <fielddescr>cache size [MB]</fielddescr>
+ <fieldname>cache_mem</fieldname>
+ <description>hint: fill 1/3 of the cache memory size you want squid to use.</description>
+ <type>input</type>
+ </field>
+ <field>
+ <fielddescr>admin email</fielddescr>
+ <fieldname>cache_mgr</fieldname>
+ <description></description>
+ <type>input</type>
+ </field>
+ <field>
+ <fielddescr>blocked words</fielddescr>
+ <type>rowhelper</type>
+ <rowhelper>
+ <rowhelperfield>
+ <fieldname>badURL</fieldname>
+ <description>url that contain any of the words will be blocked.</description>
+ <type>input</type>
+ <options>
+ </options>
+ </rowhelperfield>
+ </rowhelper>
+ </field>
+ </fields>
+ <custom_php_command_before_form>
+ function sync_package() {
+ system("/bin/mkdir /usr/local/etc/squid 2>/dev/null");
$lancfg = $config['interfaces']['lan'];
$lanif = $lancfg['if'];
$lanip = $lancfg['ipaddr'];
@@ -17,6 +69,11 @@
$netmask = "";
$fout = fopen("/usr/local/etc/squid/squid.conf","w");
fwrite($fout, "# cat squid.conf\n");
+ fwrite($fout, "visable_hostname " . $_POST['hostname'] . "\n");
+ fwrite($fout, "http_port " . $_POST['http_port'] . "\n");
+ fwrite($fout, "httpd_accel_with_proxy " . $_POST['httpd_accel_with_proxy'] . "\n");
+ fwrite($fout, "cache_mem " . $_POST['cache_mem'] . "\n");
+ fwrite($fout, "cache_mgr " . $_POST['cache_mgr'] . "\n");
fwrite($fout, "http_port 3128\n");
fwrite($fout, "icp_port 0\n");
fwrite($fout, "acl localnet src " . $lansa . "/" . $lansn . "\n");
@@ -29,11 +86,11 @@
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, "badURL " . $_POST['badURL'] . "\n"); */
fclose($fout);
$fout = fopen("/usr/local/etc/rc.d/squid.sh","w");
fwrite($fout, "#!/bin/sh\n");
@@ -43,14 +100,20 @@
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>
+ }
+ </custom_php_command_before_form>
+ <custom_php_resync_config_command>
+ sync_package();
+ </custom_php_resync_config_command>
+ <custom_php_install_command>
+ sync_package();
+ </custom_php_install_command>
+ <start_command>/usr/local/sbin/squid</start_command>
+ <custom_php_pre_deinstall_command>
+ exec("mv /var/db/pkg/squid* /tmp/ 2>/dev/null");
+ filter_configure();
+ </custom_php_pre_deinstall_command>
+ <custom_php_deinstall_command>
+ </custom_php_deinstall_command>
+ <process_kill_command>squid</process_kill_command>
+</packagegui> \ No newline at end of file