6 if [ -z "$f" ]; then echo -n ,; fi
13 echo "usage: certreq [-h] [-a ALTNAMES] SUBJECT KEYFILE"
14 echo ' SUBJECT is of the form `/PART1=VALUE1/PART2=VALUE2/...'\'
15 echo ' ALTNAMES is of the form `DNS:name1,DNS:name,...'\'
18 declare -A reqexts config
19 while getopts ha: OPT; do
28 config_SAN=("${config_SAN[@]}" "subjectAltName=$OPTARG")
38 args=(openssl req -new)
39 if [ -n "${!reqexts[*]}" ]; then
40 for reqext in "${!reqexts[@]}"; do
41 args=("${args[@]}" -reqexts "$reqext")
44 if [ -n "${!config[*]}" ]; then
45 confpath="$(mktemp /tmp/certreq-XXXXXX)"
46 cat /etc/ssl/openssl.cnf >>"$confpath"
47 for section in "${!config[@]}"; do
48 echo "[${section}]" >>"$confpath"
49 var="config_${section}[@]"
50 for confopt in "${!var}"; do
51 echo "$confopt" >>"$confpath"
55 trap 'rm -f "$confpath"' EXIT
56 args=("${args[@]}" -config "$confpath")
58 args=("${args[@]}" -subj "$1" -key "$2")