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 exit 1
fi 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. * The agent listener accepts checks from agents.
*/ */
@ -24,16 +26,18 @@ if [ -n "$1" ]; then
library "agent" library "agent"
object AgentListener "agent" { object AgentListener "agent" {
cert_path = SysconfDir + "/icinga2/pki/agent.crt" cert_path = SysconfDir + "/icinga2/pki/agent/agent.crt"
key_path = SysconfDir + "/icinga2/pki/agent.key" key_path = SysconfDir + "/icinga2/pki/agent/agent.key"
ca_path = SysconfDir + "/icinga2/pki/ca.crt" ca_path = SysconfDir + "/icinga2/pki/agent/ca.crt"
bind_port = 7000 bind_port = 7000
} }
AGENT 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 "The key bundle was installed successfully and the agent component"
echo "was enabled. Please make sure to restart Icinga 2 for these changes" echo "was enabled. Please make sure to restart Icinga 2 for these changes"
echo "to take effect." echo "to take effect."

View File

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