aboutsummaryrefslogtreecommitdiffstats
path: root/config/haproxy-devel/haproxy_utils.inc
diff options
context:
space:
mode:
authorPiBa-NL <pba_2k3@yahoo.com>2015-02-02 01:11:17 +0100
committerPiBa-NL <pba_2k3@yahoo.com>2015-02-02 01:11:17 +0100
commite28f3357fa41438060791f4b339ab079721d64d6 (patch)
tree395f0249f2bb4922789d133783421174b6fc8f51 /config/haproxy-devel/haproxy_utils.inc
parent90e3a2b3636b8bda325ed66663bba6a6f126762b (diff)
downloadpfsense-packages-e28f3357fa41438060791f4b339ab079721d64d6.tar.gz
pfsense-packages-e28f3357fa41438060791f4b339ab079721d64d6.tar.bz2
pfsense-packages-e28f3357fa41438060791f4b339ab079721d64d6.zip
haproxy-devel, several improvements / fixes:
-combine certificate acl's with user acl's -wildcard certificate acl handling -better handeling of 'transparent' backends when using mixed ipv4 and ipv6, a single defined backend can write 2 backends to the config ipv4 / ipv6 -option to negate a acl -moved acl definitions above advanced user config in cfg (to allow user config to use already defined acls) -toggle in frontend overview to easily enable/disable a frontend
Diffstat (limited to 'config/haproxy-devel/haproxy_utils.inc')
-rw-r--r--config/haproxy-devel/haproxy_utils.inc26
1 files changed, 25 insertions, 1 deletions
diff --git a/config/haproxy-devel/haproxy_utils.inc b/config/haproxy-devel/haproxy_utils.inc
index 08906bb0..4b945c06 100644
--- a/config/haproxy-devel/haproxy_utils.inc
+++ b/config/haproxy-devel/haproxy_utils.inc
@@ -2,7 +2,7 @@
/*
haproxy_utils.php
part of pfSense (https://www.pfsense.org/)
- Copyright (C) 2013 PiBa-NL
+ Copyright (C) 2013-2015 PiBa-NL
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -35,6 +35,30 @@ require_once("config.inc");
class haproxy_utils {
public static $pf_version;
+
+ public function query_dns($host, $querytype="A,AAAA", $dnsserver = "127.0.0.1") {
+ $result = array();
+ $host = trim($host, " \t\n\r\0\x0B[];\"'");
+ $host_esc = escapeshellarg($host);
+ $types = explode(',',$querytype);
+ foreach($types as $type){
+ $resolved = gethostbyname($host);
+ if($resolved) {
+ $resolved = array();
+ if (haproxy_utils::$pf_version < '2.2')
+ exec("/usr/bin/dig {$host_esc} $type @$dnsserver | /usr/bin/grep {$host_esc} | /usr/bin/grep -v ';' | /usr/bin/awk '{ print $5 }'", $resolved);
+ else
+ exec("/usr/bin/drill {$host_esc} $type @$dnsserver | /usr/bin/grep {$host_esc} | /usr/bin/grep -v ';' | /usr/bin/awk '{ print $5 }'", $resolved);
+ foreach($resolved as $item) {
+ $newitem = array();
+ $newitem["typeid"] = $type;
+ $newitem["data"] = $item;
+ $result[] = $newitem;
+ }
+ }
+ }
+ return $result;
+ }
}
haproxy_utils::$pf_version = substr(trim(file_get_contents("/etc/version")),0,3);