Skip to content

Commit df3285d

Browse files
author
srvrco
committed
bugfix - deleting csr (#227) and check domain/private key different (#228)
1 parent 60e04ae commit df3285d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

getssl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,12 @@
177177
# 2017-01-03 Created check_config function to list all obvious config issues (2.02)
178178
# 2017-01-10 force renew if FORCE_RENEWAL file exists (2.03)
179179
# 2017-01-12 added drill, dig or host as alternatives to nslookup (2.04)
180+
# 2017-01-18 bugfix issue #227 - error deleting csr if doesn't exist
181+
# 2017-01-18 issue #228 check private key and account key are different (2.05)
180182
# ----------------------------------------------------------------------------------------
181183

182184
PROGNAME=${0##*/}
183-
VERSION="2.04"
185+
VERSION="2.05"
184186

185187
# defaults
186188
ACCOUNT_KEY_LENGTH=4096
@@ -316,6 +318,10 @@ check_config() { # check the config files for all obvious errors
316318
info "${DOMAIN}: invalid ACCOUNT_KEY_TYPE"
317319
config_errors=true
318320
fi
321+
if [[ "$ACCOUNT_KEY" == "$DOMAIN_DIR/${DOMAIN}.key" ]]; then
322+
info "${DOMAIN}: ACCOUNT_KEY and domain key ( $DOMAIN_DIR/${DOMAIN}.key ) must be different"
323+
config_errors=true
324+
fi
319325
if [[ ! "$PRIVATE_KEY_ALG" =~ ^(rsa|prime256v1|secp384r1|secp521r1)$ ]]; then
320326
info "${DOMAIN}: invalid PRIVATE_KEY_ALG"
321327
config_errors=true
@@ -629,7 +635,9 @@ create_key() { # create a domain key (if it doesn't already exist)
629635
esac
630636
umask "$ORIG_UMASK"
631637
# remove csr on generation of new domain key
632-
rm -f "${key_loc::-4}.csr"
638+
if [[ -e "${key_loc::-4}.csr" ]]; then
639+
rm -f "${key_loc::-4}.csr"
640+
fi
633641
fi
634642
}
635643

0 commit comments

Comments
 (0)