CCL Home Page
Up Directory CCL Makefile.txt
.PHONY: usage
.SUFFIXES: .key .csr .crt .pem
.PRECIOUS: %.key %.csr %.crt %.pem

usage:
	@echo "This makefile allows you to create:"
	@echo "  o public/private key pairs"
	@echo "  o SSL certificate signing requests (CSRs)"
	@echo "  o self-signed SSL test certificates"
	@echo
	@echo "To create a key pair, run \"make SOMETHING.key\"."
	@echo "To create a CSR, run \"make SOMETHING.csr\"."
	@echo "To create a test certificate, run \"make SOMETHING.crt\"."
	@echo "To create a key and a test certificate in one file, run \"make SOMETHING.pem\"."
	@echo
	@echo "To create a key for use with Apache, run \"make genkey\"."
	@echo "To create a CSR for use with Apache, run \"make certreq\"."
	@echo "To create a test certificate for use with Apache, run \"make testcert\"."
	@echo
	@echo Examples:
	@echo "  make server.key"
	@echo "  make server.csr"
	@echo "  make server.crt"
	@echo "  make stunnel.pem"
	@echo "  make genkey"
	@echo "  make certreq"
	@echo "  make testcert"

%.pem:
	umask 77 ; \
	PEM1=`cat /tmp/openssl-pem1.$$; touch /tmp/openssl-pem1.$$` ; \
	PEM2=`cat /tmp/openssl-pem2.$$; touch /tmp/openssl-pem2.$$` ; \
	 /usr/freeware/bin/openssl req  -newkey rsa:1024 -keyout $$PEM1 -nodes -x509 -days 365 -out $$PEM2 ; \
	cat $$PEM1 >  $@ ; \
	echo ""    >> $@ ; \
	cat $$PEM2 >> $@ ; \
	$(RM) $$PEM1 $$PEM2

%.key:
	umask 77 ; \
	 /usr/freeware/bin/openssl genrsa  -des3 1024 > $@

%.csr: %.key
	umask 77 ; \
	 /usr/freeware/bin/openssl req  -new -key $^ -out $@

%.crt: %.key
	umask 77 ; \
	 /usr/freeware/bin/openssl req  -new -key $^ -x509 -days 365 -out $@

KEY=/usr/freeware/apache/etc/ssl.key/server.key
CSR=/usr/freeware/apache/etc/ssl.csr/server.csr
CRT=/usr/freeware/apache/etc/ssl.crt/server.crt

genkey: $(KEY)
certreq: $(CSR)
testcert: $(CRT)

$(CSR): $(KEY)
	umask 77 ; \
	 /usr/freeware/bin/openssl req  -new -key $(KEY) -out $(CSR)

$(CRT): $(KEY)
	umask 77 ; \
	 /usr/freeware/bin/openssl req  -new -key $(KEY) -x509 -days 365 -out $(CRT)
Modified: Wed Apr 18 05:32:51 2001 GMT
Page accessed 334 times since Tue Mar 15 10:58:37 2005 GMT