@ -84,7 +84,7 @@ sslfiles: $(SSLFILES) $(SSLDIRS)
# Root CA is self-signed.
ssl/root_ca.crt : ssl /root_ca .key conf /root_ca .config
openssl req -new -x509 -config conf/root_ca.config -days 10000 -key $< -out $@
$( OPENSSL) req -new -x509 -config conf/root_ca.config -days 10000 -key $< -out $@
#
# Special-case keys
@ -94,20 +94,20 @@ ssl/root_ca.crt: ssl/root_ca.key conf/root_ca.config
# Password-protected version of server-cn-only.key
ssl/server-password.key : ssl /server -cn -only .key
openssl rsa -aes256 -in $< -out $@ -passout 'pass:secret1'
$( OPENSSL) rsa -aes256 -in $< -out $@ -passout 'pass:secret1'
# DER-encoded version of client.key
ssl/client-der.key : ssl /client .key
openssl rsa -in $< -outform DER -out $@
$( OPENSSL) rsa -in $< -outform DER -out $@
# Convert client.key to encrypted PEM (X.509 text) and DER (X.509 ASN.1)
# formats to test libpq's support for the sslpassword= option.
ssl/client-encrypted-pem.key : ssl /client .key
openssl rsa -in $< -outform PEM -aes128 -passout 'pass:dUmmyP^#+' -out $@
$( OPENSSL) rsa -in $< -outform PEM -aes128 -passout 'pass:dUmmyP^#+' -out $@
# TODO Explicitly choosing -aes128 generates a key unusable to PostgreSQL with
# OpenSSL 3.0.0, so fall back on the default for now.
ssl/client-encrypted-der.key : ssl /client .key
openssl rsa -in $< -outform DER -passout 'pass:dUmmyP^#+' -out $@
$( OPENSSL) rsa -in $< -outform DER -passout 'pass:dUmmyP^#+' -out $@
#
# Combined files
@ -145,7 +145,7 @@ $(COMBINATIONS):
#
$(STANDARD_KEYS) :
openssl genrsa -out $@ 2048
$( OPENSSL) genrsa -out $@ 2048
chmod 0600 $@
#
@ -165,18 +165,18 @@ client_ca_state_files := ssl/client_ca-certindex ssl/client_ca-certindex.attr ss
# parallel processes, so we must mark the entire Makefile .NOTPARALLEL.
.NOTPARALLEL :
$(CA_CERTS) : ssl /%.crt : ssl /%.csr conf /%.config conf /cas .config ssl /root_ca .crt | ssl /new_certs_dir $( root_ca_state_files )
openssl ca -batch -config conf/cas.config -name root_ca -notext -in $< -out $@
$( OPENSSL) ca -batch -config conf/cas.config -name root_ca -notext -in $< -out $@
$(SERVER_CERTS) : ssl /%.crt : ssl /%.csr conf /%.config conf /cas .config ssl /server_ca .crt | ssl /new_certs_dir $( server_ca_state_files )
openssl ca -batch -config conf/cas.config -name server_ca -notext -in $< -out $@
$( OPENSSL) ca -batch -config conf/cas.config -name server_ca -notext -in $< -out $@
$(CLIENT_CERTS) : ssl /%.crt : ssl /%.csr conf /%.config conf /cas .config ssl /client_ca .crt | ssl /new_certs_dir $( client_ca_state_files )
openssl ca -batch -config conf/cas.config -name client_ca -notext -in $< -out $@
$( OPENSSL) ca -batch -config conf/cas.config -name client_ca -notext -in $< -out $@
# The CSRs don't need to persist after a build.
.INTERMEDIATE : $( CERTIFICATES :%=ssl /%.csr )
ssl/%.csr : ssl /%.key conf /%.config
openssl req -new -utf8 -key $< -out $@ -config conf/$* .config
$( OPENSSL) req -new -utf8 -key $< -out $@ -config conf/$* .config
#
# CA State
@ -210,16 +210,16 @@ ssl/%.srl:
#
ssl/root.crl : ssl /root_ca .crt | $( root_ca_state_files )
openssl ca -config conf/cas.config -name root_ca -gencrl -out $@
$( OPENSSL) ca -config conf/cas.config -name root_ca -gencrl -out $@
ssl/server.crl : ssl /server -revoked .crt ssl /server_ca .crt | $( server_ca_state_files )
openssl ca -config conf/cas.config -name server_ca -revoke $<
openssl ca -config conf/cas.config -name server_ca -gencrl -out $@
$( OPENSSL) ca -config conf/cas.config -name server_ca -revoke $<
$( OPENSSL) ca -config conf/cas.config -name server_ca -gencrl -out $@
ssl/client.crl : ssl /client -revoked .crt ssl /client -revoked -utf 8.crt ssl /client_ca .crt | $( client_ca_state_files )
openssl ca -config conf/cas.config -name client_ca -revoke ssl/client-revoked.crt
openssl ca -config conf/cas.config -name client_ca -revoke ssl/client-revoked-utf8.crt
openssl ca -config conf/cas.config -name client_ca -gencrl -out $@
$( OPENSSL) ca -config conf/cas.config -name client_ca -revoke ssl/client-revoked.crt
$( OPENSSL) ca -config conf/cas.config -name client_ca -revoke ssl/client-revoked-utf8.crt
$( OPENSSL) ca -config conf/cas.config -name client_ca -gencrl -out $@
#
# CRL hash directories
@ -230,7 +230,7 @@ ssl/root+client-crldir: ssl/client.crl ssl/root.crl
ssl/server-crldir : ssl /server .crl
ssl/client-crldir : ssl /client .crl
crlhashfile = $( shell openssl crl -hash -noout -in $( 1) ) .r0
crlhashfile = $( shell $( OPENSSL) crl -hash -noout -in $( 1) ) .r0
ssl/%-crldir :
mkdir -p $@