1 .DEFAULT
: localhost.crt
5 # First, `make yourhost.cnf` which creates a openssl config file.
6 # Then edit this file and fill in the details you want it to have,
7 # and add or change hosts and components it should cover.
8 # Then `make yourhost.key` to create your private key, you can
9 # include keysize=number to change the size of the key.
10 # Then you can either `make yourhost.csr` to generate a certificate
11 # signing request that you can submit to a CA, or `make yourhost.crt`
12 # to generate a self signed certificate.
14 .PRECIOUS
: %.cnf
%.key
18 openssl req
-new
-key
$(lastword
$^
) \
19 -sha256
-utf8
-config
$(firstword $^
) -out
$@
22 umask
0077 && touch
$*.key
23 openssl req
-new
-newkey rsa
:$(keysize
) -nodes
-keyout
$*.key \
24 -sha256
-utf8
-config
$^
-out
$@
28 openssl req
-new
-key
$^
-utf8
-subj
/CN
=$* -out
$@
31 umask
0077 && touch
$*.key
32 openssl req
-new
-newkey rsa
:$(keysize
) -nodes
-keyout
$*.key \
33 -utf8
-subj
/CN
=$* -out
$@
38 openssl req
-new
-x509
-key
$(lastword
$^
) -days
365 -sha256
-utf8 \
39 -config
$(firstword $^
) -out
$@
42 umask
0077 && touch
$*.key
43 openssl req
-new
-x509
-newkey rsa
:$(keysize
) -nodes
-keyout
$*.key \
44 -days
365 -sha256
-utf8
-config
$(firstword $^
) -out
$@
48 openssl req
-new
-x509
-key
$^
-days
365 -sha256
-utf8
-subj
/CN
=$* -out
$@
51 umask
0077 && touch
$*.key
52 openssl req
-new
-x509
-newkey rsa
:$(keysize
) -nodes
-keyout
$*.key \
53 -days
365 -sha256
-out
$@
-utf8
-subj
/CN
=$*
56 # Generate a config from the example
58 sed
's,example\.com,$*,g' openssl.cnf
> $@
61 umask
0077 && openssl genrsa
-out
$@
$(keysize
)
64 # Generate Diffie-Hellman parameters
66 openssl dhparam
-out
$@
$*