#!/bin/sh
# simple howto
if [ $# -eq 0 ] ; then
    echo $"Usage: `basename $0` <FQDN>"
    exit 0
fi
#
# _PRIVATE_ key
KEY_NAME=CFEngine-Enterprise
FQDN=$1
test -e $KEY_NAME.key.pem || openssl genrsa -out $KEY_NAME.key.pem 2048 > /dev/null 2>&1
#
openssl req -key $KEY_NAME.key.pem -utf8 -x509 -new -days 3650 -out $KEY_NAME.crt.pem > /dev/null 2>&1 <<EOF
US
CA
Mountain View
CFEngine Inc.
CFEngine Enterprise
${FQDN}
contact@cfengine.com
EOF

(openssl x509 -noout -modulus -in $KEY_NAME.crt.pem | openssl md5 ;\
openssl rsa -noout -modulus -in $KEY_NAME.key.pem | openssl md5) | uniq

