%.dh for generating diffie-hellmann-params added. sslmake BITS=1234 (default 4096) added.

This commit is contained in:
Denis Knauf 2018-01-11 21:35:43 +01:00
parent 343f6262d0
commit 31172b9c00
3 changed files with 31 additions and 16 deletions

View file

@ -2,14 +2,17 @@
# vi:set filetype=makefile
NULL=0 exec make "CALL=$0" "EXE=`which $0`" -f "`which $0`" -- "$@"
EXE ?= sslmake
CALL ?= `which $(EXE)`
BITS ?= 4096
EXE ?= sslmake
CALL ?= `which $(EXE)`
DEFAULTOPENSSLCNF ?= /etc/ssl/openssl.cnf
S ?= .
S ?= .
OPENSSL ?= /usr/bin/openssl
GENRSA = $(OPENSSL) genrsa
REQ = $(OPENSSL) req
SIGN = $(OPENSSL) x509
GENRSA ?= $(OPENSSL) genrsa
GENDH ?= $(OPENSSL) gendh
GENREQ ?= $(OPENSSL) req
SIGN ?= $(OPENSSL) x509
all: help
--help -h: help
@ -19,6 +22,7 @@ all: help
help:
@echo -e "\
Creates SSL-keys and -certificate requests named %.key/%.csr (replace % by name)\n\
BITS=strength: for setting bit-strength (default $(BITS))\n\
--help -h: Display this help message.\n\
--renew -r: Renews %.csr for all %.key.\n\
--build -b: Builds %.csr and %.key for every %.cnf if doesn't exist.\n\
@ -44,10 +48,13 @@ root.crt:
cp "$(DEFAULTOPENSSLCNF)" "$(@)"
%.key:
umask 177 ; $(GENRSA) -out "$(@)" 4096
umask 177 ; $(GENRSA) -out "$(@)" $(BITS)
%.dh:
umask 177 ; $(GENDH) -out "$(@)" $(BITS)
%.csr: %.cnf %.key
$(REQ) -config "$(*).cnf" -batch -nodes -new -key$$([ -e "$(*).key" ] || echo out ) "$(*).key" -out "$(@)"
$(GENREQ) -config "$(*).cnf" -batch -nodes -new -key$$([ -e "$(*).key" ] || echo out ) "$(*).key" -out "$(@)"
%.crt: %.csr serial root.crt root.key
$(SIGN) -req -days 365 -in "$(*).csr" -CA root.crt -CAkey root.key -CAserial "serial" -out "$(@)"