Subversion Repositories ALCASAR

Rev

Rev 1 | Rev 40 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 1 Rev 5
Line 22... Line 22...
22
CACERT_LIFETIME="1460"
22
CACERT_LIFETIME="1460"
23
SRVCERT_LIFETIME="1460"
23
SRVCERT_LIFETIME="1460"
24
COUNTRY="FR"
24
COUNTRY="FR"
25
PROVINCE="none"
25
PROVINCE="none"
26
LOCATION="Paris"
26
LOCATION="Paris"
27
ORGANIZATION="ALCASAR"
27
ORGANIZATION="ALCASAR-Team"
28
 
28
 
29
mkdir $DIR_TMP || exit 1
29
mkdir $DIR_TMP || exit 1
30
# dynamic conf file for openssl
30
# dynamic conf file for openssl
31
cat <<EOF >$DIR_TMP/ssl.conf
31
cat <<EOF >$DIR_TMP/ssl.conf
32
RANDFILE		= $HOME/.rnd
32
RANDFILE		= $HOME/.rnd
Line 183... Line 183...
183
CAMAIL=ca@$hostname
183
CAMAIL=ca@$hostname
184
SRVMAIL=apache@$hostname
184
SRVMAIL=apache@$hostname
185
 
185
 
186
echo 01 > $DIR_TMP/serial
186
echo 01 > $DIR_TMP/serial
187
touch $DIR_TMP/index.txt
187
touch $DIR_TMP/index.txt
188
# Don't create CA when update
-
 
189
if [ "$1" != "update" ]
-
 
190
then
188
 
191
	# CA key
189
# CA key
192
	rm -f $CAKEY
190
rm -f $CAKEY
193
	echo "*********CAKEY*********" > $DIR_TMP/openssl-log
191
echo "*********CAKEY*********" > $DIR_TMP/openssl-log
194
	openssl genrsa -out $CAKEY  1024 2>> $DIR_TMP/openssl-log
192
openssl genrsa -out $CAKEY  1024 2>> $DIR_TMP/openssl-log
195
 
193
 
196
	# CA certificate
194
# CA certificate
197
	rm -f $CACERT
195
rm -f $CACERT
198
	echo "*********CACERT*********" >> $DIR_TMP/openssl-log
196
echo "*********CACERT*********" >> $DIR_TMP/openssl-log
199
	echo "$COUNTRY
197
echo "$COUNTRY
200
$PROVINCE
198
$PROVINCE
201
$LOCATION
199
$LOCATION
202
$ORGANIZATION
200
$ORGANIZATION
203
Certification Authority for $hostname
201
Certification Authority for $hostname
204
$hostname
202
ALCASAR-local-CA
205
$CAMAIL" |
203
$CAMAIL" |
206
	openssl req -config $DIR_TMP/ssl.conf -new -x509 -days $CACERT_LIFETIME -key $CAKEY -out $CACERT 2>> $DIR_TMP/openssl-log
204
	openssl req -config $DIR_TMP/ssl.conf -new -x509 -days $CACERT_LIFETIME -key $CAKEY -out $CACERT 2>> $DIR_TMP/openssl-log
207
fi
205
 
208
# Server key
206
# Server key
209
rm -f $SRVKEY	
207
rm -f $SRVKEY	
210
echo "*********SRVKEY*********" >> $DIR_TMP/openssl-log
208
echo "*********SRVKEY*********" >> $DIR_TMP/openssl-log
211
openssl genrsa -out $SRVKEY 1024 2>> $DIR_TMP/openssl-log
209
openssl genrsa -out $SRVKEY 1024 2>> $DIR_TMP/openssl-log
212
 
210