#!/bin/bash

# Take arguments(s) to be sets of cert names,
# each set comma (,) separated set of one or more cert names.
# For each set, generate cert, if set has multiple comma (,) separated
# names, use first for CN, and Subject Alternative Name (SAN) for all in
# the set

umask 077 || exit
LC_ALL=C export LC_ALL
rc=0

[ "$#" -ge 1 ] || {
	1>&2 printf '%s\n' "usage $0: certset [ certset ... ]"
	exit 1
}

for certset
do
	. ~mycert/bin/.GenCSRs.common \
	|| rc=1
	printf '%s\n' "keyfile=$keyfile csrfile=$csrfile CN=$CN SAN=$SAN"
done
exit "$rc"
