aboutsummaryrefslogtreecommitdiffstats
path: root/config/haproxy-dev/haproxy.inc
diff options
context:
space:
mode:
authorthompsa <andy@fud.org.nz>2010-02-11 11:52:33 +1300
committerthompsa <andy@fud.org.nz>2010-02-11 11:52:33 +1300
commitadd2de003924d009fd400d583c975fa85c342215 (patch)
tree08d1d1974723a8ca7b35f99e6755770c02caca1a /config/haproxy-dev/haproxy.inc
parent9636654ae8fa83433e7a446bc0a56112f660dade (diff)
downloadpfsense-packages-add2de003924d009fd400d583c975fa85c342215.tar.gz
pfsense-packages-add2de003924d009fd400d583c975fa85c342215.tar.bz2
pfsense-packages-add2de003924d009fd400d583c975fa85c342215.zip
Filter the allowed ACL types by the current haproxy mode. If the type is
changed then the select list is updated and any unavailable ACLs are hidden.
Diffstat (limited to 'config/haproxy-dev/haproxy.inc')
-rw-r--r--config/haproxy-dev/haproxy.inc27
1 files changed, 27 insertions, 0 deletions
diff --git a/config/haproxy-dev/haproxy.inc b/config/haproxy-dev/haproxy.inc
index 0eb97df7..7cecabe8 100644
--- a/config/haproxy-dev/haproxy.inc
+++ b/config/haproxy-dev/haproxy.inc
@@ -34,6 +34,28 @@ require_once("notices.inc");
$d_haproxyconfdirty_path = $g['varrun_path'] . "/haproxy.conf.dirty";
+$a_acltypes = array();
+$a_acltypes[] = array('name' => 'host_starts_with', 'descr' => 'Host starts with:', 'mode' => 'http');
+$a_acltypes[] = array('name' => 'host_ends_with', 'descr' => 'Host ends with:', 'mode' =>'http');
+$a_acltypes[] = array('name' => 'host_matches', 'descr' => 'Host matches:', 'mode' =>'http');
+$a_acltypes[] = array('name' => 'host_regex', 'descr' => 'Host regex:', 'mode' =>'http');
+$a_acltypes[] = array('name' => 'host_contains', 'descr' => 'Host contains:', 'mode' => 'http');
+$a_acltypes[] = array('name' => 'path_starts_with', 'descr' => 'Path starts with:', 'mode' => 'http');
+$a_acltypes[] = array('name' => 'path_ends_with', 'descr' => 'Path ends with:', 'mode' => 'http');
+$a_acltypes[] = array('name' => 'path_matches', 'descr' => 'Path matches:', 'mode' => 'http');
+$a_acltypes[] = array('name' => 'path_regex', 'descr' => 'Path regex:', 'mode' => 'http');
+$a_acltypes[] = array('name' => 'path_contains', 'descr' => 'Path contains:', 'mode' => 'http');
+$a_acltypes[] = array('name' => 'source_ip', 'descr' => 'Source IP:', 'mode' => '');
+
+function haproxy_find_acl($name) {
+ global $a_acltypes;
+
+ foreach ($a_acltypes as $acl) {
+ if ($acl['name'] == $name)
+ return $acl;
+ }
+}
+
function haproxy_custom_php_deinstall_command() {
exec("rm /usr/local/sbin/haproxy");
exec("rm /usr/local/pkg/haproxy.inc");
@@ -215,6 +237,11 @@ function haproxy_configure() {
$a_acl=array();
foreach ($a_acl as $acl) {
+ // Filter out acls for different modes
+ $t = haproxy_find_acl($acl['expression']);
+ if (!$t || ($t['mode'] != '' && $t['mode'] != strtolower($backend['type'])))
+ continue;
+
if ($acl['expression'] == "host_starts_with")
$expr = 'hdr_beg(host) -i';
else if ($acl['expression'] == "host_ends_with")