import from branch_1_1:
[freeradius.git] / scripts / certs.sh
1 #!/bin/sh
2 #       $Id$
3
4 #
5 #  Set this variable to the location of your SSL installation.
6 #
7 [ "$SSL" = "" ] && SSL=/usr/local/ssl
8 export SSL
9
10 #
11 #  Don't touch the following text.
12 #
13 [ -d certs ] && rm -rf certs
14 mkdir certs
15 cp xpextensions certs/
16 cd certs
17
18 #
19 # Generate DH stuff...
20 #
21 ${SSL}/bin/openssl gendh > dh
22
23 #
24 #  /dev/urandom is not a file, and we can't rely on "test -e" working
25 #  everywhere.
26 #
27 if ls /dev/urandom >/dev/null 2>&1
28 then
29   dd if=/dev/urandom of=random count=2 >/dev/null 2>&1
30 else
31   echo "Please replace this text with 1k of random data" > random
32 fi
33
34 rm -f CA.log
35 ../CA.certs > CA.log 2>&1
36 if [ "$?" != "0" ]
37 then
38     echo "  Certificate creation failed."
39     echo "  Please see the 'CA.log' file for messages,"
40     echo "  or read the 'CA.all' script, and run it by hand."
41     echo
42     echo "  Sorry."
43     exit 1
44 fi
45 echo "  See the 'certs' directory for the certificates."
46 echo "  The 'certs' directory should be copied to .../etc/raddb/"
47 echo "  All passwords have been set to 'whatever'"
48 rm -f CA.log xpextensions
49 exit 0