csrgen: Support encrypted private keys

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

Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
Ben Lipton authored and Jan Cholasta committed 2017-02-28 09:02:49 +00:00
1 parent 4350dcdea2
commit ada91c2058
2 files changed
+15 -4

No files matched your search

@@ -3,15 +3,16 @@
{%- endraw %}
#!/bin/bash -e
if [[ $# -ne 2 ]]; then
echo "Usage: $0 <outfile> <keyfile>"
if [[ $# -lt 2 ]]; then
echo "Usage: $0 <outfile> <keyfile> <other openssl arguments>"
echo "Called as: $0 $@"
exit 1
fi
CONFIG="$(mktemp)"
CSR="$1"
shift
KEYFILE="$2"
shift; shift
echo \
{% raw %}{% filter quote %}{% endraw -%}
@@ -30,5 +31,5 @@ req_extensions = {% call openssl.section() %}{{ rendered_extensions }}{% endcall
{{ openssl.openssl_sections|join('\n\n') }}
{% endfilter %}{%- endraw %} > "$CONFIG"
openssl req -new -config "$CONFIG" -out "$CSR" -key $1
openssl req -new -config "$CONFIG" -out "$CSR" -key "$KEYFILE" "$@"
rm "$CONFIG"