revert handling of empty param 2

This commit is contained in:
Trevor Batley 2023-09-29 08:48:18 +10:00
parent 87935e1a78
commit 427f3c6f33

View File

@ -3,17 +3,16 @@
set -e set -e
KOJI_USER="$1" KOJI_USER="$1"
CERT_SUBJECT="$2"
DEBUG= DEBUG=
SILENT="-s" SILENT="-s"
QUIET="-q" QUIET="-q"
for param in $2 $3 ; do for param in $3 ; do
if [ $param ] ; then if [ $param ] ; then
case $param in case $param in
debug ) debug )
DEBUG="debug" ;; DEBUG="debug" ;;
* )
CERT_SUBJECT="$2" ;;
esac esac
else else
break break
@ -27,12 +26,7 @@ if [ $DEBUG ] ; then
fi fi
openssl genrsa -out private/"$KOJI_USER".key 2048 openssl genrsa -out private/"$KOJI_USER".key 2048
if [ -z "$CERT_SUBJECT" ]; then
cat ssl.cnf | sed "s/$HOSTNAME/'${user}'/"> ssl2.cnf
openssl req -config ssl2.cnf -new -nodes -out certs/"$KOJI_USER".csr -key private/"$KOJI_USER".key
else
openssl req -subj "$CERT_SUBJECT" -config ssl.cnf -new -nodes -out certs/"$KOJI_USER".csr -key private/"$KOJI_USER".key openssl req -subj "$CERT_SUBJECT" -config ssl.cnf -new -nodes -out certs/"$KOJI_USER".csr -key private/"$KOJI_USER".key
fi
openssl ca -batch -config ssl.cnf -keyfile private/koji_ca_cert.key -cert koji_ca_cert.crt -out certs/"$KOJI_USER".crt -outdir certs -infiles certs/"$KOJI_USER".csr openssl ca -batch -config ssl.cnf -keyfile private/koji_ca_cert.key -cert koji_ca_cert.crt -out certs/"$KOJI_USER".crt -outdir certs -infiles certs/"$KOJI_USER".csr
cat certs/"$KOJI_USER".crt private/"$KOJI_USER".key > "$KOJI_USER".pem cat certs/"$KOJI_USER".crt private/"$KOJI_USER".key > "$KOJI_USER".pem
# Browser certificate is not password-protected, ask users to change their password # Browser certificate is not password-protected, ask users to change their password