From 6e446cea9aad630af307202809885ab9a6397d43 Mon Sep 17 00:00:00 2001 From: PiBa-NL Date: Sun, 13 Apr 2014 15:01:38 +0200 Subject: haproxy-devel, plugin function for reporting used certificates --- config/haproxy-devel/haproxy.inc | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) 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; -- cgit v1.2.3 From 419c50710e9ff8d22bcfff0a812cf733e48d8166 Mon Sep 17 00:00:00 2001 From: PiBa-NL Date: Sun, 13 Apr 2014 15:09:10 +0200 Subject: haproxy-devel, add plugin 'activation' into the xml --- config/haproxy-devel/haproxy.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/haproxy-devel/haproxy.xml b/config/haproxy-devel/haproxy.xml index 5c534522..acd934a7 100644 --- a/config/haproxy-devel/haproxy.xml +++ b/config/haproxy-devel/haproxy.xml @@ -62,6 +62,9 @@ plugin_carp + + plugin_certificates + installedpackages->haproxy->config -- cgit v1.2.3