Update agent setup scripts.

Refs #4865
This commit is contained in:
Gunnar Beutner 2014-04-12 11:51:18 +02:00
parent f0e58db266
commit 5797aeb2c5
2 changed files with 17 additions and 10 deletions

View File

@ -14,9 +14,11 @@ if [ -n "$1" ]; then
exit 1
fi
tar -C /etc/icinga2/pki/agent/agent.crt xf "$1"
echo "Installing the certificate bundle..."
tar -C $ICINGA2CONFIG/pki/agent/ -xf "$1"
cat >$ICINGACONFIG/features-available/agent.conf <<AGENT
echo "Setting up agent configuration..."
cat >$ICINGA2CONFIG/features-available/agent.conf <<AGENT
/**
* The agent listener accepts checks from agents.
*/
@ -24,16 +26,18 @@ if [ -n "$1" ]; then
library "agent"
object AgentListener "agent" {
cert_path = SysconfDir + "/icinga2/pki/agent.crt"
key_path = SysconfDir + "/icinga2/pki/agent.key"
ca_path = SysconfDir + "/icinga2/pki/ca.crt"
cert_path = SysconfDir + "/icinga2/pki/agent/agent.crt"
key_path = SysconfDir + "/icinga2/pki/agent/agent.key"
ca_path = SysconfDir + "/icinga2/pki/agent/ca.crt"
bind_port = 7000
}
AGENT
$CMAKE_INSTALL_FULL_SBINDIR@/icinga2-enable-feature agent
echo "Enabling agent feature..."
@CMAKE_INSTALL_FULL_SBINDIR@/icinga2-enable-feature agent
echo ""
echo "The key bundle was installed successfully and the agent component"
echo "was enabled. Please make sure to restart Icinga 2 for these changes"
echo "to take effect."

View File

@ -8,16 +8,16 @@ if [ -z "$1" ]; then
exit 1
fi
check_pki_dir
csrfile=$1
if [ ! -e "$csrfile" ]; then
if [ ! -e "$ICINGA_CA/$csrfile" ]; then
echo "The specified CSR file does not exist."
exit 1
fi
pubkfile=$(basename -- ${csrfile%.*})
check_pki_dir
pubkfile=${csrfile%.*}
if [ ! -f $ICINGA_CA/ca.crt -o ! -f $ICINGA_CA/ca.key ]; then
echo "Please build a CA certificate first." >&2
@ -36,3 +36,6 @@ cp $ICINGA_CA/$pubkfile.crt $ICINGA_CA/agent/agent.crt
cp $ICINGA_CA/ca.crt $ICINGA_CA/agent/ca.crt
tar cf $ICINGA_CA/$pubkfile.bundle -C $ICINGA_CA/agent/ ca.crt agent.crt
rm -rf $ICINGA_CA/agent
echo "Done. $pubkfile.crt and $pubkfile.bundle files were written."
exit 0