bf760f
#!/bin/sh
bf760f
umask 077
bf760f
bf760f
answers() {
bf760f
	echo --
bf760f
	echo SomeState
bf760f
	echo SomeCity
bf760f
	echo SomeOrganization
bf760f
	echo SomeOrganizationalUnit
bf760f
	echo localhost.localdomain
bf760f
	echo root@localhost.localdomain
bf760f
}
bf760f
bf760f
if [ $# -eq 0 ] ; then
bf760f
	echo $"Usage: `basename $0` filename [...]"
bf760f
	exit 0
bf760f
fi
bf760f
bf760f
for target in $@ ; do
bf760f
	PEM1=`/bin/mktemp /tmp/openssl.XXXXXX`
bf760f
	PEM2=`/bin/mktemp /tmp/openssl.XXXXXX`
bf760f
	trap "rm -f $PEM1 $PEM2" SIGINT
bf760f
	answers | /usr/bin/openssl req -newkey rsa:2048 -keyout $PEM1 -nodes -x509 -days 365 -out $PEM2 2> /dev/null
bf760f
	cat $PEM1 >  ${target}
bf760f
	echo ""   >> ${target}
bf760f
	cat $PEM2 >> ${target}
bf760f
	rm -f $PEM1 $PEM2
bf760f
done