# Example Makefile to assist generating x509 certificates
#
# Copyright (C) 2000-2005 by Johan van Selst (johans@stack.nl)
#
# Please read OpenSSL documentation first unless you know what you're doing
# It will tell you that certificate common name should be the server hostname
#
# Now if you really know what you are doing, type:
#   make -f SSL-Makefile all
#   cp cert.pem key.pem /usr/local/lib/httpd/
#   httpd -s
#
# If you want to generate a certificate request for your https server,
# for signing by a trusted third party (such as CAcert.org), type:
#   make -f SSL-Makefile cert.req
# and submit the resulting 'cert.req' file.


all: cert.pem

ca.pem:
	openssl req -out ca.pem -new -x509

key.pem:
	openssl genrsa -out key.pem -rand 1024

cert.req: key.pem
	openssl req -key key.pem -new -out cert.req

cert.pem: ca.pem cert.req
	openssl x509 -req -in cert.req -CA ca.pem -CAkey privkey.pem -CAcreateserial -days 1000 -out cert.pem

clean:
	rm cert.req cert.pem key.pem
