aboutsummaryrefslogtreecommitdiffstats
path: root/config/haproxy-devel/haproxy.inc
diff options
context:
space:
mode:
authorPiBa-NL <pba_2k3@yahoo.com>2014-04-13 15:01:38 +0200
committerPiBa-NL <pba_2k3@yahoo.com>2014-04-13 15:01:38 +0200
commit6e446cea9aad630af307202809885ab9a6397d43 (patch)
tree143ca081fb7d131dec17fec599011253ee770b77 /config/haproxy-devel/haproxy.inc
parentf9b4780bec0f2994c93c8cdac5c7646a9b5b6a84 (diff)
downloadpfsense-packages-6e446cea9aad630af307202809885ab9a6397d43.tar.gz
pfsense-packages-6e446cea9aad630af307202809885ab9a6397d43.tar.bz2
pfsense-packages-6e446cea9aad630af307202809885ab9a6397d43.zip
haproxy-devel, plugin function for reporting used certificates
Diffstat (limited to 'config/haproxy-devel/haproxy.inc')
-rw-r--r--config/haproxy-devel/haproxy.inc30
1 files changed, 30 insertions, 0 deletions
diff --git a/config/haproxy-devel/haproxy.inc b/config/haproxy-devel/haproxy.inc
index e1cfdbbe..cae53330 100644
--- a/config/haproxy-devel/haproxy.inc
+++ b/config/haproxy-devel/haproxy.inc
@@ -1199,6 +1199,36 @@ function haproxy_plugin_carp($pluginparams) {
haproxy_check_run(0);
}
+function haproxy_plugin_certificates($pluginparams) {
+ global $config;
+ $result = array();
+ if ($pluginparams['type'] == 'certificates' && $pluginparams['event'] == 'used_certificates') {
+ $result['pkgname'] = "HAProxy";
+ $result['certificatelist'] = array();
+ // return a array of used certificates.
+ foreach($config['installedpackages']['haproxy']['ha_backends']['item'] as &$frontend) {
+ $mainfrontend = get_primaryfrontend($frontend);
+ if (strtolower($mainfrontend['type']) == "http" && $mainfrontend['ssloffload']) {
+ if ($frontend['ssloffloadacl']){
+ $item = array();
+ $cert = $frontend['ssloffloadcert'];
+ $item['usedby'] = $frontend['name'];
+ $result['certificatelist'][$cert][] = $item;
+ }
+ if ($frontend['ssloffloadacladditional']){
+ foreach($frontend['ha_certificates']['item'] as $certref){
+ $item = array();
+ $cert = $certref['ssl_certificate'];
+ $item['usedby'] = $frontend['name'];
+ $result['certificatelist'][$cert][] = $item;
+ }
+ }
+ }
+ }
+ }
+ return $result;
+}
+
function haproxy_check_run($reload) {
global $config, $g, $haproxy_run_message;