#!/bin/bash ICINGA2PKIDIR=@CMAKE_INSTALL_FULL_DATADIR@/icinga2/pki ICINGA2CONFIG=@CMAKE_INSTALL_FULL_SYSCONFDIR@/icinga2 if [ -n "$1" ]; then if [ ! -e $ICINGA2CONFIG/pki/agent/agent.key ]; then echo "You haven't generated a private key for this Icinga 2 instance" echo "yet. Please run this script without any parameters to generate a key." exit 1 fi if [ ! -e "$1" ]; then echo "The specified key bundle does not exist." exit 1 fi while true; do echo -n "Upstream Icinga instance name: " if ! read UPSTREAM; then exit 1 fi if [ -n "$UPSTREAM" ]; then break fi done echo "Installing the certificate bundle..." tar -C $ICINGA2CONFIG/pki/agent/ -xf "$1" echo "Setting up agent configuration..." cat >$ICINGA2CONFIG/features-available/agent.conf <." exit 0