Commit ada91c2 introduced changes in "csrgen/templates/openssl_base.tmpl"
which broke the following 2 tests:
test_CSRGenerator.test_userCert_OpenSSL
test_CSRGenerator.test_caIPAserviceCert_OpenSSL
The tests use files caIPAserviceCert_openssl.sh and userCert_openssl.sh
as expected scripts in order to compare scripts generated by CSRGenerator.
E.g. as other parameter was introduced we are now not checking with
"if [[ $# -ne 2 ]]" but rather with if "[[ $# -lt 2 ]]".
https://pagure.io/freeipa/issue/6724
Reviewed-By: Milan Kubik <mkubik@redhat.com>
Reviewed-By: Christian Heimes <cheimes@redhat.com>
35 lines
498 B
Bash
35 lines
498 B
Bash
#!/bin/bash -e
|
|
|
|
if [[ $# -lt 2 ]]; then
|
|
echo "Usage: $0 <outfile> <keyfile> <other openssl arguments>"
|
|
echo "Called as: $0 $@"
|
|
exit 1
|
|
fi
|
|
|
|
CONFIG="$(mktemp)"
|
|
CSR="$1"
|
|
KEYFILE="$2"
|
|
shift; shift
|
|
|
|
echo \
|
|
'[ req ]
|
|
prompt = no
|
|
encrypt_key = no
|
|
|
|
distinguished_name = sec0
|
|
req_extensions = sec2
|
|
|
|
[ sec0 ]
|
|
O=DOMAIN.EXAMPLE.COM
|
|
CN=testuser
|
|
|
|
[ sec1 ]
|
|
email = testuser@example.com
|
|
|
|
[ sec2 ]
|
|
subjectAltName = @sec1
|
|
' > "$CONFIG"
|
|
|
|
openssl req -new -config "$CONFIG" -out "$CSR" -key "$KEYFILE" "$@"
|
|
rm "$CONFIG"
|