1109998Smarkm#!/bin/sh 255714Skris 355714Skris# This script will re-make all the required certs. 455714Skris# cd apps 555714Skris# sh ../util/mkcerts.sh 655714Skris# mv ca-cert.pem pca-cert.pem ../certs 755714Skris# cd .. 855714Skris# cat certs/*.pem >>apps/server.pem 955714Skris# cat certs/*.pem >>apps/server2.pem 1055714Skris# SSLEAY=`pwd`/apps/ssleay; export SSLEAY 1155714Skris# sh tools/c_rehash certs 1255714Skris# 1355714Skris 1455714SkrisCAbits=1024 15109998SmarkmSSLEAY="../apps/openssl" 16109998SmarkmCONF="-config ../apps/openssl.cnf" 1755714Skris 1855714Skris# create pca request. 1955714Skrisecho creating $CAbits bit PCA cert request 2055714Skris$SSLEAY req $CONF \ 2155714Skris -new -md5 -newkey $CAbits \ 2255714Skris -keyout pca-key.pem \ 2355714Skris -out pca-req.pem -nodes >/dev/null <<EOF 2455714SkrisAU 2555714SkrisQueensland 2655714Skris. 2755714SkrisCryptSoft Pty Ltd 2855714Skris. 2955714SkrisTest PCA (1024 bit) 3055714Skris 3155714Skris 3255714Skris 3355714SkrisEOF 3455714Skris 3555714Skrisif [ $? != 0 ]; then 3655714Skris echo problems generating PCA request 3755714Skris exit 1 3855714Skrisfi 3955714Skris 4055714Skris#sign it. 4155714Skrisecho 4255714Skrisecho self signing PCA 4355714Skris$SSLEAY x509 -md5 -days 1461 \ 4455714Skris -req -signkey pca-key.pem \ 4555714Skris -CAcreateserial -CAserial pca-cert.srl \ 4655714Skris -in pca-req.pem -out pca-cert.pem 4755714Skris 4855714Skrisif [ $? != 0 ]; then 4955714Skris echo problems self signing PCA cert 5055714Skris exit 1 5155714Skrisfi 5255714Skrisecho 5355714Skris 5455714Skris# create ca request. 5555714Skrisecho creating $CAbits bit CA cert request 5655714Skris$SSLEAY req $CONF \ 5755714Skris -new -md5 -newkey $CAbits \ 5855714Skris -keyout ca-key.pem \ 5955714Skris -out ca-req.pem -nodes >/dev/null <<EOF 6055714SkrisAU 6155714SkrisQueensland 6255714Skris. 6355714SkrisCryptSoft Pty Ltd 6455714Skris. 6555714SkrisTest CA (1024 bit) 6655714Skris 6755714Skris 6855714Skris 6955714SkrisEOF 7055714Skris 7155714Skrisif [ $? != 0 ]; then 7255714Skris echo problems generating CA request 7355714Skris exit 1 7455714Skrisfi 7555714Skris 7655714Skris#sign it. 7755714Skrisecho 7855714Skrisecho signing CA 7955714Skris$SSLEAY x509 -md5 -days 1461 \ 8055714Skris -req \ 8155714Skris -CAcreateserial -CAserial pca-cert.srl \ 8255714Skris -CA pca-cert.pem -CAkey pca-key.pem \ 8355714Skris -in ca-req.pem -out ca-cert.pem 8455714Skris 8555714Skrisif [ $? != 0 ]; then 8655714Skris echo problems signing CA cert 8755714Skris exit 1 8855714Skrisfi 8955714Skrisecho 9055714Skris 9155714Skris# create server request. 9255714Skrisecho creating 512 bit server cert request 9355714Skris$SSLEAY req $CONF \ 9455714Skris -new -md5 -newkey 512 \ 9555714Skris -keyout s512-key.pem \ 9655714Skris -out s512-req.pem -nodes >/dev/null <<EOF 9755714SkrisAU 9855714SkrisQueensland 9955714Skris. 10055714SkrisCryptSoft Pty Ltd 10155714Skris. 10255714SkrisServer test cert (512 bit) 10355714Skris 10455714Skris 10555714Skris 10655714SkrisEOF 10755714Skris 10855714Skrisif [ $? != 0 ]; then 10955714Skris echo problems generating 512 bit server cert request 11055714Skris exit 1 11155714Skrisfi 11255714Skris 11355714Skris#sign it. 11455714Skrisecho 11555714Skrisecho signing 512 bit server cert 11655714Skris$SSLEAY x509 -md5 -days 365 \ 11755714Skris -req \ 11855714Skris -CAcreateserial -CAserial ca-cert.srl \ 11955714Skris -CA ca-cert.pem -CAkey ca-key.pem \ 12055714Skris -in s512-req.pem -out server.pem 12155714Skris 12255714Skrisif [ $? != 0 ]; then 12355714Skris echo problems signing 512 bit server cert 12455714Skris exit 1 12555714Skrisfi 12655714Skrisecho 12755714Skris 12855714Skris# create 1024 bit server request. 12955714Skrisecho creating 1024 bit server cert request 13055714Skris$SSLEAY req $CONF \ 13155714Skris -new -md5 -newkey 1024 \ 13255714Skris -keyout s1024key.pem \ 13355714Skris -out s1024req.pem -nodes >/dev/null <<EOF 13455714SkrisAU 13555714SkrisQueensland 13655714Skris. 13755714SkrisCryptSoft Pty Ltd 13855714Skris. 13955714SkrisServer test cert (1024 bit) 14055714Skris 14155714Skris 14255714Skris 14355714SkrisEOF 14455714Skris 14555714Skrisif [ $? != 0 ]; then 14655714Skris echo problems generating 1024 bit server cert request 14755714Skris exit 1 14855714Skrisfi 14955714Skris 15055714Skris#sign it. 15155714Skrisecho 15255714Skrisecho signing 1024 bit server cert 15355714Skris$SSLEAY x509 -md5 -days 365 \ 15455714Skris -req \ 15555714Skris -CAcreateserial -CAserial ca-cert.srl \ 15655714Skris -CA ca-cert.pem -CAkey ca-key.pem \ 15755714Skris -in s1024req.pem -out server2.pem 15855714Skris 15955714Skrisif [ $? != 0 ]; then 16055714Skris echo problems signing 1024 bit server cert 16155714Skris exit 1 16255714Skrisfi 16355714Skrisecho 16455714Skris 16555714Skris# create 512 bit client request. 16655714Skrisecho creating 512 bit client cert request 16755714Skris$SSLEAY req $CONF \ 16855714Skris -new -md5 -newkey 512 \ 16955714Skris -keyout c512-key.pem \ 17055714Skris -out c512-req.pem -nodes >/dev/null <<EOF 17155714SkrisAU 17255714SkrisQueensland 17355714Skris. 17455714SkrisCryptSoft Pty Ltd 17555714Skris. 17655714SkrisClient test cert (512 bit) 17755714Skris 17855714Skris 17955714Skris 18055714SkrisEOF 18155714Skris 18255714Skrisif [ $? != 0 ]; then 18355714Skris echo problems generating 512 bit client cert request 18455714Skris exit 1 18555714Skrisfi 18655714Skris 18755714Skris#sign it. 18855714Skrisecho 18955714Skrisecho signing 512 bit client cert 19055714Skris$SSLEAY x509 -md5 -days 365 \ 19155714Skris -req \ 19255714Skris -CAcreateserial -CAserial ca-cert.srl \ 19355714Skris -CA ca-cert.pem -CAkey ca-key.pem \ 19455714Skris -in c512-req.pem -out client.pem 19555714Skris 19655714Skrisif [ $? != 0 ]; then 19755714Skris echo problems signing 512 bit client cert 19855714Skris exit 1 19955714Skrisfi 20055714Skris 20155714Skrisecho cleanup 20255714Skris 20355714Skriscat pca-key.pem >> pca-cert.pem 20455714Skriscat ca-key.pem >> ca-cert.pem 20555714Skriscat s512-key.pem >> server.pem 20655714Skriscat s1024key.pem >> server2.pem 20755714Skriscat c512-key.pem >> client.pem 20855714Skris 20955714Skrisfor i in pca-cert.pem ca-cert.pem server.pem server2.pem client.pem 21055714Skrisdo 21155714Skris$SSLEAY x509 -issuer -subject -in $i -noout >$$ 21255714Skriscat $$ 21355714Skris/bin/cat $i >>$$ 21455714Skris/bin/mv $$ $i 21555714Skrisdone 21655714Skris 21755714Skris#/bin/rm -f *key.pem *req.pem *.srl 21855714Skris 21955714Skrisecho Finished 22055714Skris 221