1 |
#!/bin/sh |
2 |
umask 077 |
3 |
|
4 |
answers() { |
5 |
echo -- |
6 |
echo SomeState |
7 |
echo SomeCity |
8 |
echo SomeOrganization |
9 |
echo SomeOrganizationalUnit |
10 |
echo localhost.localdomain |
11 |
echo root@localhost.localdomain |
12 |
} |
13 |
|
14 |
if [ $# -eq 0 ] ; then |
15 |
echo $"Usage: `basename $0` filename [...]" |
16 |
exit 0 |
17 |
fi |
18 |
|
19 |
for target in $@ ; do |
20 |
PEM1=`/bin/mktemp /tmp/openssl.XXXXXX` |
21 |
PEM2=`/bin/mktemp /tmp/openssl.XXXXXX` |
22 |
trap "rm -f $PEM1 $PEM2" SIGINT |
23 |
answers | /usr/bin/openssl req -newkey rsa:1024 -keyout $PEM1 -nodes -x509 -days 365 -out $PEM2 2> /dev/null |
24 |
cat $PEM1 > ${target} |
25 |
echo "" >> ${target} |
26 |
cat $PEM2 >> ${target} |
27 |
rm -f $PEM1 $PEM2 |
28 |
done |