Files
freeipa/ipatests/test_ipaclient/data/test_csrgen/scripts/userCert_openssl.sh
T
Ben Lipton a26cf0d791 tests: Add tests for CSR autogeneration
This patch also contains some code changes to make the code easier to
test and to make the tests pass.

https://fedorahosted.org/freeipa/ticket/4899

Reviewed-By: Jan Cholasta <jcholast@redhat.com>
2017-01-31 10:20:28 +01:00

34 lines
439 B
Bash

#!/bin/bash -e
if [[ $# -ne 2 ]]; then
echo "Usage: $0 <outfile> <keyfile>"
echo "Called as: $0 $@"
exit 1
fi
CONFIG="$(mktemp)"
CSR="$1"
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 $1
rm "$CONFIG"