Browse Source

Add --check-config and auto upgrade CA v02 url

pull/563/head
Tim Kimber 6 years ago
parent
commit
ee5e1e8cac
No known key found for this signature in database GPG Key ID: 3E1804964E76BD18
1 changed files with 24 additions and 0 deletions
  1. +24
    -0
      getssl

+ 24
- 0
getssl View File

@ -283,6 +283,7 @@ _REVOKE=0
_UPGRADE=0
_UPGRADE_CHECK=1
_USE_DEBUG=0
_ONLY_CHECK_CONFIG=0
config_errors="false"
LANG=C
API=1
@ -292,6 +293,18 @@ ORIGCMD="$0 $*"
# Define all functions (in alphabetical order)
auto_upgrade_v2() { # Automatically update clients to v2
if [[ "${CA}" == *"acme-v01."* ]] || [[ "${CA}" == *"acme-staging."* ]]; then
OLDCA=${CA}
# shellcheck disable=SC2001
CA=$(echo "${OLDCA}" | sed "s/v01/v02/g")
# shellcheck disable=SC2001
CA=$(echo "${CA}" | sed "s/staging/staging-v02/g")
info "Upgraded to v2 (changed ${OLDCA} to ${CA})"
fi
debug "Using certificate issuer: ${CA}"
}
cert_archive() { # Archive certificate file by copying files to dated archive dir.
debug "creating an archive copy of current new certs"
date_time=$(date +%Y_%m_%d_%H_%M)
@ -2245,6 +2258,8 @@ while [[ -n ${1+defined} ]]; do
_UPGRADE_CHECK=0 ;;
-i | --install)
_CERT_INSTALL=1 ;;
--check-config)
_ONLY_CHECK_CONFIG=1 ;;
-w)
shift; WORKING_DIR="$1" ;;
-*)
@ -2462,9 +2477,18 @@ set_server_type
# check what dns utils are installed
find_dns_utils
# auto upgrade clients to v2
auto_upgrade_v2
# check config for typical errors.
check_config
# exit if just checking config (used for testing)
if [ "${_ONLY_CHECK_CONFIG}" -eq 1 ]; then
info "Configuration check successful"
graceful_exit
fi
# if -i|--install install certs, reload and exit
if [ "0${_CERT_INSTALL}" -eq 1 ]; then
cert_install


Loading…
Cancel
Save