]> WPIA git - gigi.git/blobdiff - keys/generateKeys.sh
Make default name in generateKeys.sh configurable
[gigi.git] / keys / generateKeys.sh
index 48111cc18bfd95106bf54ee188568cea7d92b5ba..f0c2649220048f0efa8cf0f712bf1ef890d7c256 100755 (executable)
@@ -1,9 +1,13 @@
-#!/bin/sh
+#!/bin/bash
 # this script generates a set of sample keys
+DOMAIN="cacert.local"
+KEYSIZE=4096
+[ -f config ] && . config
+
 
 rm -Rf *.csr *.crt *.key *.pkcs12 testca
 
-openssl genrsa -out testca.key 4096
+openssl genrsa -out testca.key ${KEYSIZE}
 openssl req -new -key testca.key -out testca.csr -subj "/CN=local cacert-gigi testCA" -config selfsign.config
 openssl x509 -req -days 365 -in testca.csr -signkey testca.key -out testca.crt
 
@@ -15,8 +19,8 @@ echo unique_subject = no >testca/db.attr
 
 genserver(){
 
-openssl genrsa -out $1.key 4096
-openssl req -new -key $1.key -out $1.csr -subj "/CN=$1.cacert.local" -config selfsign.config
+openssl genrsa -out $1.key ${KEYSIZE}
+openssl req -new -key $1.key -out $1.csr -subj "/CN=$1.${DOMAIN}" -config selfsign.config
 openssl ca -cert testca.crt -keyfile testca.key -in $1.csr -out $1.crt -days 356 -batch -config selfsign.config
 
 openssl pkcs12 -inkey $1.key -in $1.crt -name $1 -export -passout pass:changeit -out $1.pkcs12