]> WPIA git - nre.git/commitdiff
upd: extract Distinguished Name fields, document config
authorLucas Werkmeister <mail@lucaswerkmeister.de>
Thu, 23 Mar 2017 21:44:34 +0000 (22:44 +0100)
committerLucas Werkmeister <mail@lucaswerkmeister.de>
Thu, 23 Mar 2017 21:44:34 +0000 (22:44 +0100)
Change-Id: I5d838b9c82a306ad2c3b62c865282e5fdec5ecc2

README.md
commonFunctions.bash
config.example [new file with mode: 0644]
generateKeys
structure.bash

index 17c385252e18c7c26c3562cf555b355e7edfdc1c..1b03c3d3e5eaed94116026d38c2f8df97c57d9c3 100644 (file)
--- a/README.md
+++ b/README.md
@@ -4,6 +4,9 @@ This project is a collection of shell scripts to generate X.509 certificates sui
 It is usually used in conjunction with *Cassiopeia* and *Gigi*.
 
 To generate a root certificate and all intermediate certificates for the years 2017 and 2018, run `./all root 2017 2018`.
+To adjust the settings of the certificates (organization name, domain name, …),
+create a `config` file and set the appropriate variables;
+the `config.example` file documents the available variables.
 
 ## Overview of Generating Shell Scripts
 
index 36ffa19fad613285b80585cc1a3f0f39fe278020..a433fbea71e3158793cdf9bf22f0704c9b1d260d 100644 (file)
@@ -3,7 +3,7 @@
 
 genKey(){ #subj, internalName
     openssl genrsa -out $2.key ${KEYSIZE}
-    openssl req -new -key $2.key -out $2.csr -subj "$1/O=Test Environment CA Ltd./OU=Test Environment CAs/C=AU"
+    openssl req -new -key $2.key -out $2.csr -subj "$1/O=$ORGANIZATION/OU=$ORGANIZATIONAL_UNIT/C=$COUNTRY"
 
 }
 
@@ -49,4 +49,3 @@ findLibfaketime() {
     printf >&2 'error: no libfaketime found\n'
     exit 1 # unfortunately, this will only exit the $() subshell
 }
-
diff --git a/config.example b/config.example
new file mode 100644 (file)
index 0000000..4a90b6e
--- /dev/null
@@ -0,0 +1,7 @@
+# You can adjust the following variables:
+# APPNAME="Your CA name" # used in the Common Name (CN=) of all certificates
+# DOMAIN="example.com" # the main domain of your CA
+# ORGANIZATION="Your Organization Name" # legal name of your organization, the O= of all certificates
+# ORGANIZATIONAL_UNIT="Your Organizational Unit" # name of your organizational unit, the OU= of all certificates
+# COUNTRY="AT" # the country of your organization, the C= of all certificates
+# KEYSIZE=4096 # default is probably fine
index 956e4fdd1faae9ea7fff6d958c32870f35c5701a..09a93ba930b65a33d95e80d4f640fa3ffa9ea1eb 100755 (executable)
@@ -51,18 +51,15 @@ TESTCA
 
 
 # Generate the super Root CA
-genca "/CN=Gigi testCA" root
+genca "/CN=$APPNAME Root Certificate" root
 #echo openssl x509 -req $ROOT_VALIDITY -in root.ca/key.csr -signkey root.ca/key.key -out root.ca/key.crt -extfile ca.cnf
 rootSign root
 
 # generate the various sub-CAs
 for ca in "${STRUCT_CAS[@]}"; do
     . ../CAs/$ca
-    genca "/CN=$name" $ca
+    genca "/CN=$APPNAME $name Intermediate Certificate" $ca
     rootSign $ca
 done
 
 rm ca.cnf subca.cnf
-
-
-
index c88e3c6cd11e2bf548cbf4caf4a2450e17a4cb37..90a89c0139a03d83454e700fea7317d60c9000c9 100644 (file)
@@ -1,7 +1,10 @@
 #!/bin/bash
+APPNAME="SomeCA"
 DOMAIN="wpia.local"
+ORGANIZATION="Test Environment CA Ltd."
+ORGANIZATIONAL_UNIT="Test Environment CAs"
+COUNTRY="AT"
 KEYSIZE=4096
-PRIVATEPW="changeit"
 
 [ -f config ] && . ./config