From eafeea317761bae375e591f763fb42c4664aa74e Mon Sep 17 00:00:00 2001 From: Cullum Smith Date: Sat, 26 Oct 2024 09:10:00 -0400 Subject: cleanup icinga scripts --- scripts/hostclass/icinga_server/10-icingadb | 81 +++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 scripts/hostclass/icinga_server/10-icingadb (limited to 'scripts/hostclass/icinga_server/10-icingadb') diff --git a/scripts/hostclass/icinga_server/10-icingadb b/scripts/hostclass/icinga_server/10-icingadb new file mode 100644 index 0000000..624ae58 --- /dev/null +++ b/scripts/hostclass/icinga_server/10-icingadb @@ -0,0 +1,81 @@ +#!/bin/sh + +: ${icinga_password:='changeme'} +: ${icinga_dbhost:="$postgres_host"} +: ${icinga_dbname:='icinga'} + +icinga_dn="uid=${icinga_username},${robots_basedn}" +icingaweb_client_keytab="${keytab_dir}/icingaweb.client.keytab" +icingadb_conf_dir=/usr/local/etc/icingadb +redis_user=redis +redis_data_dir=/var/db/redis +redis_sock=/var/run/redis/redis.sock +redis_port=6379 +redis_data_dir=/var/db/redis + +icinga_psql(){ + KRB5CCNAME=MEMORY: KRB5_CLIENT_KTNAME="$icingaweb_client_keytab" \ + psql \ + --quiet --no-align --tuples-only --echo-all \ + --host="$icinga_dbhost" \ + --dbname="$icinga_dbname" \ + --username="$icinga_username" \ + --no-password \ + "$@" +} + +# Install packages. +pkg install -y \ + icingadb \ + redis + +# Create icinga LDAP user, principal, and keytab. +# Note that we have a separate userPassword attribute in LDAP because icingadb is +# written in golang, and its pq library is not built with GSSAPI support. +# GSSAPI *is* supported by icingaweb2 via PHP's PDO, however, so we use it there. +# We also need a userPassword attribute for icingaweb2 LDAP binds. +ldap_add "$icinga_dn" < /dev/null 2>&1 -- cgit v1.2.3