aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorgeijt <geijt50@hotmail.com>2013-02-09 17:16:29 +0100
committergeijt <geijt50@hotmail.com>2013-02-09 17:17:07 +0100
commitd1dce3495cf5fdddddb5b9ca0c1b7334b4dd29ac (patch)
treed608614e4ce44e1450948304ea3c1d04fb03386b /config
parent44b75f44ba49e82a11a3a008e4a2123c89511b74 (diff)
downloadpfsense-packages-d1dce3495cf5fdddddb5b9ca0c1b7334b4dd29ac.tar.gz
pfsense-packages-d1dce3495cf5fdddddb5b9ca0c1b7334b4dd29ac.tar.bz2
pfsense-packages-d1dce3495cf5fdddddb5b9ca0c1b7334b4dd29ac.zip
Added redirects for squid-reverse
Added the options for squid-reverse to redirect from http/https on the specified URI to an URL
Diffstat (limited to 'config')
-rw-r--r--config/squid-reverse/squid.inc5
-rw-r--r--config/squid-reverse/squid_monitor.php1
-rw-r--r--config/squid-reverse/squid_reverse.inc35
-rw-r--r--config/squid-reverse/squid_reverse_general.xml4
-rw-r--r--config/squid-reverse/squid_reverse_peer.xml4
-rw-r--r--config/squid-reverse/squid_reverse_redir.xml182
-rwxr-xr-xconfig/squid-reverse/squid_reverse_sync.xml4
-rw-r--r--config/squid-reverse/squid_reverse_uri.xml4
8 files changed, 239 insertions, 0 deletions
diff --git a/config/squid-reverse/squid.inc b/config/squid-reverse/squid.inc
index 941395f6..fef9590c 100644
--- a/config/squid-reverse/squid.inc
+++ b/config/squid-reverse/squid.inc
@@ -6,6 +6,7 @@
Copyright (C) 2006 Fernando Lemos
Copyright (C) 2012 Martin Fuchs
Copyright (C) 2012 Marcello Coutinho
+ Copyright (C) 2013 Gekkenhuis
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -1053,6 +1054,10 @@ acl manager proto cache_object
acl purge method PURGE
acl connect method CONNECT
+# Define protocols used for redirects
+acl HTTP proto HTTP
+acl HTTPS proto HTTPS
+
EOD;
diff --git a/config/squid-reverse/squid_monitor.php b/config/squid-reverse/squid_monitor.php
index c2164023..86c7d33a 100644
--- a/config/squid-reverse/squid_monitor.php
+++ b/config/squid-reverse/squid_monitor.php
@@ -83,6 +83,7 @@ include("head.inc");
$tab_array[] = array(gettext("General"), false, "/pkg_edit.php?xml=squid_reverse_general.xml&amp;id=0");
$tab_array[] = array(gettext("Web Servers"), false, "/pkg.php?xml=squid_reverse_peer.xml");
$tab_array[] = array(gettext("Mappings"), false, "/pkg.php?xml=squid_reverse_uri.xml");
+ $tab_array[] = array(gettext("Redirects"), false, "/pkg.php?xml=squid_reverse_redir.xml");
$tab_array[] = array(gettext("Real time"), true, "/squid_monitor.php?menu=reverse");
$tab_array[] = array(gettext("Sync"), false, "/pkg_edit.php?xml=squid_reverse_sync.xml");
}
diff --git a/config/squid-reverse/squid_reverse.inc b/config/squid-reverse/squid_reverse.inc
index 652931c8..eb2d4c73 100644
--- a/config/squid-reverse/squid_reverse.inc
+++ b/config/squid-reverse/squid_reverse.inc
@@ -4,6 +4,7 @@
squid_reverse.inc
Copyright (C) 2012 Martin Fuchs
Copyright (C) 2012 Marcello Coutinho
+ Copyright (C) 2013 Gekkenhuis
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -40,6 +41,8 @@ function squid_resync_reverse() {
$reverse_peers=$config['installedpackages']['squidreversepeer']['config'];
if (is_array($config['installedpackages']['squidreverseuri']))
$reverse_maps=$config['installedpackages']['squidreverseuri']['config'];
+ if (is_array($config['installedpackages']['squidreverseredir']))
+ $reverse_redir=$config['installedpackages']['squidreverseredir']['config'];
$conf = "# Reverse Proxy settings\n";
@@ -124,6 +127,38 @@ function squid_resync_reverse() {
}
}
+ //REDIRECTS
+ if (is_array($reverse_redir)) {
+ foreach ($reverse_redir as $rdr) {
+ if($rdr['enable'] == "on" && $rdr['name'] != "" && $rdr['pathregex'] != "" && $rdr['redirurl'] != "") {
+ $conf_rdr = "# Redirect: {$rdr['description']}\n";
+
+ if (is_array($rdr['row'])) {
+ foreach ($rdr['row'] as $uri) {
+ $conf_rdr .= "acl rdr_dst_{$rdr['name']} dstdomain {$uri['uri']}\n";
+ }
+ }
+
+ $conf_rdr .= "acl rdr_path_{$rdr['name']} urlpath_regex {$rdr['pathregex']}\n";
+ $conf_rdr .= "deny_info {$rdr['redirurl']} rdr_path_{$rdr['name']}\n";
+
+ foreach (explode(',', $rdr['protocol']) as $rdr_protocol) {
+ if($rdr_protocol == "HTTP") {
+ $conf_rdr .= "http_access deny HTTP rdr_dst_{$rdr['name']} rdr_path_{$rdr['name']}\n";
+ }
+
+ if($rdr_protocol == "HTTPS") {
+ $conf_rdr .= "http_access deny HTTPS rdr_dst_{$rdr['name']} rdr_path_{$rdr['name']}\n";
+ }
+ }
+
+ $conf_rdr .= "\n";
+ }
+
+ $conf .= $conf_rdr;
+ }
+ }
+
//ACLS and MAPPINGS
//create an empty owa_dirs to populate based on user selected options
diff --git a/config/squid-reverse/squid_reverse_general.xml b/config/squid-reverse/squid_reverse_general.xml
index ec0bcb7a..2211bb20 100644
--- a/config/squid-reverse/squid_reverse_general.xml
+++ b/config/squid-reverse/squid_reverse_general.xml
@@ -64,6 +64,10 @@
<url>/pkg.php?xml=squid_reverse_uri.xml</url>
</tab>
<tab>
+ <text>Redirects</text>
+ <url>/pkg.php?xml=squid_reverse_redir.xml</url>
+ </tab>
+ <tab>
<text>Real time</text>
<url>/squid_monitor.php?menu=reverse</url>
</tab>
diff --git a/config/squid-reverse/squid_reverse_peer.xml b/config/squid-reverse/squid_reverse_peer.xml
index 6341567e..abfbf19b 100644
--- a/config/squid-reverse/squid_reverse_peer.xml
+++ b/config/squid-reverse/squid_reverse_peer.xml
@@ -64,6 +64,10 @@
<url>/pkg.php?xml=squid_reverse_uri.xml</url>
</tab>
<tab>
+ <text>Redirects</text>
+ <url>/pkg.php?xml=squid_reverse_redir.xml</url>
+ </tab>
+ <tab>
<text>Real time</text>
<url>/squid_monitor.php?menu=reverse</url>
</tab>
diff --git a/config/squid-reverse/squid_reverse_redir.xml b/config/squid-reverse/squid_reverse_redir.xml
new file mode 100644
index 00000000..de25f56a
--- /dev/null
+++ b/config/squid-reverse/squid_reverse_redir.xml
@@ -0,0 +1,182 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE packagegui SYSTEM "../schema/packages.dtd">
+<?xml-stylesheet type="text/xsl" href="../xsl/package.xsl"?>
+<packagegui>
+ <copyright>
+ <![CDATA[
+/* $Id$ */
+/* ============================================================================ */
+/*
+ squid_reverse_redir.xml
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2013 Gekkenhuis
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+ */
+/* ============================================================================ */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ============================================================================ */
+ ]]>
+ </copyright>
+ <description>Describe your package here</description>
+ <requirements>Describe your package requirements here</requirements>
+ <faq>Currently there are no FAQ items provided.</faq>
+ <name>squidreverseredir</name>
+ <version>none</version>
+ <title>Reverse Proxy server: Redirects</title>
+ <include_file>/usr/local/pkg/squid.inc</include_file>
+ <tabs>
+ <tab>
+ <text>General</text>
+ <url>/pkg_edit.php?xml=squid_reverse_general.xml&amp;id=0</url>
+ </tab>
+ <tab>
+ <text>Web Servers</text>
+ <url>/pkg.php?xml=squid_reverse_peer.xml</url>
+ </tab>
+ <tab>
+ <text>Mappings</text>
+ <url>/pkg.php?xml=squid_reverse_uri.xml</url>
+ </tab>
+ <tab>
+ <text>Redirects</text>
+ <url>/pkg.php?xml=squid_reverse_redir.xml</url>
+ <active/>
+ </tab>
+ <tab>
+ <text>Real time</text>
+ <url>/squid_monitor.php?menu=reverse</url>
+ </tab>
+ <tab>
+ <text>Sync</text>
+ <url>/pkg_edit.php?xml=squid_reverse_sync.xml&amp;id=0</url>
+ </tab>
+ </tabs>
+ <adddeleteeditpagefields>
+ <columnitem>
+ <fielddescr>Status</fielddescr>
+ <fieldname>enable</fieldname>
+ </columnitem>
+ <columnitem>
+ <fielddescr>Redirect Name</fielddescr>
+ <fieldname>name</fieldname>
+ </columnitem>
+ <columnitem>
+ <fielddescr>Redirect to</fielddescr>
+ <fieldname>redirurl</fieldname>
+ </columnitem>
+ <columnitem>
+ <fielddescr>Description</fielddescr>
+ <fieldname>description</fieldname>
+ </columnitem>
+ </adddeleteeditpagefields>
+ <fields>
+ <field>
+ <name>Squid Redirect Mappings</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <fielddescr>Enable this redirect</fielddescr>
+ <fieldname>enable</fieldname>
+ <description><![CDATA[If this field is checked, then this redirect will be available for reverse config.]]></description>
+ <type>checkbox</type>
+ </field>
+ <field>
+ <fielddescr>Redirect name</fielddescr>
+ <fieldname>name</fieldname>
+ <description><![CDATA[Name to identify this redirect on squid reverse conf<br/>
+ example: REDIR1]]></description>
+ <type>input</type>
+ <size>20</size>
+ </field>
+ <field>
+ <fielddescr>Redirect Description</fielddescr>
+ <fieldname>description</fieldname>
+ <description><![CDATA[Redirect Description (optional)]]></description>
+ <type>input</type>
+ <size>60</size>
+ </field>
+ <field>
+ <fielddescr>Redirect Protocol</fielddescr>
+ <fieldname>protocol</fieldname>
+ <description><![CDATA[Protocol to redirect on.<br/>
+ Use CTRL + click to select multiple]]></description>
+ <type>select</type>
+ <multiple/>
+ <size>03</size>
+ <options>
+ <option>
+ <name>HTTP</name>
+ <value>HTTP</value>
+ </option>
+ <option>
+ <name>HTTPS</name>
+ <value>HTTPS</value>
+ </option>
+ </options>
+ </field>
+ <field>
+ <fielddescr>Blocked domains</fielddescr>
+ <fieldname>none</fieldname>
+ <description>Domains to redirect for</description>
+ <type>rowhelper</type>
+ <rowhelper>
+ <rowhelperfield>
+ <fielddescr><![CDATA[<strong>Domains to match</strong><br/><br/>
+ Samples: mydomain.com sub.mydomain.com www.mydomain.com<br/><br/>
+ Do not enter http:&#47;&#47; or https:&#47;&#47; here! only the hostname is required.]]></fielddescr>
+ <fieldname>uri</fieldname>
+ <type>input</type>
+ <size>60</size>
+ </rowhelperfield>
+ </rowhelper>
+ </field>
+ <field>
+ <fielddescr>Path regex</fielddescr>
+ <fieldname>pathregex</fieldname>
+ <description><![CDATA[Path regex to match<br/><br/>]]>
+ Enter &#94;&#47;&#36; to match the domain only.</description>
+ <type>input</type>
+ <size>60</size>
+ </field>
+ <field>
+ <fielddescr>URL to redirect to</fielddescr>
+ <fieldname>redirurl</fieldname>
+ <description><![CDATA[URL to redirect to]]></description>
+ <type>input</type>
+ <size>60</size>
+ </field>
+ </fields>
+
+ <custom_php_command_before_form>
+ </custom_php_command_before_form>
+ <custom_php_validation_command>
+ </custom_php_validation_command>
+ <custom_php_resync_config_command>
+ squid_resync();
+ </custom_php_resync_config_command>
+</packagegui> \ No newline at end of file
diff --git a/config/squid-reverse/squid_reverse_sync.xml b/config/squid-reverse/squid_reverse_sync.xml
index 408f14f1..db5e6145 100755
--- a/config/squid-reverse/squid_reverse_sync.xml
+++ b/config/squid-reverse/squid_reverse_sync.xml
@@ -59,6 +59,10 @@
<url>/pkg.php?xml=squid_reverse_uri.xml</url>
</tab>
<tab>
+ <text>Redirects</text>
+ <url>/pkg.php?xml=squid_reverse_redir.xml</url>
+ </tab>
+ <tab>
<text>Real time</text>
<url>/squid_monitor.php?menu=reverse</url>
</tab>
diff --git a/config/squid-reverse/squid_reverse_uri.xml b/config/squid-reverse/squid_reverse_uri.xml
index 81c9af3b..1232cfe3 100644
--- a/config/squid-reverse/squid_reverse_uri.xml
+++ b/config/squid-reverse/squid_reverse_uri.xml
@@ -64,6 +64,10 @@
<active/>
</tab>
<tab>
+ <text>Redirects</text>
+ <url>/pkg.php?xml=squid_reverse_redir.xml</url>
+ </tab>
+ <tab>
<text>Real time</text>
<url>/squid_monitor.php?menu=reverse</url>
</tab>