From 8db719c835ce72ca590146f5cbc55e506e6fb5c2 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Wed, 20 Nov 2024 15:34:15 +0100
Subject: [PATCH] update icinga cli

---
 icinga-cli.sh | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/icinga-cli.sh b/icinga-cli.sh
index 9bdcab5..bcc1b61 100755
--- a/icinga-cli.sh
+++ b/icinga-cli.sh
@@ -24,11 +24,12 @@
 # 2023-11-02  v0.17  ah  fix line breaks of sent output, shell check fixes
 # 2023-11-02  v0.18  ah  fix quoting of perfdata in json
 # 2023-11-02  v0.19  ah  move _parseConfig
+# 2024-11-20  v0.20  ah  update rest api client; use cert "${dir_cfg}/certs/ca.crt"
 # ======================================================================
 
 
 _product="ICINGA PASSIVE CLIENT"
-_version="0.19"
+_version="0.20"
 _license="GNU GPL 3.0"
 _copyright='(c) Institute for Medical Education * University of Bern'
 
@@ -72,6 +73,14 @@ function _initHttp(){
   if [ $debug -ne 0 ]; then
     http.setDebug 1
   fi
+  local _cert="${dir_cfg}/certs/ca.crt"
+  if [ ! -f "$_cert" ]; then
+    echo
+    echo "ERROR: certificate was not found."
+    echo "Copy the Icinga master CA into $_cert"
+    exit 1
+  fi
+  http.setCA "$_cert"
 }
 
 
@@ -553,7 +562,7 @@ else
   . "$( dirname $0 )/inc_getconfig.sh"
 fi
 
-. "$( dirname $0 )/inc/rest-api-client.sh"
+. "$( dirname $0 )/inc/http.class.sh"
 
 if [ $# -eq 0 ]; then
   showHelp
-- 
GitLab