summaryrefslogtreecommitdiff
path: root/openssl-freefilesync/make-dummy-cert
blob: f5f04535794703a747c539ed22f11386e06ce0b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
umask 077

answers() {
	echo --
	echo SomeState
	echo SomeCity
	echo SomeOrganization
	echo SomeOrganizationalUnit
	echo localhost.localdomain
	echo root@localhost.localdomain
}

if [ $# -eq 0 ] ; then
	echo $"Usage: `basename $0` filename [...]"
	exit 0
fi

for target in $@ ; do
	PEM1=`/bin/mktemp /tmp/openssl.XXXXXX`
	PEM2=`/bin/mktemp /tmp/openssl.XXXXXX`
	trap "rm -f $PEM1 $PEM2" SIGINT
	answers | /usr/bin/openssl req -newkey rsa:2048 -keyout $PEM1 -nodes -x509 -days 365 -out $PEM2 2> /dev/null
	cat $PEM1 >  ${target}
	echo ""   >> ${target}
	cat $PEM2 >> ${target}
	rm -f $PEM1 $PEM2
done
bgstack15