Skip to content

Commit

Permalink
EXTRA_DOMAINS is array, not string (possible fix for #87)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjakob committed Jul 16, 2019
1 parent 5c27eb9 commit ff093ac
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions certbot_zimbra.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ CERTPATH=""
LE_PARAMS=""
LE_AGREE_TOS=false
LE_NONIACT=false
EXTRA_DOMAINS=""
EXTRA_DOMAINS=()
NO_NGINX=false
DEPLOY_ONLY=false
NEW_CERT=false
Expand Down Expand Up @@ -222,7 +222,7 @@ patch_nginx() {
# detect additional public service hostnames from configured domains' zimbraPublicServiceHostname
find_additional_public_hostnames() {
# If already set, leave them alone
[ ! -z "$EXTRA_DOMAINS" ] && return
[ -n "$EXTRA_DOMAINS" ] && return

# If it has been requested NOT to perform the search
if ! "$DETECT_PUBLIC_HOSTNAMES"; then
Expand All @@ -236,7 +236,7 @@ find_additional_public_hostnames() {
[ -z "$getdomain" ] && continue
# Skip our primary domain
[ "$getdomain" == "$DOMAIN" ] && continue
EXTRA_DOMAINS="${EXTRA_DOMAINS} $getdomain"
EXTRA_DOMAINS=("${EXTRA_DOMAINS[@]}" "$getdomain")
! "$QUIET" && echo -n " $getdomain"
done
! "$QUIET" && echo
Expand All @@ -255,7 +255,7 @@ get_domain () {
[ -z "$DOMAIN" ] && echo "Error: No domain found! Please run with -d/--hostname or check why zmhostname is not working" && exit 1

! "$QUIET" && echo "Using domain $DOMAIN (as certificate DN)"
[ ! -z "$EXTRA_DOMAINS" ] && ! "$QUIET" && echo "Found domains to use as certificate SANs: $EXTRA_DOMAINS"
[ -n "$EXTRA_DOMAINS" ] && ! "$QUIET" && echo "Found domains to use as certificate SANs: ${EXTRA_DOMAINS[@]}"

if ! "$QUIET" && "$PROMPT_CONFIRM"; then
prompt "Is this correct?"
Expand Down Expand Up @@ -326,7 +326,7 @@ request_cert() {
"$LE_AGREE_TOS" && LE_PARAMS="$LE_PARAMS --agree-tos"
# use --cert-name instead of --expand as it allows also removing domains? https://github.com/certbot/certbot/issues/4275
LE_PARAMS="$LE_PARAMS --webroot -w $WEBROOT --expand -d $DOMAIN"
for d in "$EXTRA_DOMAINS"; do
for d in ${EXTRA_DOMAINS[@]}; do
[ -z "$d" ] && continue
LE_PARAMS="$LE_PARAMS -d $d"
done
Expand Down Expand Up @@ -529,7 +529,7 @@ while [[ $# -gt 0 ]]; do
# domain
-e|--extra-domain)
[ -z "$2" ] && echo "missing extra domain argument" && exit 1
EXTRA_DOMAINS="${EXTRA_DOMAINS} -d $2"
EXTRA_DOMAINS=("${EXTRA_DOMAINS[@]}" "$2")
DETECT_PUBLIC_HOSTNAMES=false
shift
;;
Expand Down

0 comments on commit ff093ac

Please sign in to comment.