2014-04-13 17:15:55 +02:00
|
|
|
#!/bin/sh
|
2013-11-03 13:45:26 +01:00
|
|
|
ICINGA2PKIDIR=@CMAKE_INSTALL_FULL_DATADIR@/icinga2/pki
|
2013-10-17 15:35:42 +02:00
|
|
|
|
2014-04-13 19:22:14 +02:00
|
|
|
. $ICINGA2PKIDIR/pkifuncs
|
2013-10-17 14:32:38 +02:00
|
|
|
|
|
|
|
check_pki_dir
|
|
|
|
|
2014-04-13 17:15:55 +02:00
|
|
|
if [ `ls -1 -- $ICINGA_CA | wc -l` != 0 ]; then
|
2013-10-17 14:32:38 +02:00
|
|
|
echo "The Icinga CA directory must be empty." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2013-10-23 13:02:38 +02:00
|
|
|
chmod 700 $ICINGA_CA >/dev/null 2>&1
|
|
|
|
|
2013-10-17 14:32:38 +02:00
|
|
|
echo '01' > $ICINGA_CA/serial
|
|
|
|
touch $ICINGA_CA/index.txt
|
|
|
|
|
2013-10-23 13:02:38 +02:00
|
|
|
cp $ICINGA2PKIDIR/vars $ICINGA_CA/
|
2014-04-13 19:22:14 +02:00
|
|
|
. $ICINGA_CA/vars
|
2013-10-23 13:02:38 +02:00
|
|
|
|
2014-07-02 10:21:21 +02:00
|
|
|
KEY_DIR=$ICINGA_CA openssl req -config $ICINGA2PKIDIR/openssl-quiet.cnf -new -newkey rsa:4096 -x509 -days 3650 -keyform PEM -keyout $ICINGA_CA/ca.key -outform PEM -out $ICINGA_CA/ca.crt && \
|
2013-12-11 15:14:24 +01:00
|
|
|
chmod 600 $ICINGA_CA/ca.key && \
|
2013-10-23 13:02:38 +02:00
|
|
|
echo -e "\n\tIf you want to change the default settings for server certificates check out \"$ICINGA_CA/vars\".\n"
|