From: Felix Dörre Date: Tue, 8 Jul 2014 21:37:04 +0000 (+0200) Subject: Make default name in generateKeys.sh configurable X-Git-Url: https://code.wpia.club/?p=gigi.git;a=commitdiff_plain;h=f9690dc20a342802275d70e088b34dfa8e8868b3 Make default name in generateKeys.sh configurable --- diff --git a/keys/.gitignore b/keys/.gitignore index b2c4532a..9fe39e3e 100644 --- a/keys/.gitignore +++ b/keys/.gitignore @@ -6,3 +6,4 @@ testca csr crt testca.crl +config diff --git a/keys/generateKeys.sh b/keys/generateKeys.sh index 48111cc1..f0c26492 100755 --- a/keys/generateKeys.sh +++ b/keys/generateKeys.sh @@ -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