aboutsummaryrefslogtreecommitdiffstats
path: root/config/haproxy-devel/haproxy.inc
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2014-05-08 18:22:05 -0300
committerRenato Botelho <garga@FreeBSD.org>2014-05-08 18:22:05 -0300
commit89ae41977ee81bd970c4e4cc7e3849300533e689 (patch)
treefedd8b36310b6208dcb7b10ffc63650182fadb59 /config/haproxy-devel/haproxy.inc
parent255edd11572b572a9e1a813fce466c8eb3a82d0f (diff)
parent419c50710e9ff8d22bcfff0a812cf733e48d8166 (diff)
downloadpfsense-packages-89ae41977ee81bd970c4e4cc7e3849300533e689.tar.gz
pfsense-packages-89ae41977ee81bd970c4e4cc7e3849300533e689.tar.bz2
pfsense-packages-89ae41977ee81bd970c4e4cc7e3849300533e689.zip
Merge pull request #645 from PiBa-NL/hap_cert_usage
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 4c9b3f4a..1e403c48 100644
--- a/config/haproxy-devel/haproxy.inc
+++ b/config/haproxy-devel/haproxy.inc
@@ -1186,6 +1186,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;