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