chiark / gitweb /
bin/setup, lib/func.tcl: Move root key generation into the library.
[ca] / bin / setup
index b0e2226206e1c56f2385b9f94e577e53921c2f4a..723a4c00595144c4276ea3b2f4ff9ec97dd3ec1c 100755 (executable)
--- a/bin/setup
+++ b/bin/setup
@@ -61,18 +61,7 @@ file attributes "state/ca.db.new" \
 
 ## Generate the private CA key.
 make-directories 0750 "private"
 
 ## Generate the private CA key.
 make-directories 0750 "private"
-set subject ""
-foreach {attr value} $C(ca-name) { append subject "/$attr=$value" }
-exec >@stdout 2>@stderr openssl req -config "etc/openssl.conf"  \
-    -text -out "ca.cert" -keyout "private/ca.key" \
-    -new -x509 -days $C(ca-period) \
-    -subj $subject
-file attributes "private/ca.key" \
-    -owner $C(ca-owner) -group $C(ca-group) \
-    -permissions 0640
-file attributes "ca.cert" \
-    -owner $C(ca-owner) -group $C(ca-group) \
-    -permissions 0644
+generate-root-key
 
 ## Set up the directories for the actual certificates.  These are published
 ## by the web server.
 
 ## Set up the directories for the actual certificates.  These are published
 ## by the web server.