Skip to content

Instantly share code, notes, and snippets.

@kuniyoshi
Last active December 27, 2015 22:09
Show Gist options
  • Save kuniyoshi/7397520 to your computer and use it in GitHub Desktop.
Save kuniyoshi/7397520 to your computer and use it in GitHub Desktop.
Generate self certificated ssl cry. *NOTE*: this file includes `tab`, and `make` will fail when it has been changed `white space`.
.PHONY: all install
SERVER=purasi-bo.me
all: $(SERVER).key $(SERVER).csr $(SERVER).crt install
###
### *NOTE*
### When use this via copy and paste, care command line should starts `tab`.
###
$(SERVER).key:
openssl genrsa -rand /dev/random -des3 -out $@ 2048
$(SERVER).csr: $(SERVER).key
openssl req -new -key $< -out $@
$(SERVER).crt: $(SERVER).csr $(SERVER).key
openssl x509 -req -days 365 -in $(SERVER).csr -signkey $(SERVER).key -out $@
install:
openssl rsa <$(SERVER).key >$(SERVER).key.embedded
mv $(SERVER).key.embedded $(SERVER).key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment