#!/bin/sh

echo "*** GENERATING SSL-KEYS FROM CERTIFICATE **"
echo "* You will be prompted for Cert-Contents  *"
echo "*  This Infos will be used only for SSL   *"
echo "* Alter the informations to your values   *"
echo "* for the sake of correct Cert-Checking   *"
echo "*******************************************"
echo "Generating certificate request .. "
/usr/bin/openssl req -new -config ssl.cnf -out psybnc.req.pem \
     	-keyout psybnc.key.pem -nodes
echo "Generating self-signed certificate .. "
/usr/bin/openssl req -x509 -days 365 -in psybnc.req.pem \
     	-key psybnc.key.pem -out psybnc.cert.pem
echo "Generating fingerprint .."
/usr/bin/openssl x509 -subject -dates -fingerprint -noout \
	-in psybnc.cert.pem

cp psybnc.cert.pem /etc/psybnc/key/
cp psybnc.key.pem /etc/psybnc/key/
