changeset 338:6c3ca941f836

Added a 'ship' command
author Sebastien Decugis <sdecugis@nict.go.jp>
date Tue, 22 Jun 2010 17:22:50 +0900
parents 660208ca0e54
children ba59301627b9
files contrib/PKI/ca_script2/Makefile
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/PKI/ca_script2/Makefile	Tue Jun 22 14:58:46 2010 +0900
+++ b/contrib/PKI/ca_script2/Makefile	Tue Jun 22 17:22:50 2010 +0900
@@ -33,6 +33,8 @@
        Creates a new sub-CA that can be used for certificates later.\n\
    make newcert name=foo ca=parentca\n\
        Create private key and csr, then issue the certificate (named foo.*)\n\
+   make ship name=foo ca=parentca\n\
+       Create an archive with the data for the client\n\
    make revoke name=foo ca=parentca\n\
        Revokes the certificate foo.cert issued by parentca and regenerates the CRL.\n\
    make gencrl ca=caname\n\
@@ -133,6 +135,15 @@
 	@ln -sf ../../public/crl $(DATA_DIR)/$(ca)/clients/$(name)/crl
 	@ln -sf ../../public/caroot.pem $(DATA_DIR)/$(ca)/clients/$(name)/ca.pem
 
+# Create an archive to send the data to the client node
+ship:
+	@if [ -z "$(name)" -o -z "$(ca)" ]; then echo "Missing parameter. Ex: make ship name=service.testbed.aaa ca=ca.testbed.aaa"; exit 1; fi
+	@if [ ! -e $(DATA_DIR)/$(ca)/private/cakey.pem ]; then echo "The parent CA $(ca) does not exist."; exit 1; fi
+	@if [ ! -e  $(DATA_DIR)/$(ca)/clients/$(name)/privkey.pem ]; then echo "The client $(name) does not exist, use 'make newcert' first."; exit 1; fi
+	# Ship the data
+	@tar -c -C $(DATA_DIR)/$(ca)/clients/$(name) -z -f $(ca)_$(name).tar.gz -h .
+	@echo "The files have been packaged into archive: $(ca)_$(name).tar.gz"
+
 # Revoke a certificate
 revoke:
 	@if [ -z "$(name)" -o -z "$(ca)" ]; then echo "Missing parameter. Ex: make revoke name=service.testbed.aaa ca=ca.testbed.aaa"; exit 1; fi
"Welcome to our mercurial repository"