aboutsummaryrefslogtreecommitdiffstats
path: root/config/haproxy/haproxy.inc
diff options
context:
space:
mode:
authorJim P <jim@pingle.org>2013-02-19 09:03:50 -0800
committerJim P <jim@pingle.org>2013-02-19 09:03:50 -0800
commit1cffd57c76630d8f116a1a805a52938548808337 (patch)
tree37c7bb0e187b2a45dc1997821d2224623d9e15b7 /config/haproxy/haproxy.inc
parent0886c469fca958d28735ccc97a1fa4ff3f059db0 (diff)
parentc7460e44dd9669f47484ab58fefaac368329cda8 (diff)
downloadpfsense-packages-1cffd57c76630d8f116a1a805a52938548808337.tar.gz
pfsense-packages-1cffd57c76630d8f116a1a805a52938548808337.tar.bz2
pfsense-packages-1cffd57c76630d8f116a1a805a52938548808337.zip
Merge pull request #387 from PiBa-NL/HAProxy_pfSense2.1
updated HAProxy package to work with pfSense 2.1
Diffstat (limited to 'config/haproxy/haproxy.inc')
-rw-r--r--config/haproxy/haproxy.inc34
1 files changed, 30 insertions, 4 deletions
diff --git a/config/haproxy/haproxy.inc b/config/haproxy/haproxy.inc
index 1e29f358..45dce95c 100644
--- a/config/haproxy/haproxy.inc
+++ b/config/haproxy/haproxy.inc
@@ -58,6 +58,9 @@ $a_acltypes[] = array('name' => 'path_contains', 'descr' => 'Path contains',
$a_acltypes[] = array('name' => 'source_ip', 'descr' => 'Source IP',
'mode' => '', 'syntax' => 'src');
+//$a_acltypes[] = array('name' => 'ssl_sni_matches', 'descr' => 'Server Name Indication TLS extension matches',
+// 'mode' => 'https', 'syntax' => 'req_ssl_sni -i');
+
function haproxy_custom_php_deinstall_command() {
exec("cd /var/db/pkg && pkg_delete `ls | grep haproxy`");
exec("rm /usr/local/pkg/haproxy.inc");
@@ -186,7 +189,7 @@ EOD;
/* link to frontend */
foreach ($a_backends as $id => $be) {
if ($a_backends[$id]['name'] == $oldserver['backend']) {
- $a_backends[$id]['pool'] = $pool['name'];
+ $a_backends[$id]['backend_serverpool'] = $pool['name'];
$pool['monitor_uri'] = $be['monitor_uri'];
unset($a_backends[$id]['monitor_uri']);
break;
@@ -201,6 +204,29 @@ EOD;
unset($config['installedpackages']['haproxy']['ha_servers']);
write_config();
}
+
+ /* XML update to: pkg v1.3 and 'pool' changed to 'backend_serverpool' because 'pool' was added to listtags() in xmlparse.inc */
+ if (is_array($config['installedpackages']['haproxy']['ha_backends']['item'][0]['pool']))
+ {
+ foreach($config['installedpackages']['haproxy']['ha_backends']['item'] as &$frontend)
+ {
+ $backend_serverpool = $frontend['pool'][0];
+ $frontend['backend_serverpool'] = $backend_serverpool;
+ unset($frontend['pool']);
+ }
+ write_config();
+ }
+ //also move setting for existing 2.0 installations as only the new variable is used
+ if (isset($config['installedpackages']['haproxy']['ha_backends']['item'][0]['pool']))
+ {
+ foreach($config['installedpackages']['haproxy']['ha_backends']['item'] as &$frontend)
+ {
+ $backend_serverpool = $frontend['pool'];
+ $frontend['backend_serverpool'] = $backend_serverpool;
+ unset($frontend['pool']);
+ }
+ write_config();
+ }
conf_mount_ro();
@@ -420,7 +446,7 @@ function haproxy_writeconf() {
foreach ($a_backends as $backend) {
if($backend['status'] != 'active')
continue;
- if(!$backend['pool'])
+ if(!$backend['backend_serverpool'])
continue;
$bname = $backend['extaddr'] . ":" . $backend['port'];
@@ -519,7 +545,7 @@ function haproxy_writeconf() {
if(!is_array($a_acl))
$a_acl=array();
- $poolname = $bconfig['pool'] . "_" . strtolower($bconfig['type']);
+ $poolname = $bconfig['backend_serverpool'] . "_" . strtolower($bconfig['type']);
// Create different pools if the svrport is set
if ($bconfig['svrport'] > 0)
@@ -564,7 +590,7 @@ function haproxy_writeconf() {
if (is_array($a_pendingpl) && is_array($a_pools)) {
foreach ($a_pendingpl as $pending) {
foreach ($a_pools as $pool) {
- if ($pending['frontend']['pool'] == $pool['name']) {
+ if ($pending['frontend']['backend_serverpool'] == $pool['name']) {
write_backend($fd, $pending['name'], $pool, $pending['frontend']);
}
}