isaacpittman-hitachi / rpms / openssl

Forked from rpms/openssl 2 years ago
Clone

Blame SOURCES/make-dummy-cert

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