diff options
author | Magnus Ahltorp <map@kth.se> | 2015-03-31 15:23:12 +0200 |
---|---|---|
committer | Magnus Ahltorp <map@kth.se> | 2015-03-31 15:23:12 +0200 |
commit | 064556bd0e531c71dd285de372312d2851abf29f (patch) | |
tree | 94b6e41e85d3a152f284b32b0631512124e53bff /Makefile | |
parent | 6b62ebbf1de5b9e55b04e9cfafd0620f1374c2d4 (diff) |
X.509 cert generation for http server
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 28 |
1 files changed, 27 insertions, 1 deletions
@@ -9,13 +9,14 @@ release: all mkdir $(RELDIR) ./makerelease.erl mkdir $(RELDIR)/catlfish - cp -r webroot $(RELDIR)/catlfish -include test/test.mk tests-prepare: rm -r $(RELDIR)/tests || true mkdir $(RELDIR)/tests + make tests-createca + make tests-createcert mkdir $(RELDIR)/tests/keys (cd $(RELDIR)/tests/keys ; ../../../tools/create-key.sh logkey) mkdir $(RELDIR)/tests/mergedb @@ -90,6 +91,31 @@ tests: @make tests-wait @make tests-stop +tests-createca: + mkdir $(RELDIR)/tests/httpsca + ( cd $(RELDIR)/tests/httpsca ; \ + mkdir -p demoCA/newcerts ; \ + touch demoCA/index.txt ; \ + echo 00 > demoCA/serial ; \ + echo '[ req ]' > caconfig.txt ; \ + echo 'distinguished_name = req_distinguished_name' >> caconfig.txt ; \ + echo 'x509_extensions = v3_ca' >> caconfig.txt ; \ + echo '[ req_distinguished_name ]' >> caconfig.txt ; \ + echo '[ v3_ca ]' >> caconfig.txt ; \ + echo 'basicConstraints=CA:true' >> caconfig.txt ; \ + openssl req -newkey rsa:2048 -keyout key.pem -out req.csr -nodes -subj '/countryName=SE/stateOrProvinceName=Stockholm/organizationName=Test/commonName=ca/O=ca' -config caconfig.txt ; \ + openssl ca -in req.csr -selfsign -keyfile key.pem -out demoCA/cacert.pem -batch \ + ) + +tests-createcert: + mkdir $(RELDIR)/tests/httpscert + openssl req -new -newkey rsa:2048 -keyout $(RELDIR)/tests/httpscert/httpskey-1.pem -out $(RELDIR)/tests/httpsca/httpscert-1.csr -nodes -subj '/countryName=SE/stateOrProvinceName=Stockholm/organizationName=Test/CN=localhost' + ( cd $(RELDIR)/tests/httpsca ; \ + openssl ca -in httpscert-1.csr -keyfile key.pem -out httpscert-1.pem -batch \ + ) + cp $(RELDIR)/tests/httpsca/httpscert-1.pem $(RELDIR)/tests/httpscert/ + + # Unit testing. check: all test/check.erl |