Rev 4 | Blame | Compare with Previous | Last modification | View Log | RSS feed
#!/bin/sh## This is a wrapper script to create default certificates when the# server first starts in debugging mode. Once the certificates have been# created, this file should be deleted.## Ideally, this program should be run as part of the installation of any# binary package. The installation should also ensure that the permissions# and owners are correct for the files generated by this script.## $Id: e70b506b5c7c3e3105e568d6a4c6334683f2e764 $#umask 027cd `dirname $0`make -h > /dev/null 2>&1## If we have a working "make", then use it. Otherwise, run the commands# manually.#if [ "$?" = "0" ]; thenmake allexit $?fi## The following commands were created by running "make -n", and edited# to remove the trailing backslash, and to add "exit 1" after the commands.## Don't edit the following text. Instead, edit the Makefile, and# re-generate these commands.#if [ ! -f dh ]; thenopenssl dhparam -out dh 1024 || exit 1if [ -e /dev/urandom ] ; thendd if=/dev/urandom of=./random count=10 >/dev/null 2>&1;elsedate > ./random;fifiif [ ! -f server.key ]; thenopenssl req -new -out server.csr -keyout server.key -config ./server.cnf || exit 1fiif [ ! -f ca.key ]; thenopenssl req -new -x509 -keyout ca.key -out ca.pem -days `grep default_days ca.cnf | sed 's/.*=//;s/^ *//'` -config ./ca.cnf || exit 1fiif [ ! -f index.txt ]; thentouch index.txtfiif [ ! -f serial ]; thenecho '01' > serialfiif [ ! -f server.crt ]; thenopenssl ca -batch -keyfile ca.key -cert ca.pem -in server.csr -key `grep output_password ca.cnf | sed 's/.*=//;s/^ *//'` -out server.crt -extensions xpserver_ext -extfile xpextensions -config ./server.cnf || exit 1fiif [ ! -f server.p12 ]; thenopenssl pkcs12 -export -in server.crt -inkey server.key -out server.p12 -passin pass:`grep output_password server.cnf | sed 's/.*=//;s/^ *//'` -passout pass:`grep output_password server.cnf | sed 's/.*=//;s/^ *//'` || exit 1fiif [ ! -f server.pem ]; thenopenssl pkcs12 -in server.p12 -out server.pem -passin pass:`grep output_password server.cnf | sed 's/.*=//;s/^ *//'` -passout pass:`grep output_password server.cnf | sed 's/.*=//;s/^ *//'` || exit 1openssl verify -CAfile ca.pem server.pem || exit 1fiif [ ! -f ca.der ]; thenopenssl x509 -inform PEM -outform DER -in ca.pem -out ca.der || exit 1fiif [ ! -f client.key ]; thenopenssl req -new -out client.csr -keyout client.key -config ./client.cnffiif [ ! -f client.crt ]; thenopenssl ca -batch -keyfile ca.key -cert ca.pem -in client.csr -key `grep output_password ca.cnf | sed 's/.*=//;s/^ *//'` -out client.crt -extensions xpclient_ext -extfile xpextensions -config ./client.cnffi