From 87935e1a78727fa34c17a8b65b58fde33a78b21a Mon Sep 17 00:00:00 2001 From: Trevor Batley Date: Fri, 29 Sep 2023 07:46:54 +1000 Subject: [PATCH] fix gencert without param 2 error --- koji-setup/koji-gencert.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/koji-setup/koji-gencert.sh b/koji-setup/koji-gencert.sh index 92d0128..5b38b60 100755 --- a/koji-setup/koji-gencert.sh +++ b/koji-setup/koji-gencert.sh @@ -3,16 +3,17 @@ set -e KOJI_USER="$1" -CERT_SUBJECT="$2" DEBUG= SILENT="-s" QUIET="-q" -for param in $3 ; do +for param in $2 $3 ; do if [ $param ] ; then case $param in debug ) DEBUG="debug" ;; + * ) + CERT_SUBJECT="$2" ;; esac else break @@ -27,7 +28,8 @@ fi openssl genrsa -out private/"$KOJI_USER".key 2048 if [ -z "$CERT_SUBJECT" ]; then - openssl req -config ssl.cnf -new -nodes -out certs/"$KOJI_USER".csr -key private/"$KOJI_USER".key + 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 fi