1 |
#!/bin/sh |
#!/bin/sh |
2 |
# $Header: /root/magellan-cvs/src/openssl/openssl-make-certs.sh,v 1.2 2010-03-04 12:50:39 niro Exp $ |
# $Header: /root/magellan-cvs/src/openssl/openssl-make-certs.sh,v 1.3 2010-03-04 15:49:23 niro Exp $ |
3 |
|
|
4 |
SSLDIR="${SSLDIR-/etc/ssl}" |
SSLDIR="${SSLDIR-/etc/ssl}" |
5 |
SSLCONFIG="${SSLCONFIG-${SSLDIR}/openssl.cnf}" |
SSLCONFIG="${SSLCONFIG-${SSLDIR}/openssl.cnf}" |
38 |
|
|
39 |
openssl req -new -x509 -nodes -config ${SSLCONFIG} -out ${CERTFILE} -keyout ${KEYFILE} -days 365 || die "Certificate request failed!" |
openssl req -new -x509 -nodes -config ${SSLCONFIG} -out ${CERTFILE} -keyout ${KEYFILE} -days 365 || die "Certificate request failed!" |
40 |
# combine cert and keyfile to one cert |
# combine cert and keyfile to one cert |
41 |
cat ${CERTFILE} ${KEYFILE} > ${CERTFILE} || die "Combine failed!" |
cat ${CERTFILE} ${KEYFILE} > ${CERTFILE}.combined || die "Combine [cat] failed!" |
42 |
|
rm ${CERTFILE} || die "Combine [rm] failed!" |
43 |
|
mv ${CERTFILE}{.combined,} || die "Combine [mv] failed!" |
44 |
chown root:root ${CERTFILE} ${KEYFILE} || die "Ownership failed!" |
chown root:root ${CERTFILE} ${KEYFILE} || die "Ownership failed!" |
45 |
chmod 0400 ${CERTFILE} ${KEYFILE} || die "Permissions failed!" |
chmod 0400 ${CERTFILE} ${KEYFILE} || die "Permissions failed!" |
46 |
echo |
echo |