Comparison

certs/Makefile @ 7028:7d0ce5e6a6d3

certs/Makefile: Add targets for any combination of already existing config, key file
author Kim Alvefur <zash@zash.se>
date Wed, 23 Dec 2015 12:10:26 +0100
parent 5293:fe9215155453
child 7031:89221daefae9
comparison
equal deleted inserted replaced
7027:77d838ba91c6 7028:7d0ce5e6a6d3
13 13
14 .PRECIOUS: %.cnf %.key 14 .PRECIOUS: %.cnf %.key
15 15
16 # To request a cert 16 # To request a cert
17 %.csr: %.cnf %.key 17 %.csr: %.cnf %.key
18 openssl req -new -key $(lastword $^) -out $@ -utf8 -config $(firstword $^) 18 openssl req -new -key $(lastword $^) \
19 -sha256 -utf8 -config $(firstword $^) -out $@
20
21 %.csr: %.cnf
22 umask 0077 && touch $*.key
23 openssl req -new -newkey rsa:$(keysize) -nodes -keyout $*.key \
24 -sha256 -utf8 -config $^ -out $@
25 @chmod 400 $*.key -c
26
27 %.csr: %.key
28 openssl req -new -key $^ -utf8 -subj /CN=$* -out $@
29
30 %.csr:
31 umask 0077 && touch $*.key
32 openssl req -new -newkey rsa:$(keysize) -nodes -keyout $*.key \
33 -utf8 -subj /CN=$* -out $@
34 @chmod 400 $*.key -c
19 35
20 # Self signed 36 # Self signed
21 %.crt: %.cnf %.key 37 %.crt: %.cnf %.key
22 openssl req -new -x509 -nodes -key $(lastword $^) -days 365 \ 38 openssl req -new -x509 -key $(lastword $^) -days 365 -sha256 -utf8 \
23 -sha1 -out $@ -utf8 -config $(firstword $^) 39 -config $(firstword $^) -out $@
24 40
41 %.crt: %.cnf
42 umask 0077 && touch $*.key
43 openssl req -new -x509 -newkey rsa:$(keysize) -nodes -keyout $*.key \
44 -days 365 -sha256 -utf8 -config $(firstword $^) -out $@
45 @chmod 400 $*.key -c
46
47 %.crt: %.key
48 openssl req -new -x509 -nodes -key $^ -days 365 \
49 -sha256 -out $@ -utf8 -config $(firstword $^)
50
51 %.crt:
52 umask 0077 && touch $*.key
53 openssl req -new -x509 -newkey rsa:$(keysize) -nodes -keyout $*.key \
54 -days 365 -sha256 -out $@ -utf8 -subj /CN=$*
55 @chmod 400 $*.key -c
56
57 # Generate a config from the example
25 %.cnf: 58 %.cnf:
26 sed 's,example\.com,$*,g' openssl.cnf > $@ 59 sed 's,example\.com,$*,g' openssl.cnf > $@
27 60
28 %.key: 61 %.key:
29 openssl genrsa $(keysize) > $@ 62 openssl genrsa $(keysize) > $@