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>
34 lines
439 B
Bash
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"
|