Skip to content

Commit fb9e16c

Browse files
author
srvrco
committed
bugfix CSR renewal when no SANS #191 and when using MINGW #189
1 parent ed6c14b commit fb9e16c

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

getssl

+10-3
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,11 @@
158158
# 2016-11-13 bug fix DOMAIN_KEY_CERT generation (1.82)
159159
# 2016-11-17 add PREVENT_NON_INTERACTIVE_RENEWAL option (1.83)
160160
# 2016-12-03 add HTTP_TOKEN_CHECK_WAIT option (1.84)
161+
# 2016-12-03 bugfix CSR renewal when no SANS and when using MINGW (1.85)
161162
# ----------------------------------------------------------------------------------------
162163

163164
PROGNAME=${0##*/}
164-
VERSION="1.84"
165+
VERSION="1.85"
165166

166167
# defaults
167168
CODE_LOCATION="https://raw.githubusercontent.com/srvrco/getssl/master/getssl"
@@ -419,7 +420,7 @@ create_csr() { # create a csr using a given key (if it doesn't already exist)
419420
if [[ -s "$csr_file" ]]; then
420421
debug "domain csr exists at - $csr_file"
421422
# check all domains in config are in csr
422-
alldomains=$(echo "$DOMAIN,$SANS" | sed -e 's/ //g; y/,/\n/' | sort -u)
423+
alldomains=$(echo "$DOMAIN,$SANS" | sed -e 's/ //g; s/,$//; y/,/\n/' | sort -u)
423424
domains_in_csr=$(openssl req -text -noout -in "$csr_file" \
424425
| sed -n -e 's/^ *Subject: .* CN=\([A-Za-z0-9.-]*\).*$/\1/p; /^ *DNS:.../ { s/ *DNS://g; y/,/\n/; p; }' \
425426
| sort -u)
@@ -445,7 +446,11 @@ create_csr() { # create a csr using a given key (if it doesn't already exist)
445446
tmp_conf=$(mktemp)
446447
cat "$SSLCONF" > "$tmp_conf"
447448
printf "[SAN]\n%s" "$SANLIST" >> "$tmp_conf"
448-
openssl req -new -sha256 -key "$csr_key" -subj "/" -reqexts SAN -config "$tmp_conf" > "$csr_file"
449+
if [[ "$os" == "mingw" ]]; then
450+
openssl req -new -sha256 -key "$csr_key" -subj "//" -reqexts SAN -config "$tmp_conf" > "$csr_file"
451+
else
452+
openssl req -new -sha256 -key "$csr_key" -subj "/" -reqexts SAN -config "$tmp_conf" > "$csr_file"
453+
fi
449454
rm -f "$tmp_conf"
450455
fi
451456
}
@@ -631,6 +636,8 @@ get_os() { # function to get the current Operating System
631636
os="mac"
632637
elif [[ ${uname_res:0:6} == "CYGWIN" ]]; then
633638
os="cygwin"
639+
elif [[ ${uname_res:0:6} == "MINGW" ]]; then
640+
os="mingw"
634641
else
635642
os="unknown"
636643
fi

0 commit comments

Comments
 (0)