icinga2/pki/icinga2-build-ca.cmake

24 lines
703 B
CMake
Raw Normal View History

#!/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
. $ICINGA2PKIDIR/pkifuncs
2013-10-17 14:32:38 +02:00
check_pki_dir
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
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
cp $ICINGA2PKIDIR/vars $ICINGA_CA/
. $ICINGA_CA/vars
KEY_DIR=$ICINGA_CA openssl req -config $ICINGA2PKIDIR/openssl.cnf -new -newkey rsa:4096 -x509 -days 3650 -keyform PEM -keyout $ICINGA_CA/ca.key -outform PEM -out $ICINGA_CA/ca.crt && \
chmod 600 $ICINGA_CA/ca.key && \
echo -e "\n\tIf you want to change the default settings for server certificates check out \"$ICINGA_CA/vars\".\n"